מדיה ויקי:Gadget-Collapsetables.js: הבדלים בין גרסאות בדף
מראה
מ תיקון |
מ 17 גרסאות של הדף wikipedia:he:מדיה_ויקי:Gadget-Collapsetables.js יובאו |
||
| (11 גרסאות ביניים של 4 משתמשים אינן מוצגות) | |||
| שורה 1: | שורה 1: | ||
/** Collapsible tables ********************************************************* | /** Collapsible tables ********************************************************* | ||
* | * | ||
* Description: Allows tables to be collapsed | * Description: Allows tables to be collapsed - using $.makeCollapsible | ||
*/ | */ | ||
var autoCollapse = 2; | var autoCollapse = 2; | ||
function | mw.hook( 'wikipage.content' ).add( function ( $content ) { | ||
{ | var $tables = $content | ||
.find( 'table.collapsible:not(.mw-collapsible)' ) | |||
.addClass( 'mw-collapsible' ); | |||
$.each( $tables, function( index, table ) { | |||
if( $( table ).hasClass( 'collapsed') ) { | |||
$( table ).addClass( 'mw-collapsed' ); | |||
} | |||
} ); | |||
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(); | |||
} ); | |||
} | |||
} ); | |||
} | |||
גרסה אחרונה מ־20:08, 5 בדצמבר 2022
/** Collapsible tables *********************************************************
*
* Description: Allows tables to be collapsed - using $.makeCollapsible
*/
var autoCollapse = 2;
mw.hook( 'wikipage.content' ).add( function ( $content ) {
var $tables = $content
.find( 'table.collapsible:not(.mw-collapsible)' )
.addClass( 'mw-collapsible' );
$.each( $tables, function( index, table ) {
if( $( table ).hasClass( 'collapsed') ) {
$( table ).addClass( 'mw-collapsed' );
}
} );
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();
} );
}
} );