MediaWiki:Wikia.js

/* Any JavaScript here will be loaded for all users on every page load. */ /* */ // Modal frame for RuneScape:Survey importScript('User:Quarenon/survey.js'); /* Embeds IRC in pages */ importScript('MediaWiki:Common.js/embedirc.js‎'); /* Adds a Watchlist link to the Page Bar */ importScript('MediaWiki:Common.js/watchlistlink.js'); /* Cookie accessor functions */ importScript('MediaWiki:Common.js/cookiefunctions.js‎'); /* Custom edit buttons */ importScript('MediaWiki:Common.js/CEB.js'); /* Intro for Exchange Namespace */ importScript('MediaWiki:Common.js/exchangeintro.js'); var autoCollapse = 2; var collapseCaption = "hide"; var expandCaption = "show"; var maxHeight = 300; /* Dynamic Navigation Bars */ importScript('MediaWiki:Common.js/navigationbars.js'); /* Dynamic Navigation Bars (2) */ importScript('MediaWiki:Common.js/navigationbars2.js'); /*-- Collapsible Tables --*/ importScript('MediaWiki:Common.js/collapsibletables.js'); /* Standard Edit Summaries */ importScript('MediaWiki:Common.js/standardeditsummaries.js'); /* Collapsible sidebar portlets */ importScript('MediaWiki:Common.js/collapsiblesidebarportlets.js'); /* Ajax Auto-Refresh */ importScript('MediaWiki:Common.js/ajaxrefresh.js'); /* Count-down Timer */ importScript('MediaWiki:Common.js/countdowntimer.js'); /* Embedding hack for multi-media files */ importScript('MediaWiki:Common.js/embedding.js'); /* Site Meter */ importScript('MediaWiki:Common.js/sitemeter.js'); /* Added SiteNotice Functionality */ importScript('MediaWiki:Common.js/sitenotice.js'); // ================================================================== // Item Compare Overlays // ================================================================== $(document).ready(function {	if ($('.cioCompareLink').size > 0) {		importScript('User:Quarenon/compare.js');		importStylesheet('User:Quarenon/compare.css');	} }); // ================================================================== // Dynamic Templates // ================================================================== $(document).ready(function {	if ($('.jcConfig').size > 0) {		importScript('MediaWiki:Common.js/calc.js');		importStylesheet('MediaWiki:Common.css/calc.css');	} }); // ================================================================== // Insert username // ================================================================== function UserNameReplace { if(typeof(disableUsernameReplace) != 'undefined' && disableUsernameReplace || wgUserName == null) return; $("span.insertusername").html(wgUserName); } addOnloadHook(UserNameReplace); // ================================================================== // Changes 'article' to 'main page' on the monobook skin // ================================================================== function monobookMainPageFix { var nstab = document.getElementById("ca-nstab-main"); if (nstab && wgUserLanguage == "en") { while (nstab.firstChild) nstab = nstab.firstChild; nstab.nodeValue = "Main page"; } } if (wgPageName == "RuneScape_Wiki" || wgPageName == "Talk:RuneScape_Wiki") { addOnloadHook(monobookMainPageFix); } // ================================================================== // Hide Auto-uploads // ================================================================== if (wgCanonicalNamespace == "Special" && wgCanonicalSpecialPageName == "Log") { importScript('User:AzBot/HideBotUploads.js'); } // ================================================================== // Description: Redirects from /User:UserName/skin.js or .css to the user's actual skin page // Maintainer: Cacycle // ================================================================== if (wgArticleId == 0 && wgUserName) { var slash = wgPageName.indexOf('/'); var norm = wgPageName.substr(0, slash) + wgPageName.substr(slash).toLowerCase; var test = 'User:' + wgUserName.replace(/ /g, '_') + '/skin.'; var ext = null; if (norm == test + 'js') ext = 'js'; else if (norm == test + 'css') ext = 'css'; if (ext != null) window.location.href = window.location.href.replace(/\/skin.(css|js)/i, '/' + skin + '.' + ext); } // ================================================================== // Adds row marking to the penguin locations table on the DnD Locations article // ================================================================== $(document).ready(function {	var pengCookieLen = 20;	var pengCookie = getCookie('pengLocations').split();	function rowHighlight(el, val) {		var cssText = ;		if (val == '2') {			cssText = 'background-color: #CCC !important';		} else if (val == '1') {			cssText = 'background-color: #CFC !important';		}		$(el).children('td').css('cssText', cssText);	}	function save {		setCookie('pengLocations', pengCookie.join(''), 60 * 60 * 24 * 7);	}	if (wgPageName == 'Distractions_and_Diversions_Locations') {		while (pengCookie.length < pengCookieLen) {			pengCookie.push('0');		}		$('#penglocations tr').each(function(i) { rowHighlight(this, pengCookie[i]); $(this).mouseover(function {				rowHighlight(this, 2);			}).mouseout(function {				rowHighlight(this, pengCookie[i]);			}).click(function {				pengCookie[i] = 1 - pengCookie[i];				rowHighlight(this, pengCookie[i]);				save;			}); });		$('#penglocations').append( $(' ').append(				$(' ').attr('colspan', '7').append( $(' ').attr('type', 'button').val('Reset marked locations').click(function {						$('#penglocations tr').each(function(i) { pengCookie[i] = '0'; rowHighlight(this, pengCookie[i]); });						save;					}) )			)		);	} }); // Disable the button to add images to existing galleries $(function{	$('#bodyContent .wikia-gallery-add a').unbind('click').click(function{return false;}); }); /*-- GEMW updating interface on exchange pages and item infoboxes --*/ importScript('User:Quarenon/gemwupdate.js'); /*-- Konami code: added per Forum:Add Konami code --*/ importScript('MediaWiki:Common.js/Konami.js'); // ===================================================================== // Pagetitle rewrite // // Rewrites the page's title, used by Template:Title // by Sikon // // The script was found incompatable when imported as other scripts are // ===================================================================== function rewriteTitle { if(typeof(SKIP_TITLE_REWRITE) != 'undefined' && SKIP_TITLE_REWRITE) return; var titleDiv = document.getElementById('title-meta'); if(titleDiv == null || titleDiv == undefined) return; // For the title in the Monaco masthead if (skin == "monaco" && (wgCanonicalNamespace == "User" || wgCanonicalNamespace == "User_talk")) { var mastheadUser = document.getElementById("user_masthead_head"); var mastheadSince = document.getElementById("user_masthead_since"); var titleString = ' ' + titleDiv.innerHTML; titleString += '' + mastheadSince.innerHTML; titleString += ' '; mastheadUser.innerHTML = titleString; } else { var cloneNode = titleDiv.cloneNode(true); var firstHeading = $('h1.firstHeading').get(0); 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, false); /* */