מדיה ויקי:Gadget-Collapsetables.js: הבדלים בין גרסאות בדף
תמיכה גם באנגלית, אם שפת הממשק אנגלית, בדומה למדיה ויקי:Navigationbar.js |
ניסיון לתיקון הבעייה של הצגת השורות |
||
| שורה 14: | שורה 14: | ||
var Button = document.getElementById( "collapseButton" + tableIndex ); | var Button = document.getElementById( "collapseButton" + tableIndex ); | ||
var Table = document.getElementById( "collapsibleTable" + tableIndex ); | var Table = document.getElementById( "collapsibleTable" + tableIndex ); | ||
var allRows = Table.getElementsByTagName( "tr" ); | |||
if ( !Table || !Button ) { | if ( !Table || !Button || Rows.length == 0 ) { | ||
return; | return; | ||
} | } | ||
var Rows = | var Rows = Rows[0].parentNode.childNodes; | ||
if ( Button.firstChild.data == collapseCaption ) { | if ( Button.firstChild.data == collapseCaption ) { | ||
for ( var i = 1; i < Rows.length; i++ ) { | for ( var i = 1; i < Rows.length; i++ ) { | ||
Rows[i].style.display = "none"; | if ( Rows[i].nodeType == document.ELEMENT_NODE ) { | ||
Rows[i].style.display = "none"; | |||
} | |||
} | } | ||
Button.firstChild.data = expandCaption; | Button.firstChild.data = expandCaption; | ||
} else { | } else { | ||
for ( var i = 1; i < Rows.length; i++ ) { | for ( var i = 1; i < Rows.length; i++ ) { | ||
Rows[i]. | if ( Rows[i].nodeType == document.ELEMENT_NODE ) { | ||
Rows[i].style.display = ""; | |||
} | |||
} | } | ||
Button.firstChild.data = collapseCaption; | Button.firstChild.data = collapseCaption; | ||