User:Commander Bsyew/global.js

/************* Common stuff *************/ /* APIQuery, B3, wham, chat hacks */ importScriptPage('MediaWiki:APIQuery.js', 'monchbox'); //importScriptPage('MediaWiki:B3.js', 'monchbox'); importScriptURI('http://monchbox.wikia.com/index.php?title=MediaWiki:Torus.js/dev.js&action=raw&ctype=text/javascript&templates=expand&t=' + (new Date).getTime); importScriptPage('MediaWiki:WhamAPI.js', 'monchbox'); if(readCookie('globalJS') == 'true') {importScriptPage('AjaxRC/code.js', 'dev');} /* cookie init */ function CheckCookie { if(readCookie('globalJS') == null) { createCookie('globalJS', 'true', 99999); }	if(skin == 'oasis') {$('#AccountNavigation').prepend(' JS ');} } addOnloadHook(CheckCookie); function ToggleGlobalJSCookie { if(readCookie('globalJS') == 'true') { createCookie('globalJS', 'false', 99999); $('#GlobalJSText').html('Off'); }	else { createCookie('globalJS', 'true', 99999); $('#GlobalJSText').html('On'); }	window.location.reload(true); } /* Cookie functions */ //From quirksmode.org (http://www.quirksmode.org/js/cookies.html) function createCookie(name,value,days) { if (days) { var date = new Date; date.setTime(date.getTime+(days*24*60*60*1000)); var expires = "; expires="+date.toGMTString; }	else var expires = ""; document.cookie = name+"="+value+expires+"; path=/"; } function readCookie(name) { var nameEQ = name + "="; var ca = document.cookie.split(';'); for(var i=0;i < ca.length;i++) { var c = ca[i]; while (c.charAt(0)==' ') c = c.substring(1,c.length); if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length); }	return null; } function eraseCookie(name) { createCookie(name,"",-1); } /* URL parser */ function urlQuery(quer) { for(var i in location.href.split('?')) { for(j in location.href.split('?')[i].split('&')) { if(location.href.split('?')[i].split('&')[j].split('=')[0] == quer) { return location.href.split('?')[i].split('&')[j].split('=')[1]; }		}	}	return ''; } function KillMessageWall { if(wgPageName != 'User:' + wgUserName + '/talk' && wgPageName != 'User:' + wgUserName + '/Talk') { //check if someone edited your /talk or /Talk page var api = new APIQuery({logger: function {}}); api.newQuery('GET', {action: 'query', prop: 'info', titles: 'User:' + wgUserName + '/talk|User:' + wgUserName + '/Talk'}, function(result) {			var pages = result.query.pages;			for(var i in pages) {				if(i > 0 && pages[i].lastrevid > readCookie('msgwl_' + pages[i].title.substring(pages[i].title.lastIndexOf('/') + 1))) {					var sub = pages[i].title.substring(pages[i].title.lastIndexOf('/') + 1);					if(skin == 'oasis') {						document.getElementById('WikiaFooter').getElementsByTagName('ul')[0].outerHTML += ' You have new messages. ';					}					else {						document.getElementById('contentSub').outerHTML += ' You have new messages (show most recent</a>). ';					}				}			}		});		api.send(0);	}	else {createCookie('msgwl_' + wgPageName.substring(wgPageName.lastIndexOf('/') + 1), wgCurRevisionId, 99999);} } if(readCookie('globalJS') == 'true') {addOnloadHook(KillMessageWall);} function AnonIP {	var list = document.getElementsByTagName('a');	for(var i in list) {		if(list[i].href && list[i].href.indexOf('Special:Contributions/') && list[i].innerHTML == 'A Wikia contributor') {			list[i].innerHTML = list[i].href.substring(list[i].href.lastIndexOf('/') + 1, list[i].href.length);		}	} } if(readCookie('globalJS') == 'true') {addOnloadHook(AnonIP);} function UnusedFiles {	$('.gallerytext a').each(function { $(this).html($(this).attr('title')); }); } if(readCookie('globalJS') == 'true') {addOnloadHook(UnusedFiles);} /* Rollback with Ajax - stolen from Grunny */ function SetAjaxRollback {	$('a.mw-rollback-link').click(function(e) { e.preventDefault; var $rblink = $(this); var href = this.getElementsByTagName('a')[0].href; this.innerHTML = ' <img src="http://images2.wikia.nocookie.net/dev/images/8/82/Facebook_throbber.gif" style="vertical-align: baseline;" border="0" alt="Rollbacking..." />';		$.ajax({			url: href,			success: function {				$rblink.text(function (i, val) {return val + ' [success]';});				loadPageData;			},			error: function {				$rblink.text(function (i, val) {return val + ' [failed]';});				loadPageData;			}		}); }); } if(readCookie('globalJS') == 'true') {addOnloadHook(SetAjaxRollback);} /* add clock to buttons - function is called by RedefineButtons */ //Modified from work by Patrick Westerhoff [poke]: //http://bulbapedia.bulbagarden.net/wiki/MediaWiki:Monobook.js //Further modified by Monchoman45 to play nicely with the rest of my interface function displayTimer {	if(typeof(timerDisplay) !== 'undefined' && timerDisplay === false) {return;}	var date;	if(skin == 'oasis') {var timerParent = document.getElementById('WikiHeader').getElementsByTagName('div')[0];} 	else {var timerParent = document.getElementById('p-personal').getElementsByTagName('ul')[0];}	var timerLink = document.createElement('a');	var timerObj = document.createElement('li');	var timerDiv = document.createElement('div');	timerLink.href = '/index.php?title=' + wgPageName + '&action=purge';	timerLink.title = 'Purge';	timerLink.style.margin = '0'; timerLink.style.padding = '0 5px 0 5px'; timerObj.id = 'displayTimer'; timerObj.style.textTransform = 'none'; timerObj.style.fontWeight = 'bold'; timerObj.style.fontSize = '100%'; timerDiv.id = 'middlerow'; timerDiv.style.float = 'right'; timerDiv.style.margin = '0 0 2px 0'; timerObj.appendChild(timerLink); timerDiv.appendChild(timerObj); timerParent.insertBefore(timerDiv, timerParent.lastChild); var month = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']; function actualizeUTC { timerDate = new Date; timerLink.innerHTML = (timerDate.getUTCDate < 10 ? '0' : ) + timerDate.getUTCDate + ' ' + (timerDate.getUTCMonth < 10 ?  : ) + month[timerDate.getUTCMonth] + ' ' + (timerDate.getUTCFullYear < 10 ? '0' : ) + timerDate.getUTCFullYear + ' ' + (timerDate.getUTCHours < 10 ? '0' : ) + timerDate.getUTCHours   + ':' + (timerDate.getUTCMinutes < 10 ? '0' : ) + timerDate.getUTCMinutes  + ':' + (timerDate.getUTCSeconds < 10 ? '0' : '') + timerDate.getUTCSeconds  + ' (UTC)'; }	function actualizeCustom { timerDate = new Date; timerDate.setMinutes(timerDate.getMinutes + timerDate.getTimezoneOffset + timerTimezone * 60); timerLink.innerHTML = (timerDate.getDate < 10 ? '0' : ) + timerDate.getDate + ' ' + (timerDate.getMonth < 10 ?  : ) + month[timerDate.getMonth] + ' ' + (timerDate.getFullYear < 10 ? '0' : ) + timerDate.getFullYear + ' ' + ( timerDate.getHours < 10 ? '0' : ) + timerDate.getHours + ':' + (timerDate.getMinutes < 10 ? '0' : ) + timerDate.getMinutes + ':' + (timerDate.getSeconds < 10 ? '0' : '') + timerDate.getSeconds + ' (UTC' + (timerTimezone < 0 ? '' : '+') + timerTimezone + ')'; }	// start if(typeof(timerTimezone) !== 'number') { actualizeUTC; setInterval(actualizeUTC, 1000); }	else { actualizeCustom; setInterval(actualizeCustom, 1000); } } if(readCookie('globalJS') == 'true' && skin != 'oasis') {addOnloadHook(displayTimer);} /************* Oasis stuff *************/ /* EXPERIMENTAL - Portal */ if(skin == 'oasis') { importScriptURI('http://portalskin.wikia.com/index.php?title=User:Monchoman45/DevMode.js&action=raw&ctype=text/javascript'); importScriptURI('http://portalskin.wikia.com/index.php?title=MediaWiki:PortalEnable.js&action=raw&ctype=text/javascript'); ppDisplayConsole = true; ppAjaxEnable = true; ppAjaxCallAgain = [CustomRollbacks, SetAjaxRollback/*, AddQuickblockLinks*/]; } /* change publish to save and rename to move */ function PublishToSave { $('#wpSave').val('Save changes'); $('a[data-id="move"]').html('Move'); } if(readCookie('globalJS') == 'true' && skin == 'oasis') {addOnloadHook(PublishToSave);} /* rewrite the whole div.buttons element */ function RedefineButtons { $('#WikiHeader').css({"min-height": '72px'}); //make header always tall enough to fit buttons $('#WikiHeader .buttons').replaceWith(' <a style="margin:0 3px 2px 0" href="/index.php?title='+ wgPageName +'&useskin=monobook" title="Change to Monobook" class="wikia-button secondary" id="skinChangeButton" data-id="monobookbutton">Monobook</a><a style="margin:0 0 2px 0" href="/index.php?title='+ wgPageName +'&useskin=vector" title="Change to Vector" class="wikia-button secondary" id="skinChangeButton" data-id="vectorbutton">Vector</a> <a href="/wiki/Special:Random" title="Special:Random" accesskey="x" class="wikia-button secondary" data-id="randompage"><img src="http://images1.wikia.nocookie.net/__cb32673/common/skins/common/blank.gif" height="0" width="0" class="sprite random">Random Page</a><a href="/wiki/Special:WikiActivity" title="Special:WikiActivity" accesskey="g" class="wikia-button secondary" data-id="wikiactivity"><img src="http://images1.wikia.nocookie.net/__cb32673/common/skins/common/blank.gif" height="0" width="0" class="sprite activity">Wiki Activity</a>  '); displayTimer; } //if(readCookie('globalJS') == 'true' && skin == 'oasis') {addOnloadHook(RedefineButtons);} /* redo links on user nav to be more useful */ function RedefineUserNav { $('.AccountNavigation .subnav li:first-child').replaceWith('<a href="/wiki/User_talk:'+ wgUserName +'">Talk</a></li><a href="/wiki/Special:Contributions/'+ wgUserName +'">Contributions</a></li>'); $('.AccountNavigation .subnav li a[href="/wiki/Special:Preferences"]').replaceWith('<a href="/wiki/Special:Preferences">Preferences</a></li>'); $('.AccountNavigation .subnav li a[href="/wiki/Special:Following"]').replaceWith('<a href="/index.php?title=User:'+ wgUserName +'/Sandbox&action=edit">Sandbox</a></li>'); $('.AccountNavigation .subnav li a[href="/wiki/Help:Contents"]').replaceWith('<a href="http://community.wikia.com/wiki/Forum:Index">Central Forum</a></li><a href="http://community.wikia.com/wiki/User:'+ wgUserName +'/global.js">global.js</a></li><a href="http://community.wikia.com/wiki/User:'+ wgUserName +'/global.css">global.css</a></li>'); $('.AccountNavigation .subnav').css({'width': "133px"}); } if(readCookie('globalJS') == 'true' && skin == 'oasis') {addOnloadHook(RedefineUserNav);} /* kill image popups */ window.wgEnableImageLightboxExt = false; function changeimagelinks { $('#WikiaArticle, .LatestPhotosModule, #article-comments').unbind('click.lightbox'); 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 && a2.href.indexOf('images.wikia.com') != -1) { var link = wgServer + '/wiki/File:' + a2.href.substring(a2.href.lastIndexOf('/') + 1); a2.setAttribute('href',link); }	} } if(readCookie('globalJS') == 'true' && skin == 'oasis') {addOnloadHook(changeimagelinks);} /* shrink the side rail to add content space when rail is present */ /* only works with proper css - see User:Monchoman45/global.css */ /*function ShrinkRail { if( $('#WikiaMainContent').width < 1000 ) { $('#WikiaPageHeader details').css({"width": '750px'}); $('#WikiaMainContent').css({"width": '760px'}); $('#catlinks').css({"width": '718px'}); $('#WikiaRail').css({"width": '220px'}); $('#WikiaSearch').css({"width": '218px'}); $('#WikiaSearch input[type="text"]').css({"width": '210px'}); $(#WikiaRail .upphotos').replaceWith('<a href="/wiki/Special:Upload" title="Add a Photo" class="wikia-button upphotos" style="width:30px; margin-top:0;"> <img src="http://images1.wikia.nocookie.net/__cb32790/common/skins/common/blank.gif" height="0" width="0" class="sprite photo" style="margin:0;"> </a>'); $('#WikiaRail .createpage').replaceWith('<a href="/wiki/Special:CreatePage" title="Create a new page on this wiki" class="wikia-button createpage" style="width:25px; margin-top:0;"> <img src="http://images1.wikia.nocookie.net/__cb32790/common/skins/common/blank.gif" height="0" width="0" class="sprite new" style="margin:0;"> </a>'); $('#WikiaRail a[href="/wiki/Special:CreateBlogPage"]').replaceWith('<a href="/wiki/Special:CreateBlogPage" title="Create blog post" class="wikia-button" style="width:25px"><img src="http://images1.wikia.nocookie.net/__cb32790/common/skins/common/blank.gif" height="0" width="0" class="sprite blog" style="margin-left:4px;"></a>'); } } if(readCookie('globalJS') == 'true' && skin == 'oasis') {addOnloadHook(ShrinkRail);}*/ function SideRailSubmenus { if($('#WikiaMainContent').width < 1000) { $('body').prepend('<style type="text/css">.rail-menu-tab-right {width:35px; height:25px; background-image:-moz-linear-gradient(top, white 35%, #F2F2F2 65%); background-image:-webkit-gradient(linear, 0% 0%, 0% 100%, color-stop(35%, white), color-stop(65%, #F2F2F2)); border:1px solid #ccc; float:right;} #WikiaRail {z-index:99999999999;} #WikiaRail div > section, #WikiaRail div > form {width:300px; -webkit-box-shadow:#ccc 0px 0px 2em 0.1em; box-shadow:#ccc 0px 0px 2em 0.1em;} '); $('#WikiaPageHeader details').css({"width": '980px'}); $('#WikiaMainContent').css({"width": '1000px'}); $('#catlinks').css({"width": '1000px'}); $('.article-comm-text').css({"width": 'auto'}); var topmargin = -32; $('#WikiaRail').css({"position": 'absolute', "margin-left": '727px', "margin-top": '80px'}); window.modulearr = []; for(var i = 0; i < document.getElementById('WikiaRail').children.length; i++) { window.modulearr.push(module = document.getElementById('WikiaRail').children[i]); }		for(var i in window.modulearr) { topmargin += 32; var module = window.modulearr[i]; //The module we're acting on			module.style.display = 'none !important'; var div = document.createElement('div'); div.style.cssText = 'margin-top:' + topmargin + 'px;'; div.innerHTML = ' '; module.parentNode.insertBefore(div, module); div.appendChild(module); //Start clock on mouseover, if the mouse doesn't move out in 3/10 second, show module //If the mouse moves out, clear timer. Nifty little setup module.parentNode.onmouseover = function(event) {window.modulepar = this; window.timemodule = setTimeout('ShowRailMenu', 300);} module.parentNode.onmouseout = function(event) {window.modulepar = undefined; clearTimeout(window.timemodule);} }		window.modulepar = window.modulearr[window.modulearr.length - 1]; HideRailMenu; } } if(readCookie('globalJS') == 'true' && skin == 'oasis') {addOnloadHook(SideRailSubmenus);} function ShowRailMenu { clearTimeout(window.timemodule); //Clear existing timeout to prevent confusion when moving from one module to another module for(var i in window.modulearr) { window.modulearr[i].style.display = 'none !important'; //Hide all other modules window.modulearr[i].parentNode.onmouseover = function(event) {window.modulepar = this; ShowRailMenu;} //No delay when changing from a module to another module }	window.modulepar.children[1].style.display = 'block'; //Start clock on mouseout, if the mouse doesn't move back in 4/10 second, hide module //If the mouse moves back, clear timer. Also a nifty setup window.modulepar.onmouseover = function(event) {window.modulepar = undefined; clearTimeout(window.timemodule);} window.modulepar.onmouseout = function(event) {window.modulepar = this; window.timemodule = setTimeout('HideRailMenu', 400);} } function HideRailMenu { window.modulepar.children[1].style.display = 'none !important'; //Same as the show above window.modulepar.onmouseover = function(event) {window.modulepar = this; window.timemodule = setTimeout('ShowRailMenu', 300);} window.modulepar.onmouseout = function(event) {window.modulepar = undefined; clearTimeout(window.timemodule);} } /************* Monobook stuff *************/ function UserLinks { //The "My" really annoys me. Must kill it	document.getElementById('pt-mytalk').getElementsByTagName('a')[0].innerHTML = 'Talk'; document.getElementById('pt-preferences').getElementsByTagName('a')[0].innerHTML = 'Preferences'; document.getElementById('pt-mycontris').getElementsByTagName('a')[0].innerHTML = 'Contribs'; $('#pt-mytalk').after($('#pt-mycontris').detach); $('#pt-watchlist').remove; $('#pt-preferences').after('<a href="http://community.wikia.com/wiki/User:Monchoman45/global.js" style="text-transform:lowercase;">global.js</a></li><a href="http://community.wikia.com/wiki/User:Monchoman45/global.css" style="text-transform:lowercase;">global.css</a></li>'); //This really should never have changed to rename if(document.getElementById('ca-move')){document.getElementById('ca-move').getElementsByTagName('a')[0].innerHTML = 'Move';} //And this really shouldn't have changed to publish if(document.getElementById('wpSave')) {document.getElementById('wpSave').value = 'Save page';} } if(readCookie('globalJS') == 'true' && skin != 'oasis') {addOnloadHook(UserLinks);} /* Skin change buttons and JS tab */ function ExtraTabs { $('#p-cactions .pBody ul li:nth-last-child(1)').after('<a href="/index.php?title='+ wgPageName +'&useskin=wikia" title="Change to Oasis [o]" id="skinChangeButton" accesskey="o">Oasis</a></li><a href="/index.php?title='+ wgPageName +'&useskin=vector" title="Change to Vector [v]" id="skinChangeButton" accesskey="o">Vector</a></li>'); } if(readCookie('globalJS') == 'true' && skin != 'oasis') {addOnloadHook(ExtraTabs);} /* Sidebar submenus */ function MonobookSubmenus { var ports = $('.generated-sidebar'); $('#p-search').before(' Wiki navigation </ul> '); var ul = document.getElementById('p-generated').getElementsByTagName('ul')[0]; for(var i = 0; i < ports.length; i++) { var links = ''; for(var j = 0; j < ports[i].getElementsByTagName('li').length; j++) { links += ports[i].getElementsByTagName('li')[j].outerHTML; }		ul.innerHTML += ' ' + ports[i].getElementsByTagName('h5')[0].innerHTML + ' &raquo; <ul class="sidebar-subnav" style="position:absolute; left:138px; margin-top:-22px; z-index:99999; background-color:#fff; border:1px solid #000; padding:3px 7px 3px 17px; display:none;">' + links + '</ul></li>'; }	ports.remove; document.getElementById('p-generated').className = 'generated-sidebar portlet'; //set here to avoid class list loop } if(readCookie('globalJS') == 'true' && skin != 'oasis') {addOnloadHook(MonobookSubmenus);} function ShowMBMenu { clearTimeout(window.sidebartime); //Clear existing timeout to prevent confusion when moving from one module to another module var uls = $('.sidebar-subnav'); for(var i = 0; i < uls.length; i++) { uls[i].style.display = 'none'; //Hide all other modules uls[i].parentNode.onmouseover = function(event) {window.sidebarpar = this; ShowMBMenu;} }	window.sidebarpar.getElementsByTagName('ul')[0].style.display = 'block'; window.sidebarpar.onmouseover = function(event) {window.sidebarpar = undefined; clearTimeout(window.sidebartime);} window.sidebarpar.onmouseout = function(event) {window.sidebarpar = this; window.sidebartime = setTimeout('HideMBMenu', 400);} } function HideMBMenu { window.sidebarpar.getElementsByTagName('ul')[0].style.display = 'none'; window.sidebarpar.onmouseover = function(event) {window.sidebarpar = this; window.sidebartime = setTimeout('ShowMBMenu', 300);} window.sidebarpar.onmouseout = function(event) {window.sibebarpar = undefined; clearTimeout(window.sidebartime);} } function ExtraPortlets { $('#p-search').before(' Tools  <a href="/wiki/Special:RecentChanges">Recent changes</a> &raquo; <ul class="sidebar-subnav" style="position:absolute; left:138px; margin-top:-22px; z-index:99999; background-color:#fff; border:1px solid #000; padding:3px 7px 3px 17px; display:none;"><a href="/wiki/Special:Log">Log</a></li><li><a href="/wiki/Special:NewPages">New pages</a></li><li><a href="/wiki/Special:NewFiles">New files</a></li></ul></li><li onmouseover="window.sidebarpar = this; window.sidebartime = setTimeout(\'ShowMBMenu\', 300);" onmouseout="window.sidebarpar = undefined; clearTimeout(window.sidebartime);"> <a href="/wiki/Special:CreatePage">Create page</a> &raquo;  <ul class="sidebar-subnav" style="position:absolute; left:138px; margin-top:-22px; z-index:99999; background-color:#fff; border:1px solid #000; padding:3px 7px 3px 17px; display:none;"><li><a href="/wiki/Special:Upload">Upload</a></li><li><a href="/wiki/Special:MultipleUpload">Multiple upload</a></li><li><a href="/wiki/Special:CreateBlogPage">Blog</a></li></ul></li><li onmouseover="window.sidebarpar = this; window.sidebartime = setTimeout(\'ShowMBMenu\', 300);" onmouseout="window.sidebarpar = undefined; clearTimeout(window.sidebartime);"> <a href="/wiki/Special:ListUsers">List</a> &raquo;  <ul class="sidebar-subnav" style="position:absolute; left:138px; margin-top:-22px; z-index:99999; background-color:#fff; border:1px solid #000; padding:3px 7px 3px 17px; display:none;"><li><a href="/wiki/Special:ListUsers/sysop">Admins</a></li><li><a href="/wiki/Special:ListUsers/bureaucrat">Bureaucrats</a></li><li><a href="/wiki/Special:ListUsers/chatmoderator">Chat mods</a></li></ul></li><li><a href="/wiki/Special:SpecialPages">Special pages</a></li><li><a href="javascript:OpenChatWindow;">Chat</a></li></ul>  '); $('#p-logo').after($('#p-search').detach); } if(readCookie('globalJS') == 'true' && skin != 'oasis') {addOnloadHook(ExtraPortlets)}/************************************ stuff here goes on every wiki ************************************/ /*** Please note that functions on this page are heavily integrated with one another, and will not work by themselves. ***/ /*** Many of these are derivatives of publicly available fixes - see User blog:Monchoman45/Improving your interface with CSS/JS. ***/ /*** If you'd like to use something in here, ask me on my talk page and I'll gladly give you the function in a form that will work for you. ***/ /************* Common stuff *************/ /* APIQuery, B3, wham, chat hacks, other import crap */ importScriptPage('MediaWiki:APIQuery.js', 'monchbox'); //importScriptPage('MediaWiki:B3.js', 'monchbox'); importScriptURI('http://monchbox.wikia.com/index.php?title=MediaWiki:Torus.js/dev.js&action=raw&ctype=text/javascript&templates=expand&t=' + (new Date).getTime); importScriptPage('MediaWiki:WhamAPI.js', 'monchbox'); importScriptPage('User:Monchoman45/ChatHacks.js', 'c'); if(readCookie('globalJS') == 'true') {importScriptPage('AjaxRC/code.js', 'dev');} /* cookie init */ function CheckCookie { if(readCookie('globalJS') == null) { createCookie('globalJS', 'true', 99999); }	if(skin == 'oasis') {$('#AccountNavigation').prepend('<li><a onclick="ToggleGlobalJSCookie" style="cursor:pointer; cursor:hand;"><img src="http://images3.wikia.nocookie.net/portalskin/images/2/20/Refresh_Icon.gif" style="margin-bottom:-4px;"> JS </a></li>');} } addOnloadHook(CheckCookie); function ToggleGlobalJSCookie { if(readCookie('globalJS') == 'true') { createCookie('globalJS', 'false', 99999); $('#GlobalJSText').html('Off'); }	else { createCookie('globalJS', 'true', 99999); $('#GlobalJSText').html('On'); }	window.location.reload(true); } /* Cookie functions */ //From quirksmode.org (http://www.quirksmode.org/js/cookies.html) function createCookie(name,value,days) { if (days) { var date = new Date; date.setTime(date.getTime+(days*24*60*60*1000)); var expires = "; expires="+date.toGMTString; }	else var expires = ""; document.cookie = name+"="+value+expires+"; path=/"; } function readCookie(name) { var nameEQ = name + "="; var ca = document.cookie.split(';'); for(var i=0;i < ca.length;i++) { var c = ca[i]; while (c.charAt(0)==' ') c = c.substring(1,c.length); if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length); }	return null; } function eraseCookie(name) { createCookie(name,"",-1); } /* URL parser */ function urlQuery(quer) { for(var i in location.href.split('?')) { for(j in location.href.split('?')[i].split('&')) { if(location.href.split('?')[i].split('&')[j].split('=')[0] == quer) { return location.href.split('?')[i].split('&')[j].split('=')[1]; }		}	}	return ''; } function KillMessageWall { if(wgPageName != 'User:' + wgUserName + '/talk' && wgPageName != 'User:' + wgUserName + '/Talk') { //check if someone edited your /talk or /Talk page var api = new APIQuery({logger: function {}}); api.newQuery('GET', {action: 'query', prop: 'info', titles: 'User:' + wgUserName + '/talk|User:' + wgUserName + '/Talk'}, function(result) {			var pages = result.query.pages;			for(var i in pages) {				if(i > 0 && pages[i].lastrevid > readCookie('msgwl_' + pages[i].title.substring(pages[i].title.lastIndexOf('/') + 1))) {					var sub = pages[i].title.substring(pages[i].title.lastIndexOf('/') + 1);					if(skin == 'oasis') {						document.getElementById('WikiaFooter').getElementsByTagName('ul')[0].outerHTML += '<ul id="WikiaNotifications" class="WikiaNotifications"><li> <a class="sprite close-notification"></a>You have <a href="/index.php?title=User:' + wgUserName + '/' + sub + '&redirect=no" title="User:' + wgUserName + '/' + sub + '">new messages</a>. </li></ul>';					}					else {						document.getElementById('contentSub').outerHTML += ' You have <a href="/index.php?title=User:' + wgUserName + '/' + sub + '&redirect=no" title="User:' + wgUserName + '/' + sub + '">new messages</a> (<a href="/index.php?title=User:' + wgUserName + '/' + sub + '&diff=cur" title="User:' + wgUserName + '/' + sub + '">show most recent</a>). ';					}				}			}		});		api.send(0);	}	else {createCookie('msgwl_' + wgPageName.substring(wgPageName.lastIndexOf('/') + 1), wgCurRevisionId, 99999);} } if(readCookie('globalJS') == 'true') {addOnloadHook(KillMessageWall);} function AnonIP {	var list = document.getElementsByTagName('a');	for(var i in list) {		if(list[i].href && list[i].href.indexOf('Special:Contributions/') && list[i].innerHTML == 'A Wikia contributor') {			list[i].innerHTML = list[i].href.substring(list[i].href.lastIndexOf('/') + 1, list[i].href.length);		}	} } if(readCookie('globalJS') == 'true') {addOnloadHook(AnonIP);} function UnusedFiles {	$('.gallerytext a').each(function { $(this).html($(this).attr('title')); }); } if(readCookie('globalJS') == 'true') {addOnloadHook(UnusedFiles);} /* Rollback with Ajax - stolen from Grunny */ function SetAjaxRollback {	$('a.mw-rollback-link').click(function(e) { e.preventDefault; var $rblink = $(this); var href = this.getElementsByTagName('a')[0].href; this.innerHTML = ' <img src="http://images2.wikia.nocookie.net/dev/images/8/82/Facebook_throbber.gif" style="vertical-align: baseline;" border="0" alt="Rollbacking..." />';		$.ajax({			url: href,			success: function {				$rblink.text(function (i, val) {return val + ' [success]';});				loadPageData;			},			error: function {				$rblink.text(function (i, val) {return val + ' [failed]';});				loadPageData;			}		}); }); } if(readCookie('globalJS') == 'true') {addOnloadHook(SetAjaxRollback);} /* add clock to buttons - function is called by RedefineButtons */ //Modified from work by Patrick Westerhoff [poke]: //http://bulbapedia.bulbagarden.net/wiki/MediaWiki:Monobook.js //Further modified by Monchoman45 to play nicely with the rest of my interface function displayTimer {	if(typeof(timerDisplay) !== 'undefined' && timerDisplay === false) {return;}	var date;	if(skin == 'oasis') {var timerParent = document.getElementById('WikiHeader').getElementsByTagName('div')[0];} 	else {var timerParent = document.getElementById('p-personal').getElementsByTagName('ul')[0];}	var timerLink = document.createElement('a');	var timerObj = document.createElement('li');	var timerDiv = document.createElement('div');	timerLink.href = '/index.php?title=' + wgPageName + '&action=purge';	timerLink.title = 'Purge';	timerLink.style.margin = '0'; timerLink.style.padding = '0 5px 0 5px'; timerObj.id = 'displayTimer'; timerObj.style.textTransform = 'none'; timerObj.style.fontWeight = 'bold'; timerObj.style.fontSize = '100%'; timerDiv.id = 'middlerow'; timerDiv.style.float = 'right'; timerDiv.style.margin = '0 0 2px 0'; timerObj.appendChild(timerLink); timerDiv.appendChild(timerObj); timerParent.insertBefore(timerDiv, timerParent.lastChild); var month = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']; function actualizeUTC { timerDate = new Date; timerLink.innerHTML = (timerDate.getUTCDate < 10 ? '0' : ) + timerDate.getUTCDate + ' ' + (timerDate.getUTCMonth < 10 ?  : ) + month[timerDate.getUTCMonth] + ' ' + (timerDate.getUTCFullYear < 10 ? '0' : ) + timerDate.getUTCFullYear + ' ' + (timerDate.getUTCHours < 10 ? '0' : ) + timerDate.getUTCHours   + ':' + (timerDate.getUTCMinutes < 10 ? '0' : ) + timerDate.getUTCMinutes  + ':' + (timerDate.getUTCSeconds < 10 ? '0' : '') + timerDate.getUTCSeconds  + ' (UTC)'; }	function actualizeCustom { timerDate = new Date; timerDate.setMinutes(timerDate.getMinutes + timerDate.getTimezoneOffset + timerTimezone * 60); timerLink.innerHTML = (timerDate.getDate < 10 ? '0' : ) + timerDate.getDate + ' ' + (timerDate.getMonth < 10 ?  : ) + month[timerDate.getMonth] + ' ' + (timerDate.getFullYear < 10 ? '0' : ) + timerDate.getFullYear + ' ' + ( timerDate.getHours < 10 ? '0' : ) + timerDate.getHours + ':' + (timerDate.getMinutes < 10 ? '0' : ) + timerDate.getMinutes + ':' + (timerDate.getSeconds < 10 ? '0' : '') + timerDate.getSeconds + ' (UTC' + (timerTimezone < 0 ? '' : '+') + timerTimezone + ')'; }	// start if(typeof(timerTimezone) !== 'number') { actualizeUTC; setInterval(actualizeUTC, 1000); }	else { actualizeCustom; setInterval(actualizeCustom, 1000); } } if(readCookie('globalJS') == 'true' && skin != 'oasis') {addOnloadHook(displayTimer);} /************* Oasis stuff *************/ /* EXPERIMENTAL - Portal */ if(skin == 'oasis') { importScriptURI('http://portalskin.wikia.com/index.php?title=User:Monchoman45/DevMode.js&action=raw&ctype=text/javascript'); importScriptURI('http://portalskin.wikia.com/index.php?title=MediaWiki:PortalEnable.js&action=raw&ctype=text/javascript'); ppDisplayConsole = true; ppAjaxEnable = true; ppAjaxCallAgain = [CustomRollbacks, SetAjaxRollback/*, AddQuickblockLinks*/]; } /* change publish to save and rename to move */ function PublishToSave { $('#wpSave').val('Save changes'); $('a[data-id="move"]').html('Move'); } if(readCookie('globalJS') == 'true' && skin == 'oasis') {addOnloadHook(PublishToSave);} /* rewrite the whole div.buttons element */ function RedefineButtons { $('#WikiHeader').css({"min-height": '72px'}); //make header always tall enough to fit buttons $('#WikiHeader .buttons').replaceWith(' <a style="margin:0 3px 2px 0" href="/index.php?title='+ wgPageName +'&useskin=monobook" title="Change to Monobook" class="wikia-button secondary" id="skinChangeButton" data-id="monobookbutton">Monobook</a><a style="margin:0 0 2px 0" href="/index.php?title='+ wgPageName +'&useskin=vector" title="Change to Vector" class="wikia-button secondary" id="skinChangeButton" data-id="vectorbutton">Vector</a> <a href="/wiki/Special:Random" title="Special:Random" accesskey="x" class="wikia-button secondary" data-id="randompage"><img src="http://images1.wikia.nocookie.net/__cb32673/common/skins/common/blank.gif" height="0" width="0" class="sprite random">Random Page</a><a href="/wiki/Special:WikiActivity" title="Special:WikiActivity" accesskey="g" class="wikia-button secondary" data-id="wikiactivity"><img src="http://images1.wikia.nocookie.net/__cb32673/common/skins/common/blank.gif" height="0" width="0" class="sprite activity">Wiki Activity</a>  '); displayTimer; } //if(readCookie('globalJS') == 'true' && skin == 'oasis') {addOnloadHook(RedefineButtons);} /* redo links on user nav to be more useful */ function RedefineUserNav { $('.AccountNavigation .subnav li:first-child').replaceWith('<li><a href="/wiki/User_talk:'+ wgUserName +'">Talk</a></li><li><a href="/wiki/Special:Contributions/'+ wgUserName +'">Contributions</a></li>'); $('.AccountNavigation .subnav li a[href="/wiki/Special:Preferences"]').replaceWith('<li><a href="/wiki/Special:Preferences">Preferences</a></li>'); $('.AccountNavigation .subnav li a[href="/wiki/Special:Following"]').replaceWith('<li><a href="/index.php?title=User:'+ wgUserName +'/Sandbox&action=edit">Sandbox</a></li>'); $('.AccountNavigation .subnav li a[href="/wiki/Help:Contents"]').replaceWith('<li><a href="http://community.wikia.com/wiki/Forum:Index">Central Forum</a></li><li><a href="http://community.wikia.com/wiki/User:'+ wgUserName +'/global.js">global.js</a></li><li><a href="http://community.wikia.com/wiki/User:'+ wgUserName +'/global.css">global.css</a></li>'); $('.AccountNavigation .subnav').css({'width': "133px"}); } if(readCookie('globalJS') == 'true' && skin == 'oasis') {addOnloadHook(RedefineUserNav);} /* kill image popups */ window.wgEnableImageLightboxExt = false; function changeimagelinks { $('#WikiaArticle, .LatestPhotosModule, #article-comments').unbind('click.lightbox'); 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 && a2.href.indexOf('images.wikia.com') != -1) { var link = wgServer + '/wiki/File:' + a2.href.substring(a2.href.lastIndexOf('/') + 1); a2.setAttribute('href',link); }	} } if(readCookie('globalJS') == 'true' && skin == 'oasis') {addOnloadHook(changeimagelinks);} /* shrink the side rail to add content space when rail is present */ /* only works with proper css - see User:Monchoman45/global.css */ /*function ShrinkRail { if( $('#WikiaMainContent').width < 1000 ) { $('#WikiaPageHeader details').css({"width": '750px'}); $('#WikiaMainContent').css({"width": '760px'}); $('#catlinks').css({"width": '718px'}); $('#WikiaRail').css({"width": '220px'}); $('#WikiaSearch').css({"width": '218px'}); $('#WikiaSearch input[type="text"]').css({"width": '210px'}); $(#WikiaRail .upphotos').replaceWith('<a href="/wiki/Special:Upload" title="Add a Photo" class="wikia-button upphotos" style="width:30px; margin-top:0;"> <img src="http://images1.wikia.nocookie.net/__cb32790/common/skins/common/blank.gif" height="0" width="0" class="sprite photo" style="margin:0;"> </a>'); $('#WikiaRail .createpage').replaceWith('<a href="/wiki/Special:CreatePage" title="Create a new page on this wiki" class="wikia-button createpage" style="width:25px; margin-top:0;"> <img src="http://images1.wikia.nocookie.net/__cb32790/common/skins/common/blank.gif" height="0" width="0" class="sprite new" style="margin:0;"> </a>'); $('#WikiaRail a[href="/wiki/Special:CreateBlogPage"]').replaceWith('<a href="/wiki/Special:CreateBlogPage" title="Create blog post" class="wikia-button" style="width:25px"><img src="http://images1.wikia.nocookie.net/__cb32790/common/skins/common/blank.gif" height="0" width="0" class="sprite blog" style="margin-left:4px;"></a>'); } } if(readCookie('globalJS') == 'true' && skin == 'oasis') {addOnloadHook(ShrinkRail);}*/ function SideRailSubmenus { if($('#WikiaMainContent').width < 1000) { $('body').prepend('<style type="text/css">.rail-menu-tab-right {width:35px; height:25px; background-image:-moz-linear-gradient(top, white 35%, #F2F2F2 65%); background-image:-webkit-gradient(linear, 0% 0%, 0% 100%, color-stop(35%, white), color-stop(65%, #F2F2F2)); border:1px solid #ccc; float:right;} #WikiaRail {z-index:99999999999;} #WikiaRail div > section, #WikiaRail div > form {width:300px; -webkit-box-shadow:#ccc 0px 0px 2em 0.1em; box-shadow:#ccc 0px 0px 2em 0.1em;} '); $('#WikiaPageHeader details').css({"width": '980px'}); $('#WikiaMainContent').css({"width": '1000px'}); $('#catlinks').css({"width": '1000px'}); $('.article-comm-text').css({"width": 'auto'}); var topmargin = -32; $('#WikiaRail').css({"position": 'absolute', "margin-left": '727px', "margin-top": '80px'}); window.modulearr = []; for(var i = 0; i < document.getElementById('WikiaRail').children.length; i++) { window.modulearr.push(module = document.getElementById('WikiaRail').children[i]); }		for(var i in window.modulearr) { topmargin += 32; var module = window.modulearr[i]; //The module we're acting on			module.style.display = 'none !important'; var div = document.createElement('div'); div.style.cssText = 'margin-top:' + topmargin + 'px;'; div.innerHTML = ' '; module.parentNode.insertBefore(div, module); div.appendChild(module); //Start clock on mouseover, if the mouse doesn't move out in 3/10 second, show module //If the mouse moves out, clear timer. Nifty little setup module.parentNode.onmouseover = function(event) {window.modulepar = this; window.timemodule = setTimeout('ShowRailMenu', 300);} module.parentNode.onmouseout = function(event) {window.modulepar = undefined; clearTimeout(window.timemodule);} }		window.modulepar = window.modulearr[window.modulearr.length - 1]; HideRailMenu; } } if(readCookie('globalJS') == 'true' && skin == 'oasis') {addOnloadHook(SideRailSubmenus);} function ShowRailMenu { clearTimeout(window.timemodule); //Clear existing timeout to prevent confusion when moving from one module to another module for(var i in window.modulearr) { window.modulearr[i].style.display = 'none !important'; //Hide all other modules window.modulearr[i].parentNode.onmouseover = function(event) {window.modulepar = this; ShowRailMenu;} //No delay when changing from a module to another module }	window.modulepar.children[1].style.display = 'block'; //Start clock on mouseout, if the mouse doesn't move back in 4/10 second, hide module //If the mouse moves back, clear timer. Also a nifty setup window.modulepar.onmouseover = function(event) {window.modulepar = undefined; clearTimeout(window.timemodule);} window.modulepar.onmouseout = function(event) {window.modulepar = this; window.timemodule = setTimeout('HideRailMenu', 400);} } function HideRailMenu { window.modulepar.children[1].style.display = 'none !important'; //Same as the show above window.modulepar.onmouseover = function(event) {window.modulepar = this; window.timemodule = setTimeout('ShowRailMenu', 300);} window.modulepar.onmouseout = function(event) {window.modulepar = undefined; clearTimeout(window.timemodule);} } /************* Monobook stuff *************/ function UserLinks { //The "My" really annoys me. Must kill it	document.getElementById('pt-mytalk').getElementsByTagName('a')[0].innerHTML = 'Talk'; document.getElementById('pt-preferences').getElementsByTagName('a')[0].innerHTML = 'Preferences'; document.getElementById('pt-mycontris').getElementsByTagName('a')[0].innerHTML = 'Contribs'; $('#pt-mytalk').after($('#pt-mycontris').detach); $('#pt-watchlist').remove; $('#pt-preferences').after('<li id="pt-globaljs"><a href="http://community.wikia.com/wiki/User:Monchoman45/global.js" style="text-transform:lowercase;">global.js</a></li><li><a href="http://community.wikia.com/wiki/User:Monchoman45/global.css" style="text-transform:lowercase;">global.css</a></li>'); //This really should never have changed to rename if(document.getElementById('ca-move')){document.getElementById('ca-move').getElementsByTagName('a')[0].innerHTML = 'Move';} //And this really shouldn't have changed to publish if(document.getElementById('wpSave')) {document.getElementById('wpSave').value = 'Save page';} } if(readCookie('globalJS') == 'true' && skin != 'oasis') {addOnloadHook(UserLinks);} /* Skin change buttons and JS tab */ function ExtraTabs { $('#p-cactions .pBody ul li:nth-last-child(1)').after('<li id="ca-oasis" style="margin:0 3px 0 36px"><a href="/index.php?title='+ wgPageName +'&useskin=wikia" title="Change to Oasis [o]" id="skinChangeButton" accesskey="o">Oasis</a></li><li id="ca-monobook"><a href="/index.php?title='+ wgPageName +'&useskin=vector" title="Change to Vector [v]" id="skinChangeButton" accesskey="o">Vector</a></li>'); } if(readCookie('globalJS') == 'true' && skin != 'oasis') {addOnloadHook(ExtraTabs);} /* Sidebar submenus */ function MonobookSubmenus { var ports = $('.generated-sidebar'); $('#p-search').before(' Wiki navigation <ul></ul> '); var ul = document.getElementById('p-generated').getElementsByTagName('ul')[0]; for(var i = 0; i < ports.length; i++) { var links = ''; for(var j = 0; j < ports[i].getElementsByTagName('li').length; j++) { links += ports[i].getElementsByTagName('li')[j].outerHTML; }		ul.innerHTML += '<li onmouseover="window.sidebarpar = this; window.sidebartime = setTimeout(\'ShowMBMenu\', 300);" onmouseout="window.sidebarpar = undefined; clearTimeout(window.sidebartime);"> ' + ports[i].getElementsByTagName('h5')[0].innerHTML + ' &raquo; <ul class="sidebar-subnav" style="position:absolute; left:138px; margin-top:-22px; z-index:99999; background-color:#fff; border:1px solid #000; padding:3px 7px 3px 17px; display:none;">' + links + '</ul></li>'; }	ports.remove; document.getElementById('p-generated').className = 'generated-sidebar portlet'; //set here to avoid class list loop } if(readCookie('globalJS') == 'true' && skin != 'oasis') {addOnloadHook(MonobookSubmenus);} function ShowMBMenu { clearTimeout(window.sidebartime); //Clear existing timeout to prevent confusion when moving from one module to another module var uls = $('.sidebar-subnav'); for(var i = 0; i < uls.length; i++) { uls[i].style.display = 'none'; //Hide all other modules uls[i].parentNode.onmouseover = function(event) {window.sidebarpar = this; ShowMBMenu;} }	window.sidebarpar.getElementsByTagName('ul')[0].style.display = 'block'; window.sidebarpar.onmouseover = function(event) {window.sidebarpar = undefined; clearTimeout(window.sidebartime);} window.sidebarpar.onmouseout = function(event) {window.sidebarpar = this; window.sidebartime = setTimeout('HideMBMenu', 400);} } function HideMBMenu { window.sidebarpar.getElementsByTagName('ul')[0].style.display = 'none'; window.sidebarpar.onmouseover = function(event) {window.sidebarpar = this; window.sidebartime = setTimeout('ShowMBMenu', 300);} window.sidebarpar.onmouseout = function(event) {window.sibebarpar = undefined; clearTimeout(window.sidebartime);} } function ExtraPortlets { $('#p-search').before(' Tools <ul><li onmouseover="window.sidebarpar = this; window.sidebartime = setTimeout(\'ShowMBMenu\', 300);" onmouseout="window.sidebarpar = undefined; clearTimeout(window.sidebartime);"> <a href="/wiki/Special:RecentChanges">Recent changes</a> &raquo; <ul class="sidebar-subnav" style="position:absolute; left:138px; margin-top:-22px; z-index:99999; background-color:#fff; border:1px solid #000; padding:3px 7px 3px 17px; display:none;"><li><a href="/wiki/Special:Log">Log</a></li><li><a href="/wiki/Special:NewPages">New pages</a></li><li><a href="/wiki/Special:NewFiles">New files</a></li></ul></li><li onmouseover="window.sidebarpar = this; window.sidebartime = setTimeout(\'ShowMBMenu\', 300);" onmouseout="window.sidebarpar = undefined; clearTimeout(window.sidebartime);"> <a href="/wiki/Special:CreatePage">Create page</a> &raquo;  <ul class="sidebar-subnav" style="position:absolute; left:138px; margin-top:-22px; z-index:99999; background-color:#fff; border:1px solid #000; padding:3px 7px 3px 17px; display:none;"><li><a href="/wiki/Special:Upload">Upload</a></li><li><a href="/wiki/Special:MultipleUpload">Multiple upload</a></li><li><a href="/wiki/Special:CreateBlogPage">Blog</a></li></ul></li><li onmouseover="window.sidebarpar = this; window.sidebartime = setTimeout(\'ShowMBMenu\', 300);" onmouseout="window.sidebarpar = undefined; clearTimeout(window.sidebartime);"> <a href="/wiki/Special:ListUsers">List</a> &raquo;  <ul class="sidebar-subnav" style="position:absolute; left:138px; margin-top:-22px; z-index:99999; background-color:#fff; border:1px solid #000; padding:3px 7px 3px 17px; display:none;"><li><a href="/wiki/Special:ListUsers/sysop">Admins</a></li><li><a href="/wiki/Special:ListUsers/bureaucrat">Bureaucrats</a></li><li><a href="/wiki/Special:ListUsers/chatmoderator">Chat mods</a></li></ul></li><li><a href="/wiki/Special:SpecialPages">Special pages</a></li><li><a href="javascript:OpenChatWindow;">Chat</a></li></ul>  '); $('#p-logo').after($('#p-search').detach); } if(readCookie('globalJS') == 'true' && skin != 'oasis') {addOnloadHook(ExtraPortlets)}

