User:Dross/global.js

// Automated purge confirmation if ( mw.config.get( 'wgAction' ) === 'purge' ) { $('form[action*="action=purge"]').submit; } /*******************/ /*    GADGETS     */ /*******************/ mw.loader.using( ['mediawiki.user', 'mediawiki.util', 'mediawiki.api'], function {

// MoreMenu (Updated 20211111) mw.loader.load('https://meta.wikimedia.org/w/index.php?action=raw&ctype=text/javascript&title=MediaWiki:MoreMenu.import.js');

mw.hook('moremenu.ready').add(function (config) {	MoreMenu.addLink( 'user', 'User rights log', mw.util.getUrl( "Special:Log", {			type: 'rights',			page: "User:" + mw.config.get("wgRelevantUserName"),		}), 'mm-user-user-groups' );	MoreMenu.addLink( 'user', 'Global user rights', mw.util.getUrl( "Special:GlobalUserRights", {			user: mw.config.get("wgRelevantUserName")		}), 'mm-user-uploads' ); });

// Replaces "New section" with "+" mw.loader.load( '//en.wikipedia.org/w/index.php?title=MediaWiki:Gadget-addsection-plus.js&action=raw&ctype=text/javascript' );

// MarkBlocked: Strike usernames that have been blocked mw.loader.load( '//en.wikipedia.org/w/index.php?title=MediaWiki:Gadget-markblocked.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		'🌎' +	'' );

/***************/ /* END GADGETS */ /***************/

// 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-CommunityWishlistSurvey").length ) { mw.centralNotice.hideBanner; }

// Auto-click "OK" on cookie notice because that keeps coming back too $('button[name="disablecookiewarning"]').click;