MediaWiki:Mobile.js: Difference between revisions

282 bytes removed ,  04:23, 12 April 2019
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() {
initialize : function() {
        var index = 0;
var index = 0;
        $( '.fpbox.mobilecollapsible' ).each( function() {
$( '.fpbox.mobilecollapsible' ).each( function() {
            var heading = $( this ).children( '.heading' ).not( '.nomobile, .notoggle' );
var heading = $( this ).children( '.fpbox-heading' ).not( '.nomobile, .notoggle' );
            if ( heading.length > 0 && $( this ).children( '.body' ).length > 0 ) {
if ( heading.length > 0 && $( this ).children( '.body' ).length > 0 ) {
                $( this ).addClass( 'mobilecollapsible' + index );
$( this ).addClass( 'mobilecollapsible' + index );
                if ( !( $( this ).hasClass( 'expanded') ) ) {
if ( !( $( this ).hasClass( 'expanded') ) ) {
                    $( this ).addClass( 'collapsed' );
$( this ).addClass( 'collapsed' );
                }
}
                heading.first().html( $( '<a class="togglecollapse" href="javascript:fpmobilecollapse.toggle( ' + index + ' )"></a>' ).html( heading.html() ) );
heading.first().html( $( '<a class="togglecollapse" href="javascript:fpmobilecollapse.toggle( ' + index + ' )"></a>' ).html( heading.html() ) );
            }
}
            ++index;
++index;
        } );
} );
    },
},
    toggle : function( index ) {
toggle : function( index ) {
        $( '.fpbox.mobilecollapsible' + index ).each( function() {
$( '.fpbox.mobilecollapsible' + index ).each( function() {
            if ( $( this ).hasClass( 'collapsed' ) ) {
if ( $( this ).hasClass( 'collapsed' ) ) {
                $( this ).removeClass( 'collapsed' );
$( this ).removeClass( 'collapsed' );
                $( this ).addClass( 'expanded' );
$( this ).addClass( 'expanded' );
            } else {
} else {
                $( this ).removeClass( 'expanded' );
$( this ).removeClass( 'expanded' );
                $( this ).addClass( 'collapsed' );
$( this ).addClass( 'collapsed' );
            }
}
        } );
} );
    }
}
}
}


Anonymous user