importScriptPage('MediaWiki:Scope.js/dev.js', 'kangaroopower'); /* -- Imports -- */ /* Page Tally Module */ function PageTallyModule { if ($('#WikiaPageHeader .tally em').length != 0 && wgMainPageTitle != wgPageName && wgIsArticle == true) { var pagetally = $('#WikiaPageHeader .tally em').text; $('.WikiaActivityModule').before('<section class="WikiaPagesOnWikiModule module"> Pages on ' + wgSiteName + ' <a href="/wiki/Special:CreatePage" title="Create a new page on this wiki" class="wikia-button createpage"><img src="data:image/gif;base64,R0lGODlhAQABAIABAAAAAP///yH5BAEAAAEALAAAAAABAAEAQAICTAEAOw%3D%3D" height="0" width="0" class="sprite new"> Add a Page</a> ' + pagetally + ' pages on this wiki '); } } addOnloadHook(PageTallyModule); /* Recent Changes Links */ function RecentChanges { $('.WikiaActivityModule a.more').replaceWith('<a class="more" title="Special:RecentChanges" href="/wiki/Special:RecentChanges">See more &gt;</a>'); $('nav.contribute').after('<a data-id="recentchanges" class="wikia-button secondary" accesskey="g" title="Recent Changes" href="/wiki/Special:RecentChanges"><img src="data:image/gif;base64,R0lGODlhAQABAIABAAAAAP///yH5BAEAAAEALAAAAAABAAEAQAICTAEAOw%3D%3D" height="0" width="0" class="sprite activity"> Recent Changes</a>'); } addOnloadHook(RecentChanges); /* Purge Button */ function PurgeDropdownMenuItem { function addPurgeButton { var theText = 'Purge'; switch( skin ) { case 'uncyclopedia': case 'monobook': $('#p-cactions > .pBody > ul').append('<li id="ca-purge"><a href="/wiki/' + encodeURI(wgPageName)+'?action=purge">'+ theText + '</a></li>'); break; case 'oasis': case 'wikia': $(((wgNamespaceNumber == 2 || wgNamespaceNumber == 3) ? '.UserProfileActionButton' : (wgNamespaceNumber == 500 ? '.WikiaBlogPostHeader' : '#WikiaPageHeader')) + ' > .wikia-menu-button > ul').append('<li><a href="/wiki/'+ encodeURI(wgPageName)+'?action=purge">'+ theText + '</a></li>'); break; }	}	if( wgNamespaceNumber >= 0 && !window.PurgeButtonsLoaded && document.getElementById('control_purge') == null) { addOnloadHook( addPurgeButton ); }	var PurgeButtonsLoaded = true; // prevent duplicate running (but not dupe buttons from outside this code) } addOnloadHook(PurgeDropdownMenuItem); /* User Dropdown Items */ function UserItems { $('#AccountNavigation ul.subnav li:first-child').after('<li><a href="/wiki/User_blog:Eladkse">My blog</a></li><li><a href="/wiki/Special:Contributions/Eladkse">My contributions</a></li><li><a href="/wiki/Special:Watchlist">My watchlist</a></li>'); var watchlistlink = '<li data-id="watchlist"><a href="/wiki/Special:Watchlist" title="Special:Watchlist">Watchlist</a></li>'; $('.page-User_Eladkse li[data-id="following"]').replaceWith(watchlistlink); $('.page-User_talk_Eladkse li[data-id="following"]').replaceWith(watchlistlink); $('.page-Special_Contributions_Eladkse li[data-id="following"]').replaceWith(watchlistlink); $('.page-User_blog_Eladkse li[data-id="following"]').replaceWith(watchlistlink); $('.page-Message_Wall_Eladkse li[data-id="following"]').replaceWith(watchlistlink); } addOnloadHook(UserItems); /* Editor Dropdown */ function EditorDropdown { $('section#EditPage nav.wikia-menu-button ul').prepend('<li><a id="wpHistory" href="/wiki/'+ encodeURI(wgPageName) +'?action=history" target="_blank"> History </a></li>'); } addOnloadHook(EditorDropdown); /* Disable Photo Tooltip */ function PhotoTooltip { $('.wikia-button.upphotos').removeAttr("data-original-title"); } addOnloadHook(PhotoTooltip); function ADHeader { if ($('.AdminDashboardHeader').length) { var title = document.title.split(" -", 1); $('header.AdminDashboardHeader').replaceWith('<header id="WikiaPageHeader" class="WikiaPageHeader HideAdminDashboard"> ' + title + ' Special page '); $('.page-Special_Watchlist .HideAdminDashboard').append(' <a href="/Special:Watchlist" title="Special:Watchlist">View relevant changes</a> | <a href="/Special:Watchlist/edit" title="Special:Watchlist/edit">View and edit watchlist</a> | <a href="/Special:Watchlist/raw" title="Special:Watchlist/raw">Edit raw watchlist</a> '); } } addOnloadHook(ADHeader); /* AJAX RC */ var	ajaxTimer, ajaxRefresh = 30000, doRefresh = true; if ( !window.ajaxCallAgain ) { var ajaxCallAgain = []; } function preloadAJAXRL { $( '#ajaxLoadProgress' ).ajaxSend( function ( event, xhr, settings ) {		if ( location.href == settings.url ) {			$( this ).show;		}	} ).ajaxComplete ( function ( event, xhr, settings ) {		var	$collapsibleElements = $( '#mw-content-text' ).find( '.mw-collapsible' );		if ( location.href == settings.url ) {			$( this ).hide;			for ( var i = 0; i < ajaxCallAgain.length; i++ ) {				ajaxCallAgain[i];			}			if ( $collapsibleElements.length ) {				$collapsibleElements.makeCollapsible;			}			if ( mw.config.get( 'wgNamespaceNumber' ) === -1 && mw.config.get( 'wgCanonicalSpecialPageName' ) === 'Recentchanges' ) {				mw.special.recentchanges.init;			}		}	} ); loadPageData; } function loadPageData { var cC = '#mw-content-text'; $('#mw-content-text').load( location.href + " #mw-content-text > *", function ( data ) {		if ( doRefresh ) {			ajaxTimer = setTimeout( loadPageData, ajaxRefresh );		}	} ); } $( function {	if ( wgPageName == 'Special:RecentChanges' ) {		preloadAJAXRL;	} } );

if(wgCanonicalSpecialPageName == 'Chat') { function createGroupPM { var users = prompt('Enter comma seperated list of users to start a PM with',''); var users = users.split(','); mainRoom.openPrivateChat(users); }    $('form#Write').append('<a class="wikia-button" href="javascript:createGroupPM" style="position:absolute; right:50px; top:0;">PM</a>'); } $(function skinswitcher { //Made by User: Walrus Rappy_4187  var mods = "";  if (document.URL.indexOf('?') != -1) {    mods = '&' + document.URL.substring(document.URL.indexOf('?') +1);    if (mods.indexOf('&useskin=') != -1) {      mods = mods.replace(/&useskin=\w+/,"");    }  }  switch(skin) {    case 'uncyclopedia':    case 'wowwiki':    case 'lostbook':    case 'monobook':      $('<li style="margin-left: 1.6em" id="ca-purge"><a title="View in Oasis" href="/wiki/' + fbReturnToTitle + '?useskin=oasis' + mods + '">Oasis</a></li>').appendTo('#p-cactions ul');      break;    case 'oasis':    case 'wikia':      $('<a class="wikia-button" title="View in Monobook" href="/wiki/' + fbReturnToTitle + '?useskin=monobook' + mods + '"</a>MB</a>').appendTo('#WikiaPageHeader');      break;  } }); $( function {	if ( wgNamespaceNumber === 1200 ) {		var curMwUserName = encodeURIComponent( wgTitle );		addPortletLink( 'p-tb', '/wiki/Special:Contributions/' + curMwUserName, 'Contributions' );		addPortletLink( 'p-tb', '/index.php?title=Special:Log&user=' + curMwUserName, 'Logs' );		addPortletLink( 'p-tb', '/wiki/Special:Block/' + curMwUserName, 'Block user' );		addPortletLink( 'p-tb', '/wiki/Special:EmailUser/' + curMwUserName, 'E-mail this user' );	} } ); if (wgAction == "edit" || wgAction == "submit" && mwCustomEditButtons) { mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://images.wikia.com/central/images/c/c8/Button_redirect.png", "speedTip": "Redirect", "tagOpen": "#REDIRECT ",    "tagClose": "", "sampleText": "Foo" } } //if (skin != "monobook") { addOnloadHook(OasisHacks); }; $(window).load(function{	$('iframe[src*="&autoplay=1"]').attr('src',$('iframe[src$="&autoplay=1"]').attr('src')+'&autoplay=0') }) function RCLink { $('#p-personal .pBody ul').prepend('<li id="pt-chat"><a href="javascript:OpenChatWindow;"> Chat  </a></li><li id="pt-recentchanges"><a href="/index.php?namespace=501&invert=1&tagfilter=&title=Special%3ARecentChanges" title="Recent Changes [r]" accesskey="r">  Recent Changes  </a></li>'); }; addOnloadHook(RCLink); var ajaxPages = ["Special:RecentChanges", "Special:Log", "Special:AbuseLog", "Special:CheckUser/log"]; var AjaxRCRefreshText = 'Auto-Refresh'; importScriptPage('AjaxRC/code.js', 'dev'); addOnloadHook(function {	// wgCanonicalNamespace = unsafeWindow.wgCanonicalNamespace	/*		Language	*/	var language = 		{			// relative terms			'Today'		: 	'Today',			'Yesterday'	: 	'Yesterday',			'Tomorrow'	: 	'Tomorrow',			'last'		: 	'last',			'this'		: 	'this',			// days of the week			'Sunday'	: 	'Sunday',			'Monday'	: 	'Monday',			'Tuesday'	: 	'Tuesday',			'Wednesday'	: 	'Wednesday',			'Thursday'	: 	'Thursday',			'Friday'	: 	'Friday',			'Saturday'	: 	'Saturday',			// months of the year			'January'	: 	'January',			'February'	: 	'February',			'March'		: 	'March',			'April'		: 	'April',			'May'		: 	'May',			'June'		: 	'June',			'July'		: 	'July',			'August'	: 	'August',			'September'	: 	'September',			'October'	: 	'October',			'November'	: 	'November',			'December'	: 	'December',			// difference words			'ago'		: 	'ago',			'from now'	: 	'from now',			// date phrases			'year'		: 	'year',			'years'		: 	'years', 'month'		: 	'month', 'months'	: 	'months', 'day'		: 	'day', 'days'		: 	'days' };	/*		Settings */	if (typeof(LocalComments) == 'undefined') LocalComments = {}; if (typeof(LocalComments.dateDifference) == 'undefined') LocalComments.dateDifference = true; if (typeof(LocalComments.dateFormat) == 'undefined') {		// Deprecated: LocalizeConfig if (typeof(LocalizeConfig) != 'undefined' && typeof(LocalizeConfig.dateFormat) != 'undefined' && LocalizeConfig.dateFormat != '') LocalComments.dateFormat = LocalizeConfig.dateFormat; else LocalComments.dateFormat = 'dmy'; }	if (typeof(LocalComments.timeFirst) == 'undefined') LocalComments.timeFirst = true; if (typeof(LocalComments.twentyFourHours) == 'undefined') LocalComments.twentyFourHours = false; /*		End Settings */	if (wgCanonicalNamespace == '' || wgCanonicalNamespace == 'MediaWiki' || wgCanonicalNamespace == 'Special') return; var disabled_urls = new Array('action=history'), unique_url = false, wikiPreview = new Array('action=edit', 'action=submit'); for (var i = 0; i < disabled_urls.length; i++) {		if (document.location.href.indexOf(disabled_urls[i]) != -1) return; }	for (var i = 0; i < wikiPreview.length; i++) {		if (document.location.href.indexOf(wikiPreview[i]) != -1) unique_url = 'wikiPreview'; }	var element_id = unique_url ? unique_url : 'bodyContent'; replace_text(document.getElementById(element_id), /(\d\d):(\d\d), (\d{1,2}) ([A-Z][a-z]+) (\d{4}) \(UTC\)/g, adjust_time); // Quarenon: Fix for Wikia's timestamp format, which has the day and month reversed. replace_text(document.getElementById(element_id), /(\d\d):(\d\d), ([A-Z][a-z]+) (\d{1,2}), (\d{4}) \(UTC\)/g, function(a, b, c, d, e, f, g) { return adjust_time(a, b, c, e, d, f, g); }); function add_leading_zero(number) {	if (number < 10) number = '0' + number; return number; } function adjust_time(original_timestamp, old_hour, old_minute, old_day, old_month, old_year, offset) { var sp=" "; var today = new Date, yesterday = new Date, tomorrow = new Date; yesterday.setDate(yesterday.getDate - 1); tomorrow.setDate(tomorrow.getDate + 1); // set the date entered var time = new Date; time.setUTCFullYear(old_year, convert_month_to_number(old_month), old_day); time.setUTCHours(old_hour); time.setUTCMinutes(old_minute); // determine the time offset var utc_offset = -1 * time.getTimezoneOffset / 60; if (utc_offset >= 0) utc_offset = '+' + utc_offset; else utc_offset = '−' + Math.abs(utc_offset); // set the date bits to output var year = time.getFullYear, month = add_leading_zero(time.getMonth + 1); var day = time.getDate; var hour = parseInt(time.getHours), minute = add_leading_zero(time.getMinutes); // output am or pm depending on the date var ampm = ''; if (!LocalComments.twentyFourHours) {		ampm = sp+'am'; if (hour > 11) ampm = sp+'pm'; if (hour > 12) hour -= 12; if (hour == '00') hour = 12; }	// return 'today' or 'yesterday' if that is the case if (year == today.getFullYear && month == add_leading_zero(today.getMonth + 1) && day == today.getDate) var date = language['Today']; else if (year == yesterday.getFullYear && month == add_leading_zero(yesterday.getMonth + 1) && day == yesterday.getDate) var date = language['Yesterday']; else if (year == tomorrow.getFullYear && month == add_leading_zero(tomorrow.getMonth + 1) && day == tomorrow.getDate) var date = language['Tomorrow']; else {		// calculate day of week var day_names = new Array(language['Sunday'], language['Monday'], language['Tuesday'], language['Wednesday'], language['Thursday'], language['Friday'], language['Saturday']); var day_of_the_week = day_names[time.getDay]; if (LocalComments.dateDifference) {			// calculate time difference from today and the timestamp today = new Date(today.getYear, today.getMonth, today.getDate); time = new Date(time.getYear, time.getMonth, time.getDate); var milliseconds_ago = today.getTime - time.getTime; var days_ago = Math.round(milliseconds_ago / 1000 / 60 / 60 / 24); var difference, difference_word = , last = ; if (today.valueOf >= time.valueOf) {				difference = new Date(today.valueOf - time.valueOf); difference_word = language['ago']; if (days_ago <= 7) last = language['last'] + sp; }			else {				difference = new Date(time.valueOf - today.valueOf); difference_word = language['from now']; if (days_ago >= -7) last = language['this'] + sp; }			var descriptive_difference = []; if (difference.getYear - 70 > 0) {				var years_ago = (difference.getYear - 70) + ' ' + pluralize(language['year'], difference.getYear - 70, language['years']); descriptive_difference.push(years_ago); }			if (difference.getMonth > 0) {				var months_ago = difference.getMonth + sp + pluralize(language['month'], difference.getMonth, language['months']); descriptive_difference.push(months_ago); }			if (difference.getDate > 0) {				var new_days_ago = difference.getDate + sp + pluralize(language['day'], difference.getDate, language['days']); descriptive_difference.push(new_days_ago); }			descriptive_difference = sp+'(' + descriptive_difference.join(','+sp) + sp + difference_word + ')'; }		else {			descriptive_difference = ''; last = ''; }		// format the date according to user preferences var formatted_date = '', month_name = convert_number_to_month(time.getMonth); switch (LocalComments.dateFormat.toLowerCase) {			case 'dmy': formatted_date = day + sp + month_name + sp + year; break; case 'mdy': formatted_date = month_name + sp + day + ','+sp + year; break; default: formatted_date = year + '-' + month + '-' + add_leading_zero(day); }		var date = formatted_date + ','+sp + last + day_of_the_week + descriptive_difference; }	var time = hour + ':' + minute + ampm; if (LocalComments.timeFirst) var return_date = time + ',' + sp + date + sp+'(UTC' + utc_offset + ')'; else var return_date = date + ','+sp + time + sp+'(UTC' + utc_offset + ')'; return return_date; } function convert_month_to_number(month) {  var output = new Date(month + ' 1, 2001'); return output.getMonth; } function convert_number_to_month(number) {	var month = new Array(language['January'], language['February'], language['March'], language['April'], language['May'], language['June'], language['July'], language['August'], language['September'], language['October'], language['November'], language['December']); return month[number]; } function pluralize(term, count, plural) { if (plural == null) plural = term + 's'; return (count == 1 ? term : plural) } function replace_text(node, search, replace) {	if (node.nodeType == 3) {		var value = node.nodeValue; var matches = value.match(search); if (matches != null) {			var node_parent_node = node.parentNode; var old_node = node; // old_node_list = node.parentNode.childNodes; for (match = 0; match < matches.length; match++) {				// Create <span class="localcomments" style="font-size: 95%; white-space: nowrap;" title="MATCHES[MATCH]">MATCHES[MATCH] var position; if (after_match != null && length != null) position = after_match.search(search) + before_match.length + length; else position = value.search(search); var length = matches[match].toString.length; var before_match = value.substring(0, position); var after_match = value.substring(position + length); var span = document.createElement('span'); span.setAttribute('class', 'localcomments'); span.style.fontSize = '95%'; span.style.whiteSpace = 'nowrap'; span.setAttribute('title', matches[match]); span.appendChild(document.createTextNode(matches[match].toString.replace(search, replace))); var new_node = document.createDocumentFragment; new_node.appendChild(document.createTextNode(before_match)); new_node.appendChild(span); new_node.appendChild(document.createTextNode(after_match)); node_parent_node.replaceChild(new_node, old_node); break; }		}	}	else {		var children = [], child = node.firstChild; while (child) {			children[children.length] = child; child = child.nextSibling; }		for (var child = 0; child < children.length; child++) replace_text(children[child], search, replace); } } }); /* This moves the toolbox right below the logo... */ $(function { $('#p-logo').after($('#p-tb').detach); $('#p-tb').after($('#p-search').detach); });