MediaWiki:Wikia.js/preload.js

/* Template Preloads by User:Grunny Source - w:c:starwars:MediaWiki:Wikia.js  import into Wikia.js */ function customPreloadTemplates { if ( ( mw.config.get( 'wgAction' ) !== 'edit' && mw.config.get( 'wgCanonicalSpecialPageName' ) !== 'CreatePage' ) || !$( 'div.module_content' ).length ) { return; }	var	preloadOptionsHtml = '', $preloadOptionsList, preloadBaseHtml = ' Standard preloads: ' +			' Custom preload pagename: ';	$( 'div.module_content:first' ).append( preloadBaseHtml ); $.get( mw.config.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( mw.config.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( mw.config.get( 'wgScript' ), { title: value, action: 'raw', ctype: 'text/plain' }, function( data ) {		insertAtCursor( document.getElementById( 'wpTextbox1' ), data );	} ); }