מדיה ויקי:Gadget-Collapsetables.js: הבדלים בין גרסאות בדף
מאין תקציר עריכה |
מ 17 גרסאות של הדף wikipedia:he:מדיה_ויקי:Gadget-Collapsetables.js יובאו |
||
| (5 גרסאות ביניים של 2 משתמשים אינן מוצגות) | |||
| שורה 5: | שורה 5: | ||
var autoCollapse = 2; | var autoCollapse = 2; | ||
mw.hook( 'wikipage.content' ).add( function ( $content ) { | |||
var $tables = $content | |||
if | .find( 'table.collapsible:not(.mw-collapsible)' ) | ||
$( | .addClass( 'mw-collapsible' ); | ||
$.each( $tables, function( index, table ) { | |||
if( $( table ).hasClass( 'collapsed') ) { | |||
$( table ).addClass( 'mw-collapsed' ); | |||
} | } | ||
$('table.collapsible').makeCollapsible(); | } ); | ||
if( $tables.length > 0 ) { | |||
}); | mw.loader.using( 'jquery.makeCollapsible' ).then( function() { | ||
$tables.makeCollapsible(); | |||
mw.hook( 'he.wikipedia.collapsetables.loaded' ).fire(); | |||
} ); | |||
} | |||
if ( ( $content.find( 'table.collapsible' ).length + $content.find( 'table.mw-collapsible' ).length ) > autoCollapse ) { | |||
mw.loader.using( 'jquery.makeCollapsible' ).then( function() { | |||
$content.find( 'table.collapsible.autocollapse' ).addClass( 'mw-collapsed' ).makeCollapsible(); | |||
} ); | |||
} | |||
} ); | |||