MediaWiki:Mobile.js: Difference between revisions
attempting to import data
imported>Maintenance script-gpuser (Automated Import) |
imported>Kittymmeow (attempting to import data) |
||
Line 21: | Line 21: | ||
var fpmobilecollapse = fpmobilecollapse || { | var fpmobilecollapse = fpmobilecollapse || { | ||
initialize : function() { | |||
var index = 0; | |||
$( '.fpbox.mobilecollapsible' ).each( function() { | |||
var heading = $( this ).children( '.fpbox-heading' ).not( '.nomobile, .notoggle' ); | |||
if ( heading.length > 0 && $( this ).children( '.body' ).length > 0 ) { | |||
$( this ).addClass( 'mobilecollapsible' + index ); | |||
if ( !( $( this ).hasClass( 'expanded') ) ) { | |||
$( this ).addClass( 'collapsed' ); | |||
} | |||
heading.first().html( $( '<a class="togglecollapse" href="javascript:fpmobilecollapse.toggle( ' + index + ' )"></a>' ).html( heading.html() ) ); | |||
} | |||
++index; | |||
} ); | |||
}, | |||
toggle : function( index ) { | |||
$( '.fpbox.mobilecollapsible' + index ).each( function() { | |||
if ( $( this ).hasClass( 'collapsed' ) ) { | |||
$( this ).removeClass( 'collapsed' ); | |||
$( this ).addClass( 'expanded' ); | |||
} else { | |||
$( this ).removeClass( 'expanded' ); | |||
$( this ).addClass( 'collapsed' ); | |||
} | |||
} ); | |||
} | |||
} | } | ||