MediaWiki:Wikia.js

/* */

$(document).ready(function {	// A big thanks to user:The Librarian who first pointed out the problem this code will fix. This restores normal upload form since the popup one ignores source and license policy. Adapted from http://es.pokemon.wikia.com/wiki/MediaWiki:Wikia.js via Wookieepedia.	$('a.wikia-button.upphotos').unbind('click',UploadPhotos.showDialog); });

// Welcome notification message // from sourcepedia.wikia.com // removed for preload testing

/* =========================  Custom preload templates for the new (2011) Wikia editor Version 0.2 23.12.11 with slight cosmetic changes from original =========================  Written by starwars:user:Grunny First published at: starwars:MediaWiki:Wikia.js =========================  Requires additional code at   Common.js   ========================= */

function customPreloadTemplates { if( wgAction !== 'edit' || !$( 'div.module_content' ).length ) { return; }	var	preloadOptionsHtml = '', $preloadOptionsList, preloadBaseHtml = ' Standard preloads: ' +			' Custom preload pagename: ';	$( 'div.module_content:first' ).append( preloadBaseHtml ); $.get( wgScript, { title: 'Template:Stdpreloads', action: 'raw', ctype: 'text/plain' }, function( data ) {		var lines = data.split( '\n' );		for( var i = 0; i < lines.length; i++ ) {			var value = ( lines[i].indexOf( '-- ' ) === 0 ) ? lines[i].substring(3) : "";			preloadOptionsHtml += '' + lines[i] + ' ';		}		$preloadOptionsList = $( ' ' ).attr( 'id', 'stdSummaries' ).html( preloadOptionsHtml ).change( function { var value = $( this ).val; if ( value !== '' ) { value = 'Template:' + value + '/preload'; value = value.replace( ' ', '_' ); $.get( wgScript, { title: value, action: 'raw', ctype: 'text/plain' }, function( data ) {					insertAtCursor( document.getElementById( 'wpTextbox1' ), data );				} ); }		} );		$( 'div#lf-preload' ).append( $preloadOptionsList );	} ); $( '#lf-preload-pagename-w' ).html( '' ); $( '#lf-preload-button-w' ).html( '' ); } $( customPreloadTemplates ); function doCustomPreloadOasis { var value = $( '#lf-preload-pagename-w > input' ).val; value = value.replace( ' ', '_' ); $.get( wgScript, { title: value, action: 'raw', ctype: 'text/plain' }, function( data ) {		insertAtCursor( document.getElementById( 'wpTextbox1' ), data );	} ); }

/* ==================  COLOUR CHANGER 1.0 ==================  by user:Pecoes see http://community.wikia.com/wiki/Thread:477388 for conceptual design discussion ================== */

(function (mw, $, window) {   'use strict';    if (mw.config.get('skin') !== 'oasis' || mw.config.get('wgNamespaceNumber')) return;    var css, stylesheet, button, defer;    function addStylesheet  {        stylesheet =        $('' + css + '">')        .appendTo(window.document.head || 'head');        $.storage.set('altStylesheet', '1');    }    function loadStylesheet  {        if (!css) {            if (defer && defer.state === 'pending') return;            if (button && button.length) {                button.prop('disabled', true);            }            defer = $.ajax({                url: 'http://tardis.wikia.com/index.php?title=MediaWiki:Ns0.css&action=raw&ctype=text/css&maxage=3600&smaxage=3600',                dataType: 'text',                async: false,                cache: true            })            .done(function (text) { css = text; addStylesheet; if (button && button.length) { button.prop('disabled', false); }           });        } else {            addStylesheet;        }    }    if ($.storage.get('altStylesheet')) {        loadStylesheet;    }    $(function  { button = // this is the button: $('') .appendTo('#WikiaPageHeader') .click(function {            var stylesheet = $('#alt-stylesheet');            if (stylesheet.length) {                stylesheet.remove;                $.storage.del('altStylesheet');            } else {                loadStylesheet;            }            // this BS code forces stupid browsers to repaint:            var div = $(' ').appendTo(window.document.body);            window.setTimeout(function{ div.remove; }, 0);        }); if (defer && defer.state === 'pending') { button.prop('disabled', true); }   }); }(mediaWiki, jQuery, window));

//Getting rid of comment button $('a[data-id="comment"]').removeClass('comments');

importArticles({   type: "script",    articles: [        "MediaWiki:Common.js/displayTimer.js",        "w:c:dev:ListAdmins/code.js",        "w:c:dev:UserTags/code.js"    ], });

/* */