MediaWiki:Mobile.js: Difference between revisions

Jump to navigation Jump to search
imported>Kittymmeow
(attempting to import data)
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( '.fpbox-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');
}
            }
} );
        });
}
    }
}
}


window.fpmobilecollapse = fpmobilecollapse;
window.fpmobilecollapse = fpmobilecollapse;


$( document ).ready( fpmobilecollapse.initialize );
$(document).ready(fpmobilecollapse.initialize);


/****************************************
/****************************************
/* End Main Page Mobile Collapse Script *
/* End Main Page Mobile Collapse Script *
/****************************************/
/****************************************/