User:SADIQUI/global.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)
- Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
- Opera: Press Ctrl-F5.
// 1. RTL
mw.loader.load('//meta.wikimedia.org/w/index.php?title=User:SADIQUI/rtl.js&action=raw&ctype=text/javascript');
// 2. Name Script
mw.loader.load( '//www.wikidata.org/w/index.php?title=User:Harmonia_Amanda/namescript.js&action=raw&ctype=text/javascript' );
// 3. JWB
mw.loader.load('//en.wikipedia.org/w/index.php?title=User:Joeytje50/JWB.js/load.js&action=raw&ctype=text/javascript');
// 4. A user editcount at the top
$(document).ready( function () {
mw.loader.using( 'mediawiki.user', function() {
( new mw.Api() ).get( {
action: 'query',
meta: 'userinfo',
uiprop: 'editcount'
} ).done( function( result ) {
document.getElementById( 'pt-mycontris' ).append( ' (' + result.query.userinfo.editcount + ')' );
} );
} );
} );
// 5. AjaxEdit
mw.loader.load('https://en.wiktionary.org/w/index.php?action=raw&ctype=text/javascript&title=MediaWiki:Gadget-AjaxEdit.js&action=raw&ctype=text/javascript');
// 6. Nightpedia
mw.loader.load('https://en.wikipedia.org/w/index.php?action=raw&ctype=text/javascript&title=User:MusikAnimal/nightpedia.js');
// 7. PurgeClock at the top bar
// from //www.mediawiki.org/wiki/MediaWiki:Gadget-UTCLiveClock.js
// mod: set UTC+1, fontsize:100% instead of 120%
mw.loader.using( ['mediawiki.util', 'mediawiki.api'] ).then( function () {
function padWithZeroes( num ) {
return num < 10 ? '0' + num.toString() : num.toString();
}
function showTime( $target ) {
var now = new Date();
// Set the time UTC+01:00
var hh = now.getUTCHours()+1;
var mm = now.getUTCMinutes();
var ss = now.getUTCSeconds();
var time = padWithZeroes( hh ) + ':' + padWithZeroes( mm ) + ':' + padWithZeroes( ss );
$target.text( time );
var ms = now.getUTCMilliseconds();
setTimeout( function () {
showTime( $target );
}, 1100 - ms );
}
function liveClock() {
mw.util.addCSS( '#utcdate a { font-weight:bolder; }' );
$( '.client-js > body.skin-vector #p-personal ul' ).css( 'margin-right', 'initial' );
$( '.client-js > body.skin-monobook #p-personal ul' ).css( 'margin-right', 'initial' );
var node = mw.util.addPortletLink(
'p-personal',
mw.util.getUrl( null, { action: 'purge' } ),
'',
'utcdate'
);
if ( !node ) {
return;
}
$( node ).on( 'click', function ( e ) {
new mw.Api().post( { action: 'purge', titles: mw.config.get( 'wgPageName' ) } ).then( function () {
location.reload();
}, function () {
mw.notify( 'Purge failed', { type: 'error' } );
} );
e.preventDefault();
} );
showTime( $( node ).find( 'a:first' ) );
}
$( liveClock );
} );