MediaWiki:Monobook.js

/** * MediaWiki:Monobook.js * Any JavaScript here will be loaded for Monobook users on every page load. * * For JavaScript for both skins, see MediaWiki:Common.js. * For JavaScript for the Oasis sin, see MediaWiki:Wikia.js. */

/*jshint bitwise:true, browser:true, camelcase:true, curly:true, devel:false, eqeqeq:true, es3:false, forin:true, immed:true, indent:4, jquery:true, latedef:true, newcap:true, noarg:true, noempty:true, nonew:true, onevar:true, plusplus:true, quotmark:single, undef:true, unused:true, strict:true, trailing:true

/*global dismissNotice:true, importArticles:true, mediaWiki:true, rswiki:true */

// define global vars this.rswiki = this.rswiki || {};

( function ( window, $, mw, dismissNotice, importArticles, rswiki ) {

'use strict';

rswiki.monobook = {

/**        * Loading function */       init: function  {

var scripts = [], config = mw.config.get( [                   'wgCanonicalSpecialPageName',                    'wgNamespaceNumber',                    'wgPageName',                    'wgUserLanguage'                ] );

rswiki.monobook.moveDismiss;

if ( ( config.wgPageName === 'RuneScape_Wiki' || config.wgPageName === 'Talk:RuneScape_Wiki' ) &&               config.wgUserLanguage === 'en' ) { rswiki.monobook.articleToMain; }

if ( config.wgCanonicalSpecialPageName === 'Chat' ) { rswiki.monobook.chatRedirect; }

/**            * Imports */           scripts.push(                // Collapsible sidebar portlets                'MediaWiki:Common.js/collapsiblesidebarportlets.js'            );

if ( config.wgNamespaceNumber === 2 || config.wgNamespaceNumber === 3 ) { // Replicates user masthead in oasis scripts.push('User:Hairr/userinfo.js'); }

mw.log( scripts );

importArticles( {               type: 'script',                articles: scripts            } );

},

/**        * Changes 'article' to 'main page' */       articleToMain: function  { $( '#ca-nstab-main a' ).text( 'Main page' ); },

/**        * Redirect non-wikia skin users to the correct link for Special:Chat */       chatRedirect: function  { window.location.search += ( window.location.search ? '&' : '?' ) + 'useskin=oasis'; },

/**        * Move dismiss sitenotice link to within the table */       moveDismiss: function  {

$( '#localNotice th' ) .append(               $( ' ' )                .attr( { 'class': 'sn-dismiss' } )                .append( '[',                   $( '' ) .click( dismissNotice ) .text( 'dismiss' ), ']'               )            );        }

};

$( rswiki.monobook.init );

}(this, jQuery, mediaWiki, dismissNotice, importArticles, rswiki ) );

/* */