User:Dross/global.js

// Automated purge confirmation if ( mw.config.get( 'wgAction' ) === 'purge' ) { $('form[action*="action=purge"]').submit; }

// Gadgets mw.loader.load( '//meta.miraheze.org/w/index.php?title=User:Dross/gadgets.js&action=raw&ctype=text/javascript' );

/* NOTE: Relative URLs will load on a per-wiki basis. */

// Link to my CentralAuth $('li#pt-userpage').after( 	'' + //Line breaks bc one line HTML is a peeve of mine		'🌎' +	'' );

// Toolbox links mw.loader.load( '//meta.miraheze.org/w/index.php?title=User:Dross/links.js&action=raw&ctype=text/javascript' );

// Clean up deleted wiki links displaying as "miraheze.org" in CentralAuth (T5631 marked WONTFIX) if ( mw.config.get( 'wgCanonicalSpecialPageName' ) === 'CentralAuth' ) { $( 'a[href^="https://miraheze.org/wiki/User:"]' ).parent.parent.remove; // I don't think I need to target the element more clearly, but we'll see }

// Version of Meta Wikimedia CentralAuth Interlink Fixer pared down to just log link fixes function fixCrosswikiLinks { $('body li a').each(function {			var bits, wiki, user, hostName,				$el = $(this),				txt = $el.text;			if (txt.indexOf('@') !== -1 && txt.indexOf('/') === -1 && /^User\:/i.test(txt)) {				bits = txt.split('@');				user = bits.shift.replace(/^\s*User:(.+)\s*$/g, '$1');				wiki = bits.join('@');				if (wiki === 'global') {					$el.attr('href', mw.config.get('wgScript') + '?title=Special:CentralAuth&target=' + encodeURIComponent(user));				} else {					hostName = host(wiki);					if (hostName) {						$el.attr('href', '//' + hostName + '/wiki/User:' + encodeURIComponent(user));					}				}				if (wiki !== 'metawiki') {					$el.removeClass('new external').addClass('extiw');				}				$el.attr('title', txt);			}		}); }

if (mw.config.get('wgCanonicalSpecialPageName') === 'Log' || mw.config.get('wgCanonicalSpecialPageName') === 'Recentchanges') { mw.hook('wikipage.content').add(fixCrosswikiLinks); } fixCrosswikiLinks;

// Make CentralNotice go away because apparently cookies don't take care of it globally (or even locally) if ( $("div.cn-DP_RfC").length ) { mw.centralNotice.hideBanner; }