Difference between revisions of "MediaWiki:Common.js"

From NoxiousWiki
Jump to: navigation, search
(Created page with "Any JavaScript here will be loaded for all users on every page load.: function isSortedTablePage() { return ( wgPageName == "Page_To_Sort" || wgPageName == "Other_Pa...")
 
 
Line 1: Line 1:
 
/* Any JavaScript here will be loaded for all users on every page load. */
 
/* Any JavaScript here will be loaded for all users on every page load. */
 +
 
function isSortedTablePage() {
 
function isSortedTablePage() {
     return ( wgPageName == "Page_To_Sort"  || wgPageName == "Other_Page_To_Sort" );
+
     return ( wgPageName == "Quest_Guides"  || wgPageName == "Custom_Spawn_Guides" );
 
}
 
}
  

Latest revision as of 19:19, 1 August 2018

/* Any JavaScript here will be loaded for all users on every page load. */

function isSortedTablePage() {
    return ( wgPageName == "Quest_Guides"  || wgPageName == "Custom_Spawn_Guides" );
}

jQuery( document ).ready( function( $ ) {
    // wrapped in "mw.loader.using" so this doesn't execute until Tablesorter has loaded
    mw.loader.using( 'jquery.tablesorter', function() {
        if( isSortedTablePage() ) $('table.sortable').tablesorter( {sortList: [ { 0: 'asc'} ]} )
        // or look for tables with an ID attribute of "sortMe" on any page
        // $( '#sortMe' ).tablesorter( {sortList: [ { 0: 'asc'} ]} )
    } );
} );