MediaWiki:Common.js

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

importScript('MediaWiki:Functions.js');

/** * jQuery version of fillEditSummaries * @author Grunny */ function fillEditSummaries {

if( !$( '#wpSummaryLabel' ).length ) { return; }	var	summaryOptionsHtml = '', $summaryOptionsList;

$.get( wgScript, { title: 'Template:Stdsummaries', 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) : "";			summaryOptionsHtml += '' + lines[i] + ' ';		}		$summaryOptionsList = $( ' ' ).attr( 'id', 'stdEditSummaries' ).html( summaryOptionsHtml ).change( function { var value = $( this ).val; if ( value !== '' ) { if( skin === 'oasis' ) { $( '#wpSummary' ).text( value ); } else { $( '#wpSummary' ).val( value ); }			}		} );

$( '#wpSummaryLabel' ).prepend( 'Standard summaries: ', $summaryOptionsList, ' ' ); } );

}

/* ================= * jQuery version of fillPreloads * by Grunny at starwars.wikia.com * ================= */

function fillPreloads { if( !$( '#lf-preload' ).length ) { return; }	var	preloadOptionsHtml = '', $preloadOptionsList; $( '#lf-preload' ).attr( 'style', 'display: block' ); $.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 );				} ); }		} );		$( '#lf-preload-cbox' ).html( $preloadOptionsList );	} ); $( '#lf-preload-pagename' ).html( '' ); $( '#lf-preload-button' ).html( '' ); } function doCustomPreload { doPreload(document.getElementById('lf-preload-pagename').getElementsByTagName('input')[0].value); }

/* =============  Title rewrite jQuery version and new wikia skin fixes by Grunny ==============  This is what powers template:title, principally allowing for italic page titles ============== */ function rewriteTitle { if( typeof( window.SKIP_TITLE_REWRITE ) != 'undefined' && window.SKIP_TITLE_REWRITE ) { return; }	if( $('#title-meta').length == 0 ) { return; }	var newTitle = $('#title-meta').html; if( skin == "oasis" ) { $('header.WikiaPageHeader > h1').html(' ' + newTitle + ' '); $('header.WikiaPageHeader > h1').attr('style','text-align:' + $('#title-align').html + ';'); } else { $('.firstHeading').html(' ' + newTitle + ' '); $('.firstHeading').attr('style','text-align:' + $('#title-align').html + ';'); } }

importScriptPage('ShowHide/code.js', 'dev'); importScriptPage('EditIntroButton/code.js', 'dev'); importScriptPage('DisplayClock/code.js', 'dev'); importScriptPage('PurgeButton/code.js', 'dev'); importScriptPage('DupImageList/code.js', 'dev');

var ArchiveToolConfig = { archiveListTemplate: 'ArchCat', archivePageTemplate: 'ArchPage', archiveSubpage: 'Archive', userLang: true }; importScriptPage('ArchiveTool/code.js', 'dev');

/* =============  MOS box from Brickipedia ==============  This is the little box underneath the search bar and article tally, which has the Seal of Rassilon in it. ===============  Keep at end of common.js, but before any addOnloadHooks. ================ */

importScript('MediaWiki:Common.js/mosbox.js');

/* ================    addOnloadHook area ================   Necessary for calling to life functions specified elsewehre in this document. ================= */

addOnloadHook( rewriteTitle );