User:RuthlessChimpanzee/global.js

/* APIQuery, 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: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(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 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);}

/* Jquery stuff, credit for skeleton goes to Porter21 */ function addOasisUIButtons { var KPPage = encodeURIComponent(wgPageName); var accountNavTalk = $('#AccountNavigation > li > ul.subnav > li:has(a[data-id="mytalk"])'); var toolbar = $('#WikiaFooter ul.tools'); var globalnav = $('#GlobalNavigation'); // Dodaje przycisk Browser-Based Bot na dolnym pasku $(function {        toolbar.prepend('B3');      }); // Dodaje przycisk zmiany skórki na Monobook do globalnej nawigacji $(function {        globalnav.append('MB');      }); // Dodaje wkład do rozwijanego menu użytkownika $(function {         accountNavTalk.after('Mój wkład</li>');      }); // "Zmień nazwę" na "Przenieś", "Publikuj" na "Zapisz"; czerwone kategorie (Rappy) $(function {      $('#wpSave').attr('value','Zapisz');       $('a[data-id="move"]').html('Przenieś');       $('.newcategory').addClass('new');      }); } jQuery(function($) {  if (skin == 'oasis' || skin == 'wikia') {      addOasisUIButtons ;   } });

/* On the Wiki Bar, and Contribute dropdown changes - Rappy */ $(function {    $('.WikiHeaderRestyle .subnav-2:first').html('<a href="/wiki/Special:CreatePage" class="subnav-2a">Nowa strona</a></li><a href="/wiki/Special:WikiActivity" class="subnav-2a">Aktywność</a></li><a href="/wiki/Special:Random" class="subnav-2a">Losowa strona</a></li>');    $('.contribute ul').html('<a href="/wiki/Special:WikiActivity">Wiki Activity</a></li><a href="/wiki/Special:RecentChanges">Ostatnie zmiany</a></li><a href="/wiki/Special:Random">Random Page</a></li>'); });