MediaWiki:Common.js

/* */ /* Recent Changes Auto Refresh */ importScriptPage( 'AjaxRC/code.js', 'dev' );

/* Include Global Anime-Common.js Information */ importScriptURI('http://anime.wikia.com/index.php?title=MediaWiki:Anime-Common.js&action=raw&ctype=text/javascript&dontcountme=s&smaxage=86400&templates=expand');

/* Resolves conflict between icons and page header bottom border * by: User:The 888th Avatar */

$(document).ready(function {   if (skin == "oasis" || skin == "wikia") {        $('.WikiaPageHeader').append($('#icons'));    } });

/* Substitute Template:Fair use rationale into upload page. BEGINNING: JavaScript for placing the fair use rationale template inside the summary box on Special:Upload. Code by "wikipedia:User:Pinky49", created and coded specifically for Duty & Valour. */ function FairUseRationale { if((wgPageName == 'Special:Upload') && document.getElementById('wpDestFile').value == '') { document.getElementById('wpUploadDescription').value = ''; } } addOnloadHook(FairUseRationale); // ****** END: JavaScript for Special:Upload ******

/** * jQuery version of fillPreloads * @author Grunny */ 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 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 );				} ); }		} );		$( '#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); } /** * Inserts text at the cursor's current position * Originally from Wookieepedia */ function insertAtCursor( myField, myValue ) { //IE support if ( document.selection ) { myField.focus; sel = document.selection.createRange; sel.text = myValue; }	//MOZILLA/NETSCAPE support else if( myField.selectionStart || myField.selectionStart == '0' ) { var startPos = myField.selectionStart; var endPos = myField.selectionEnd; myField.value = myField.value.substring(0, startPos) + myValue + myField.value.substring(endPos, myField.value.length); } else { myField.value += myValue; } }

/* Ability to change full page title * See w:c:dev:DISPLAYTITLE for info and attribution */ $(function {	var newPageTitle = getElementsByClassName(document, 'span', 'changePageTitle')[0]; // Find the span with the new title	if(newPageTitle == null) return; // If not found exit	var oldPageTitle = getElementsByClassName(document, 'header', 'WikiaPageHeader')[0].getElementsByTagName( "h1" )[0]; //Find the page's title	if(oldPageTitle == null) return; // If not found exit	oldPageTitle.innerHTML = newPageTitle.innerHTML; // Set the title });

//edit buttons if (mwCustomEditButtons) { mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://images4.wikia.nocookie.net/__cb20100821183407/bleach/en/images/d/db/U_Accent_Button.png", "speedTip": "Add the ū character", "tagOpen": "ū", "tagClose": "", "sampleText": ""}; mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://images2.wikia.nocookie.net/inuyasha/images/e/e6/O-macron.png", "speedTip": "Add the ō character", "tagOpen": "ō", "tagClose": "", "sampleText": ""}; mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://images.wikia.com/central/images/1/16/Button_reflink_alternate.png", "speedTip": "Add a reference", "tagOpen": " ", "sampleText": "Source goes here"}; mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://images2.wikia.nocookie.net/central/images/f/f2/Ref_name_button.png", "speedTip": "Cite a named source", "tagOpen": " ", "sampleText": "chapter#"}; mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://images3.wikia.nocookie.net/central/images/e/e9/Episode_reference_button.png", "speedTip": "Add an episode reference", "tagOpen": " ", "sampleText": "series#"}; mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://images4.wikia.nocookie.net/inuyasha/images/4/4d/Movie_reference_button.png", "speedTip": "Add a movie reference", "tagOpen": " ", "sampleText": "Movie#"}; mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://images.wikia.com/central/images/7/74/Button_comment.png", "speedTip": "Comment visible only for editors", "tagOpen": "", "sampleText": "Insert comment here"}; }

/* */