MediaWiki:Wikia.js

/* */ $(document).ready(function {	// Restores normal upload form since the popup one ignores source and license policy. Adapted from http://es.pokemon.wikia.com/wiki/MediaWiki:Wikia.js.	$('a.wikia-button.upphotos').unbind('click',UploadPhotos.showDialog); });

/** * * Custom preload templates for the new Wikia editor * * @author Grunny * @version 0.0.1 * */

function customPreloadTemplates {

if( wgAction !== 'edit' || !$( 'div.module_content' ).length ) { return; }

var	preloadOptionsHtml = '', $preloadOptionsList;

$( 'div.module_content:first' ).append( ' Standard preloads: ' );

$.get( wgScript, { title: 'Template:Stdpreloads', action: 'raw', ctype: 'text/plain' }, function( data ) {		var lines = data.split( '\n' );		for( var i in lines ) {			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 ); } );

} $( customPreloadTemplates ); /* */