MediaWiki:Gadget-OutsideTable.js:修订间差异

此后如竟没有炬火,我便是唯一的光。
跳转到导航 跳转到搜索
(// Edit via Wikiplus)
 
无编辑摘要
 
第4行: 第4行:
for(var child_ in allTable) {
for(var child_ in allTable) {
var child = allTable[child_];
var child = allTable[child_];
if(child.className != "timeline"){ //排除特殊格式用的表格
var divOutside = document.createElement('div');
divOutside.setAttribute("class", "divOutsideTable");
var divOutside = document.createElement('div');
if(child.parentNode){
divOutside.setAttribute("class", "divOutsideTable");
child.parentNode.insertBefore(divOutside, child);
if(child.parentNode){
divOutside.appendChild(child);
child.parentNode.insertBefore(divOutside, child);
divOutside.appendChild(child);
}
}
}
}
}

2023年11月11日 (六) 13:43的最新版本

function injectDivOutsideTable() { //注入表格外父级div
    var allTable = document.getElementsByTagName("table");
    if(allTable) {
        for(var child_ in allTable) {
            var child = allTable[child_];
            if(child.className != "timeline"){ //排除特殊格式用的表格
	            var divOutside = document.createElement('div');
	            divOutside.setAttribute("class", "divOutsideTable");
	            if(child.parentNode){
	                child.parentNode.insertBefore(divOutside, child);
	                divOutside.appendChild(child);
	            }
            }
        }
        return true;
    } else {
        return false;
    }
}
$(function() {
    injectDivOutsideTable();
});