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_]; | ||
var divOutside = document.createElement('div'); | if(child.className != "timeline"){ //排除特殊格式用的表格 | ||
var divOutside = document.createElement('div'); | |||
divOutside.setAttribute("class", "divOutsideTable"); | |||
if(child.parentNode){ | |||
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();
});