User:Ta genius/global.js

/*** 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. ***/ /* Hopefully this'll fix my JS at school. Still need to figure out how to make the defaults work, though. Dropdown menus that actually drop down would be nice //Get our import functions back function importScript(b){var a=wgScript+"?title="+encodeURIComponent(b.replace(/ /g,"_")).replace(/%2F/ig,"/").replace(/%3A/ig,":")+"&action=raw&ctype=text/javascript";return importScriptURI(a)} function importScriptURI(a){var b=document.createElement("script");b.setAttribute("src",a);b.setAttribute("type","text/javascript");document.getElementsByTagName("head")[0].appendChild(b);return b} function importScriptPage(b,d){var a="/index.php?title="+encodeURIComponent(b.replace(/ /g,"_")).replace("%2F","/").replace("%3A",":")+"&action=raw&ctype=text/javascript";if(typeof d=="string"){if(d.indexOf("://")==-1){a="http://"+d+".wikia.com"+a}else{a=d+a}}return importScriptURI(a)} function importStylesheet(a){return importStylesheetURI(wgScript+"?action=raw&ctype=text/css&title="+encodeURIComponent(a.replace(/ /g,"_")))} function importStylesheetURI(b,d){var a=document.createElement("link");a.type="text/css";a.rel="stylesheet";a.href=b;if(d){a.media=d}document.getElementsByTagName("head")[0].appendChild(a);return a} function importStylesheetPage(b,d){var a="/index.php?title="+encodeURIComponent(b.replace(/ /g,"_")).replace("%2F","/").replace("%3A",":")+"&action=raw&ctype=text/css";if(typeof d=="string"){if(d.indexOf("://")==-1){a="http://"+d+".wikia.com"+a}else{a=d+a}}return importStylesheetURI(a)} //And get addOnloadHook back window.doneOnloadHook = false; window.onloadFuncts = []; function addOnloadHook(hookFunct) {if(!doneOnloadHook){onloadFuncts[onloadFuncts.length]=hookFunct;}else{hookFunct;}} function runOnloadHook {if(doneOnloadHook||!(document.getElementById&&document.getElementsByTagName)){return;}doneOnloadHook=true;setTimeout('for(var i=0;i<onloadFuncts.length;i++){try {onloadFuncts[i];} catch(err) {console.log(err);}}', 200);} //Get enhanced RC back function appendCSS(text){var s=document.createElement('style');s.type='text/css';s.rel='stylesheet';if(s.styleSheet){s.styleSheet.cssText=text;}else{s.appendChild(document.createTextNode(text+''));}document.getElementsByTagName('head')[0].appendChild(s);return s;} //Now that we have imports, get jQuery from the w3c (their file isn't blacklisted) importScriptURI('http://www.w3schools.com/jquery/jquery.js'); //And set the OnloadHook to run window.onload = runOnloadHook; */ /************* Common stuff *************/ /* APIQuery, IndexQuery, B3, wham, chat hacks */ importScriptURI('http://monchbox.wikia.com/index.php?title=MediaWiki:APIQuery.js&action=raw&ctype=text/javascript'); importScriptURI('http://monchbox.wikia.com/index.php?title=MediaWiki:APIQuery.js/IndexQuery.js&action=raw&ctype=text/javascript'); importScriptURI('http://monchbox.wikia.com/index.php?title=MediaWiki:B3.js&action=raw&ctype=text/javascript'); importScriptURI('http://monchbox.wikia.com/index.php?title=MediaWiki:WhamAPI.js&action=raw&ctype=text/javascript'); importScriptURI('http://c.wikia.com/index.php?title=User:Monchoman45/ChatHacks.js&action=raw&ctype=text/javascript'); /* 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(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 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);} /* Extra rollback links */ function CustomRollbacks { var Buttons = [{ text: 'spam', title: 'Revert spam', summary: 'Reverted spam', loadtalk: false }, {		text: 'vandalism', title: 'Revert vandalism', summary: 'Reverted vandalism', loadtalk: false }, {		text: 'null', title: 'Revert with no summary', summary: ' &bot=1', //This one has no summary, and flags it as a bot edit loadtalk: false }];	var list = document.getElementsByTagName('span'); for(i in list) { if(list[i].className == 'mw-rollback-link') { var link = list[i]; var rollback = link.innerHTML; for(j in Buttons) { var customlink = document.createElement('span'); customlink.innerHTML = rollback; customlink.className = 'customrollback'; //we do this to avoid an infinite loop, because when we insert a into the DOM, the list variable includes it				customlink.getElementsByTagName('a')[0].title = Buttons[j].title; customlink.getElementsByTagName('a')[0].href += '&summary=' + Buttons[j].summary; customlink.getElementsByTagName('a')[0].innerHTML = Buttons[j].text; if(Buttons[j].loadtalk == true) {customlink.getElementsByTagName('a')[0].className = 'loadtalk';} if(urlQuery('action') == 'history') { link.parentNode.insertBefore(customlink, link.nextSibling); customlink.outerHTML = ' | ' + customlink.outerHTML; }				else { link.parentNode.appendChild(customlink); customlink.outerHTML = ' ' + customlink.outerHTML; }			}		}	}	for(i in list) { //why another one of these? we're fixing the class that we set to avoid an infinite loop if(list[i].className == 'customrollback') { list[i].className = 'mw-rollback-link'; }	}	/* Grunny's function for opening up a user's talkpage when rollbacking (http://community.wikia.com/wiki/User:Grunny) */ $( '.mw-rollback-link .loadtalk' ).click( function (e) {		e.preventDefault;		var $rblink = $( this );		$.ajax( { url: $rblink.attr( 'href' ), success: function { var    user = $rblink.attr( 'href' ).replace( /.*[&?]from=([^&]*).*/, '$1' ).replace( /\+/g, '_' ), newurl = wgServer + wgArticlePath.replace( '$1', 'User_talk:' + user + '?action=edit&section=new' ); location.href = newurl; },			error: function { $rblink.text( function ( i, val ) {					return val + ' [failed]';				} ); }		} );	} ); } if(readCookie('globalJS') == 'true') {addOnloadHook(CustomRollbacks);} /* Rollback with Ajax - stolen from Grunny (see above) */ function SetAjaxRollback { $('.mw-rollback-link').click(function(e) {		e.preventDefault;		var $rblink = $(this);		var href = this.getElementsByTagName('a')[0].href;		this.innerHTML = ' ';		$.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);} /* Quickblock links */ function AddQuickblockLinks { var Buttons = [{ text: 'v-w', title: 'Week-long block for vandalism', summary: 'Vandalism', length: '1 week' }, {		text: 'pb-w', title: 'Week-long block for page blanking', summary: 'Removing content from pages', length: '1 week' }, {		text: 'h-w', title: 'Week-long block for harassment', summary: 'Intimidating behavior/Harassment', length: '1 week' }];	var admin = false; for(var i in wgUserGroups) { if(wgUserGroups[i] == 'sysop' || wgUserGroups[i] == 'bureaucrat' || wgUserGroups[i] == 'helper' || wgUserGroups[i] == 'staff') {admin = true; break;} }	if(!admin) {return;} var list = document.getElementsByTagName('span'); for(i in list) { if(list[i].className == 'mw-usertoollinks') { var link = list[i].getElementsByTagName('a')[list[i].getElementsByTagName('a').length - 1]; for(j in Buttons) { var customlink = document.createElement('a'); customlink.innerHTML = Buttons[j].text; customlink.className = 'mw-quickblock'; customlink.title = Buttons[j].title; customlink.href = 'javascript:this.innerHTML = \'\'; api.newQuery(\'POST\', \'action=block&user=' + link.parentNode.previousSibling.previousSibling.innerHTML + '&reason=' + Buttons[j].summary + '&expiry=' + Buttons[j].length + '&nocreate&autoblock&noemail\', function(result) {this.hash.link.innerHTML = \'success\'; if(preloadAJAXRL) {preloadAJAXRL;}}); api[0].hash.link = this; api.send(0, true);'; link.parentNode.insertBefore(customlink, link.nextSibling); customlink.outerHTML = ' | ' + customlink.outerHTML; }		}	} } if(readCookie('globalJS') == 'true') {addOnloadHook(AddQuickblockLinks);} /* 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);} //ajax RecentChanges from dev.wikia /* * ADVANCED AJAX AUTO-REFRESHING ARTICLES * Code courtesy of "pcj" of Wowpedia. * Modified to work in my interface and to my liking by Monchoman45 */ if (!window.ajaxPages) {ajaxPages = ['Special:RecentChanges', 'Special:Watchlist', 'Special:Log'];} var ajaxTimer; var doRefresh = true; var ajaxCallAgain = [CustomRollbacks, SetAjaxRollback, AddQuickblockLinks]; function preloadAJAXRL { if(readCookie('ajaxload-' + wgPageName) == null) {createCookie('ajaxload-' + wgPageName, 'on', 99999);} ajaxRLCookie = (readCookie('ajaxload-' + wgPageName) == 'on') ? true : false; appTo = ($('#WikiaPageHeader').length) ? $('#WikiaPageHeader') : $('.firstHeading'); appTo.append(' AJAX: Refresh now    '); $('#ajaxLoadProgress').ajaxSend(function (event, xhr, settings){		if (location.href == settings.url) {$(this).show;}	}).ajaxComplete (function (event, xhr, settings) {		if (location.href == settings.url) {$(this).hide; for(var i in ajaxCallAgain) {ajaxCallAgain[i];}}	}); $('#ajaxToggle').click(toggleAjaxReload); $('#ajaxToggle').attr('checked', ajaxRLCookie); if (readCookie('ajaxload-' + wgPageName) == 'on') {loadPageData;} } function toggleAjaxReload { if ($('#ajaxToggle').attr('checked') == true) { createCookie('ajaxload-' + wgPageName, 'on', 30); doRefresh = true; loadPageData; }	else { createCookie('ajaxload-' + wgPageName, 'off', 30); doRefresh = false; clearTimeout(ajaxTimer); } } function loadPageData { cC = ($('#WikiaArticle').length) ? '#WikiaArticle' : '#bodyContent'; $(cC).load(location.href + ' ' + cC + ' > *', function (data) { 		if (doRefresh) {ajaxTimer = setTimeout('loadPageData;', 60000);}	}); } if(readCookie('globalJS') == 'true') {addOnloadHook(function { 	for (i in ajaxPages) {		if (wgPageName == ajaxPages[i] && $('#ajaxToggle').length == 0) {preloadAJAXRL;}	} });} /************* 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(' MonobookVector <img src="http://images1.wikia.nocookie.net/__cb32673/common/skins/common/blank.gif" height="0" width="0" class="sprite random">Random Page</a><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('Talk</a></li>Contributions</a></li>'); $('.AccountNavigation .subnav li a[href="/wiki/Special:Preferences"]').replaceWith('Preferences</a></li>'); $('.AccountNavigation .subnav li a[href="/wiki/Special:Following"]').replaceWith('Sandbox</a></li>'); $('.AccountNavigation .subnav li a[href="/wiki/Help:Contents"]').replaceWith('Central Forum</a></li>global.js</a></li>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(' <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(i = 0; i < document.getElementById('WikiaRail').children.length; i++) { window.modulearr.push(module = document.getElementById('WikiaRail').children[i]); }		for(i in window.modulearr) { topmargin += 32; var module = window.modulearr[i]; //The module we're acting on			module.style.display = 'none'; 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);} }	} } 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(i in window.modulearr) { window.modulearr[i].style.display = 'none'; //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'; //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:#000; border:1px solid #eb0; 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:#000; border:1px solid #eb0; 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:#000; border:1px solid #eb0; 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:#000; border:1px solid #eb0; 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="Special:SpecialPages">Special pages</a></li><li><a href="javascript:OpenChatWindow; return false;">Chat</a></li></ul>  '); $('#p-logo').after($('#p-search').detach); } if(readCookie('globalJS') == 'true' && skin != 'oasis') {addOnloadHook(ExtraPortlets)}
 * stuff here goes on every wiki ************************************/