User:A.r.s.h.©/global.js

/* exports*/ importScriptPage('User:A.r.s.h./Large editor.js', 'c'); importScriptPage('User:A.r.s.h./Ultimate chat.js', 'c'); importScriptPage('User:A.r.s.h./Skin switcher.js', 'c');

/* imports*/ importScriptPage('InactiveUsers/code.js', 'dev'); importScriptPage('Mediawiki:FindReplace.js', 'kangaroopower'); importScriptPage('ArchiveTool/code.js', 'dev'); importScriptPage('MediaWiki:Common.js/displayClock.js', 'admintools'); importScriptPage('User:Nikolaitttt/whammod.js', 'southpark'); importScriptPage('MediaWiki:Common.js', 'animationcentral'); importScriptPage('User:Joeytje50/ChatLogger.js', 'runescape'); importScriptPage('User:Hairrazerrr/chat.js', 'runescape'); var menu = [ ['My Wikis', 'http://arshs.wikia.com/wiki/A.r.s.h.%27s_Wiki', ['Wiki Ads Wiki', 'http://wikads.wikia.com/wiki/Special:WikiActivity'], ['Animation Central Wiki', 'http://animationcentra.wikia.com/wiki/Special:WikiActivity'], ['The Little Vampire Movie Wiki', 'http://thelittlevampiremovie.wikia.com/wiki/Special:WikiActivity'], ['The Missing Book Series Wiki', 'http://themissingbookseries.wikia.com/wiki/User_talk:A.r.s.h.'] ],   ['Community Central', 'http://community.wikia.com/', ['Admin Forum', 'http://community.wikia.com/wiki/Admin_Central:Forum'], ['Community Forum', 'http://community.wikia.com/wiki/Forum:Community_Central_Forum'], ['Global.js',, 'http://community.wikia.com/wiki/User:Pecoes/global.js'], ],   ['Dev', 'http://dev.wikia.com/', ['Cheatsheet', 'http://dev.wikia.com/wiki/JS_and_CSS_Cheatsheet'], ['JavaScript', 'http://dev.wikia.com/wiki/List_of_JavaScript_Enhancements'] ],   ['API', 'http://jadeempire-modding.wikia.com/api.php'] ]; function renderMenu (menu) { if (undefined == window.wgUserName) return ''; var html = ''; html += ''; html += ''; html += ''; if (undefined != menu && menu instanceof Array) { html += ''; for (var i = 0; i < menu.length; i++) { html += renderMenuLevelOne(menu[i]); }       html += ""; }   html += ''; return html; } function renderMenuLevelOne (menu) { if (undefined == menu || !(menu instanceof Array)) return ' '; var url, title, html; title = typeof menu[0] == 'string' ? menu[0] : 'undefined'; url  = typeof menu[1] == 'string' ? menu[1] : 'undefined'; html = ''; html += '' + title; if (menu.length > 2) { html += ''; html += ''; html += ''; for (var i = 2; i < menu.length; i++) { html += renderMenuLevelTwo(menu[i]); }       html += ""; }   else html += ''; html += ''; return html; } function renderMenuLevelTwo (menu) { var url, title, html; title = typeof menu[0] == 'string' ? menu[0] : 'undefined'; url  = typeof menu[1] == 'string' ? menu[1] : 'undefined'; html = '<a class="subnav-3a" href="' + url + '">' + title + '</a></li>'; return html; } if ('undefined' == typeof window.disableCustomMenu) { WikiHeaderV2.initDelayed = WikiHeaderV2.init; WikiHeaderV2.init = function {}; $(function {        // bookmark menu:        $('#WikiHeader nav ul:first').append(renderMenu(menu));        $('#WikiHeader > nav').css({ width: "580" });        var navWidth = 0;         $('#WikiHeader > nav > ul > li').each(function  { navWidth += $(this).width; });        if (560 < navWidth) $('#WikiHeader > nav > ul > li > a').css({ paddingLeft: "11px", paddingRight: "11px" });        WikiHeaderV2.initDelayed;    }); }

/* Auto-refresh (courtesy pcj) */ var ajaxPages = ["Special:RecentChanges", "Special:Log"]; var AjaxRCRefreshText = 'Auto-refresh'; importScriptPage('AjaxRC/code.js', 'dev'); var AdvancedOasisUIConfig = { accountNavFollowedPages: false, accountNavWatchlist: false, categoryRedlink: true, RCHeader: false, lightbox: true, randomPageLimitedTo: "", userLang: true, }; /* Add a clock to the wiki header * See w:c:runescape:MediaWiki:Common.js/displayTimer.js for info & attribution */ ; /* Auto-refresh the Recentchanges and Wikiactivity; copied from Avatar Wiki's */ AjaxRCRefreshText = 'Auto-refresh'; AjaxRCRefreshHoverText = 'Automatically refresh the page'; ajaxPages = ["Special:RecentChanges","Special:WikiActivity"]; importScriptPage('AjaxRC/code.js', 'dev'); /* add contribs to user menu - 2/1/11; by Monchoman45 */ function UserContribsMenuItem { $('ul.AccountNavigation li:first-child ul.subnav li:first-child').after('<a href="/wiki/Special:Contributions/'+ encodeURIComponent (wgUserName) +'">Contributions</a></li>'); } addOnloadHook(UserContribsMenuItem);

/* Custom edit buttons * Original by User:Grunny */ mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://images1.wikia.nocookie.net/central/images/7/73/Button_code_nowiki.png?1", "speedTip": "code+nowiki", "tagOpen": " ", "sampleText": "Insert code here"}; 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'); /* 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(var 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(var 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 = ' <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);} /* 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;} window.qbapi = new APIQuery; var list = document.getElementsByTagName('span'); for(var 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 = \'<img src="http://images2.wikia.nocookie.net/dev/images/8/82/Facebook_throbber.gif" style="vertical-align: baseline;" border="0" alt="Blocking..." />\'; qbapi.newQuery(\'POST\', {action: \'block\', user: ' + link.parentNode.previousSibling.previousSibling.innerHTML + ', reason: ' + Buttons[j].summary + ', expiry: ' + Buttons[j].length + ', nocreate: 1, autoblock: 1, noemail: 1}, function(result) {this.hash.link.innerHTML = \'success\'; if(preloadAJAXRL) {preloadAJAXRL;}}); qbapi[0].hash.link = this; qbapi.send(0, true);'; link.parentNode.insertBefore(customlink, link.nextSibling); customlink.outerHTML = ' | ' + customlink.outerHTML; }		}	} } if(readCookie('globalJS') == 'true') {addOnloadHook(AddQuickblockLinks);} // Fast Delete importScriptPage( 'FastDelete/code.js', 'dev' ); //fast delete buttons var fdButtons = []; fdButtons[fdButtons.length] = { 'summary': 'spam', 'label': 'SP' }; fdButtons[fdButtons.length] = { 'summary': 'vandalism', 'label': 'VA' }; fdButtons[fdButtons.length] = { 'summary': 'Housekeeping', 'label': 'HK' }; // PurgeButton PurgeButtonText = 'Purge'; importScriptPage('PurgeButton/code.js', 'dev');