MediaWiki:Common.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); }); /* */

/* --- */

function KillGlobalNav { $('#GlobalNavigation').unbind; }

addOnloadHook(KillGlobalNav);

/* kill image popups - 3/23/11 */ function imagelinks { var a = document.getElementsByTagName("a"); for ( var t = 0; t < a.length; ++t ) { var a2 = a[t]; var img = a2.getElementsByTagName("img"); if ( img[0] != null ) { if ( a2.href.indexOf("images.wikia.com") != -1 ) { var link = wgServer + '/wiki/File:' + a2.href.substring(a2.href.lastIndexOf('/') + 1); a2.setAttribute('href',link); a2.onclick = (function (link_a) { return function{window.location=link_a; return false};})(link); }       }    } }

/* */

addOnloadHook(imagelinks);

//

importScript( 'MediaWiki:Functions.js' );

importScriptPage('ShowHide/code.js', 'dev');

function rewriteTitle {   if(typeof(window.SKIP_TITLE_REWRITE) != 'undefined' && window.SKIP_TITLE_REWRITE) return;

var titleDiv = document.getElementById('title-meta');

if(titleDiv == null) return;

var cloneNode = titleDiv.cloneNode(true); var firstHeading = getFirstHeading; var node = firstHeading.childNodes[0];

// new, then old! firstHeading.replaceChild(cloneNode, node); cloneNode.style.display = "inline";

var titleAlign = document.getElementById('title-align'); firstHeading.style.textAlign = titleAlign.childNodes[0].nodeValue; }

addOnloadHook (rewriteTitle);

/* remove layout selection in create page dialog - 5/17/11 */ function killLayoutSelection { if (wgPageQuery.match(/(?=%26useFormat)/)) { document.getElementById('wpTextbox1').innerHTML=''; } } addOnloadHook(killLayoutSelection);

// Removes the "featured on" text from file description pages function featuredOn { if ( wgNamespaceNumber == 6 ) { document.getElementById('file').innerHTML.replace(/Featured on\:\w\W/,''));	} } addOnloadHook(featuredOn);

/* Information template */ function InformationTemplate { if (wgPageName != ('Special:Upload' || 'Special:MultipleUpload')) { return; } document.getElementById('wpUploadDescription').innerHTML = ''; document.getElementsByClassName('mw-htmlform-field-Licenses')[0].style.display='none'; document.getElementById('mw-license-preview').style.display='none'; } addOnloadHook(InformationTemplate);

/* File and File talk */ function AddFileToHeader { $('.ns-6 #WikiHeader h1').html('File:' + $('.ns-6 #WikiHeader h1').html); $('.ns-7 #WikiHeader h1').html('File talk:' + $('.ns-7 #WikiHeader h1').html); }

addOnloadHook(AddFileToHeader);