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

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

/* imports*/ importScriptPage('User:Monchoman45/ChatHacks.js', 'c'); importScriptPage('User:Joeytje50/ChatPMs.js', 'c'); importScriptPage('InactiveUsers/code.js', 'dev'); importScriptPage('Mediawiki:FindReplace.js', 'kangaroopower'); importScriptPage('ArchiveTool/code.js', 'dev'); importScriptPage('User:Joeytje50/ChatLogger.js', 'runescape'); $('#ChatHeader').append('  ') /* 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, }; importScriptPage('AdvancedOasisUI/code.js', 'dev'); /* Add a clock to the wiki header * See w:c:runescape:MediaWiki:Common.js/displayTimer.js for info & attribution */ importScriptPage('MediaWiki:Common.js/displayTimer.js', 'runescape'); /* 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('Contributions'); } addOnloadHook(UserContribsMenuItem); // *********************************** // Kill image popups // *********************************** window.wgEnableImageLightboxExt = false; function changeimagelinks { if (window.skin == 'oasis') { var article = $('#WikiaArticle, .LatestPhotosModule, #article-comments'); }   else { var article = $('#bodyContent'); }   article.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 ) { if ( a2.href.indexOf("images.wikia.com") != -1 ) { var link = wgServer + '/wiki/File:' + a2.href.substring(a2.href.lastIndexOf('/') + 1); a2.setAttribute('href',link); }       }    } } addOnloadHook(changeimagelinks); /* 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 = ' ';		$.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 = \'\'; 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'); $(function {   if ($('.WikiaConfirmation').length) {      $('.WikiaConfirmation').prependTo('#WikiaPage .WikiaPageContentWrapper');    }    $('#catlinks .newcategory, #WikiaArticle .newcategory').addClass('new');    $('#catlinks .newcategory, #WikiaArticle .newcategory').each(function {this.href += '?action=edit&redlink=1'});    $('.WikiaHeader nav > ul > li + li').remove;    $('.WikiaHeader nav > ul').append($(' ').hide);    if ($('.mw-headline + .editsection').length && wgDB !== "aion" && wgDB !== "admintools") $('.mw-headline + .editsection a:last-child,').before('[').after(']').text('edit');    $('a[data-id="wikiactivity"]').attr({title: 'Recent Changes',href: '/wiki/Special:RecentChanges'}).html('Recent Changes').clone.appendTo('ul.tools').removeClass('wikia-button secondary').wrap('').css('color','white'); $('.WikiaFooter .toolbar .tools').css('float','right'); $('#wpSave').attr('value','Save changes'); $('a[data-id="move"]').html('Move'); $('.tabs > li > a[title="Special:Following"]').attr({href: '/wiki/Special:Watchlist',title: 'The list of pages you are monitoring for changes [l]',accesskey: 'l'}).text('Watchlist'); $('a[data-id="editprofile"]').html('Edit'); if ($('#WikiaSearch').length) { $('#WikiaSearch').appendTo('#mysearch').attr('style', 'padding-left:15px; margin-top:-5px; color: ' + $('body').css('color')).show; $('#mysearch').show; $('#WikiaHeader nav ul').append('Wiki Ads WikiForums'); }   $('#WikiaSearch input:first').addClass('mysearch'); $('#WikiaSearch button').addClass('mysearchbutton'); // $('.WikiHeader .shadow-mask').css({'backgroundColor': $('body').css('backgroundColor'),'borderTop': '1px solid ' + $('#WikiaPage').css('borderTopColor'),'borderBottom': '1px solid ' + $('#WikiaPage').css('borderTopColor')}).show; $('<a href="/wiki/Special:MyPage/wikia.css" data-id="mycss">wikia.css</a></li><a href="/wiki/Special:MyPage/wikia.js" data-id="myjs">wikia.js</a></li><a href="http://c.wikia.com/wiki/Special:MyPage/global.css" data-id="mygcss">Global.css</a></li><a href="http://c.wikia.com/wiki/Special:MyPage/global.js" data-id="mygjs">Global.js</a></li>').insertAfter('.AccountNavigation .subnav li:first'); $('.masthead-info hgroup h2').insertAfter('.masthead-info hgroup h1').css({display: 'inline',paddingLeft: '10px'}).show; $('.UserProfileActionButton').prependTo('.tabs-container').css({margin: '4px 320px 0 0', float: 'right', padding: '0'}).show; if (typeof wgIsEditPage != 'undefined') { $('body').css('padding','3px 0 5px'); $('#WikiaPage').css('margin','-5px auto'); $('.WikiaHeader').css('top','-3px'); $('#WikiaMainContent').css('paddingTop','0'); } });