User:Monchbot/global.js

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://monchbox.wikia.com/index.php?title=MediaWiki:Torus.js&action=raw&ctype=text/javascript');

/* redo links on user nav to be more useful */ function RedefineUserNav { $('.AccountNavigation .subnav li:first-child').replaceWith('TalkContributions'); $('.AccountNavigation .subnav li a[href="/wiki/Special:Preferences"]').replaceWith('Preferences'); $('.AccountNavigation .subnav li a[href="/wiki/Special:Following"]').replaceWith('Sandbox'); $('.AccountNavigation .subnav li a[href="/wiki/Help:Contents"]').replaceWith('<a href="http://community.wikia.com/wiki/Forum:Community_Central_Forum">CC 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': "104px"}); }

addOnloadHook(RedefineUserNav);

//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; 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: <input type="checkbox" style="position:relative; top:2px;" id="ajaxToggle"><a onclick="loadPageData" style="cursor:pointer; margin-top:1px;" class="wikia-button secondary">Refresh now</a>  <img src="http://images2.wikia.nocookie.net/dev/images/8/82/Facebook_throbber.gif" style="vertical-align: baseline;" border="0" alt="Refreshing page" />  '); $('#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; CustomRollbacks;}	}); $('#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);}	}); } addOnloadHook(function { 	for (i in ajaxPages) {		if (wgPageName == ajaxPages[i] && $('#ajaxToggle').length == 0) {preloadAJAXRL;}	} });