User:Elton/common.js
(Redirected from User:Defender/common.js)
Note: After publishing, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5.
( function ( mw, $ ) {
'use strict';
function loadLinks() {
var entries = $( 'a[title^="Special:CentralAuth"]' );
if ( !entries.length ) return;
mw.loader.using( 'mediawiki.api' ).done( function() {
var api = new mw.Api();
entries.each( function ( _, el ) {
var username = $( el ).parent().find( '>:first-child' ).text();
api.get( {
action: 'query',
meta: 'globaluserinfo',
guiuser: username,
guiprop: 'merged'
} ).done( function( data ) {
var home = data.query.globaluserinfo.home;
var merged = data.query.globaluserinfo.merged;
for ( var i in merged ) {
if ( merged[ i ].wiki === home ) {
var page = '/wiki/Special:Contribs/' + username;
var $a = $( '<a>' )
.attr( 'href', merged[ i ].url + page )
.text( 'contribs' );
$( el ).after( ' • ', $a );
break;
}
}
} );
} );
} );
}
$( function () {
if ( mw.config.get( 'wgPageName' ) === 'Steward_requests/Global' ) {
loadLinks();
} else if (
mw.config.get('wgCanonicalNamespace') === 'Special' &&
mw.config.get('wgCanonicalSpecialPageName') == 'GlobalBlock' &&
!$( 'input[name=wpExpiry-other]' ).val()
) {
$( 'select[name=wpExpiry]' ).val( '1 month' ).change();
$( 'select[name=wpReason]' ).prop( 'selectedIndex', 7 ).change();
$( 'input[name=wpAlsoLocal]' ).trigger( 'click' );
$( 'input[name=wpAlsoLocalTalk]' ).prop( 'checked', true );
$( 'input[name=wpAlsoLocalEmail]' ).prop( 'checked', true );
$( 'input[name=wpAlsoLocalSoft]' ).prop( 'checked', false );
}
} );
}( mediaWiki, jQuery ) );
// [[User:TheresNoTime/stewResponseHelper]]
mw.loader.load('//meta.wikimedia.org/w/index.php?title=User:TheresNoTime/stewResponseHelper.js&oldid=27247813&action=raw&ctype=text/javascript');