User:Sophiedp/global.js

/* Alert if global.js loads in chat */ if ( wgCanonicalSpecialPageName == 'Chat' ) { alert('Global.js is loaded in chat!'); }

/* MarkForDeletion */ if (!wgUserGroups.includes('sysop')) { importScriptPage('MediaWiki:MarkForDeletion/code.js', 'dev'); }

/* Cache check settings */ window.topLevelCat = '';

/* Show removed replies */ $(".message-removed.hide").removeClass("hide");

/* FastDelete settings */ var fdButtons = []; fdButtons.push({   'summary': 'Housekeeping',    'label': 'HK' });

/* Anchored rollback */ if (!$('.mw-rollback-link a').length) return; $('.mw-rollback-link a').click(function(e) {	e.preventDefault;	var href = $(this).attr('href');	$.get(href);	$(this).css({'color':'grey','text-decoration':'line-through'}).removeAttr('href title').text('rollbacked'); }); }) (this.jQuery, this.mediaWiki);
 * (function($, mw) {

/* Add paramenters to certian URLs */ //@author-Foodbandlt var url = window.location.href; if (wgPageName == "Special:RecentChanges") { if (url.indexOf("hidebots=") == -1 && url.indexOf("?") == -1) { window.location.href = window.location.href + "?hidebots=0"; } else if (url.indexOf("hidebots=") == -1 && url.indexOf("?") != -1) { window.location.href = window.location.href + "&hidebots=0"; } } else if (wgPageName == "Special:Newwikis") { if (url.indexOf("language=") == -1 && url.indexOf("?") == -1) { window.location.href = window.location.href + "?language=en"; } else if (url.indexOf("language=") == -1 && url.indexOf("?") != -1) { window.location.href = window.location.href + "&language=en"; } }

/* Remove help from the global nav menu */ $('#AccountNavigation > li > ul.subnav > li:has(a[data-id="help"])').remove;

/* Add "Followed pages" to the global nav menu */ $('Followed pages').insertBefore($('.AccountNavigation .subnav li a[data-id="preferences"]').parent);

/* Make the edit sub-menu expand on hover */ $(document.head).append('#WikiHeader nav.wikia-menu-button .drop:hover ~ ul,#WikiHeader nav.wikia-menu-button ul.WikiaMenuElement:hover,#WikiaMainContent nav.wikia-menu-button .drop:hover ~ ul,#WikiaMainContent nav.wikia-menu-button ul.WikiaMenuElement:hover{min-width:100%;display:block;} ');

/* ColoredColors */ //@author-Curiouscrab //Fixed by Dorumin (function {	var isHexCode = function(h) {		var a = parseInt(h, 16);		return (a.toString(16) === h);	};	var tags = document.getElementsByClassName('re0');	if (wgAction == 'view' && wgPageName.split('.')[wgPageName.split('.').length - 1] == 'css') {		for (i = 0; i < tags.length; i++) {			var html = tags[i].innerHTML;			if (html.charAt(0) == '#' && html.length == 7 && isHexCode(html.slice(1).toLowerCase)) {				var brokened = html.split(';');				for (j = 0; j < html.split('#').length - 1; j++) {					if (brokened[j][0] == '#') {						brokened[j] = '' + brokened[j].substring(0, 7) + ' ';					}				}				tags[i].innerHTML = brokened.join(';');			}		}	} });

/* QuickCreateUserPage */ //Modified version of QuickCreateUserPage if (wgCityId !== "621556") { $('', {       id: 'qcup',    }).html('Create user page') .prependTo('.toolbar .tools') .click(function {       $.ajax( { type: 'POST', url: mw.util.wikiScript( 'api' ), dataType: 'json', data: { action: 'edit', title: 'User:Sophiedp', summary: 'Creating user page', text: '', format: 'json', token: mw.user.tokens.get( 'editToken' ) }       } ).done( function ( data ) { if ( data.edit.result === 'Success' ) { window.location.reload; } else { alert('An error occurred.'); }       } ).fail( function ( data ) { alert('An error occurred.'); } );   }); }

//—————————————————————————————— ! ! ! ———————————————————————————————// /* Place imports below this line. Place everything else above this line. */

/* Imports */ $(window).load(function {   importArticles({ type: "script", articles: [ 'u:dev:MediaWiki:CacheCheck/code.js', 'u:dev:MediaWiki:QuoteComments/code.js', 'u:dev:MediaWiki:NoImageLightbox/code.js', 'u:dev:MediaWiki:Rollback/code.js', 'u:dev:MediaWiki:Wikimarks/code.js', 'u:dev:MediaWiki:WallGreetingButton/code.js', 'u:dev:MediaWiki:AjaxUndo/code.js', 'u:dev:MediaWiki:DupImageList/code.js', 'u:dev:MediaWiki:DisplayTimer/code.js', 'u:dev:MediaWiki:FastDelete/code.js', 'u:dev:MediaWiki:Linksweeper/code.js', 'u:dev:MediaWiki:RecentChangesMultiple/code.2.js' ]   }); });