User:J.delanoy/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.
// Link in top menu for logs
$(function() {
url = mw.config.get('wgServer') + "/w/index.php?title=Special:Log&user=J.delanoy";
mw.util.addPortletLink("p-personal", url, "logs", "pt-logs");
});
// Link in toolbox for deleted edits
$(function() {
if ( mw.config.get('wgCanonicalNamespace') == "Special" )
return; // don't display link for special pages
url = mw.config.get('wgServer') + "/w/index.php?title=Special:Undelete/" + encodeURIComponent(mw.config.get('wgPageName'));
mw.util.addPortletLink("p-tb", url, "Deleted edits", "pt-undelete");
});
// Clock
$(function liveClock() {
liveClock.node = mw.util.addPortletLink( 'p-personal', mw.config.get('wgServer') + mw.config.get('wgScriptPath') + '/index.php?title=' + encodeURIComponent(mw.config.get('wgPageName')) + '&action=purge', '', 'utcdate' );
liveClock.node.style.fontSize = 'larger';
liveClock.node.style.fontWeight = 'bolder';
showTime();
});
function showTime() {
var dateNode = liveClock.node;
if( !dateNode ) {
return;
}
var now = new Date();
var hh = now.getUTCHours();
var mm = now.getUTCMinutes();
var ss = now.getUTCSeconds();
var time = ( hh < 10 ? '0' + hh : hh ) + ':' + ( mm < 10 ? '0' + mm : mm ) + ':' + ( ss < 10 ? '0' + ss : ss );
dateNode.firstChild.replaceChild( document.createTextNode( time ), dateNode.firstChild.firstChild );
window.setTimeout(showTime, 1000);
}
// Page logs link in toolbox
$(function() {
if ( mw.config.get('wgCanonicalNamespace') == "Special" )
return; // don't display link for special pages
url = mw.config.get('wgServer') + "/w/index.php?title=Special:Log&page=" + encodeURIComponent(mw.config.get('wgPageName'));
mw.util.addPortletLink("p-tb", url, "Page logs", "pt-logs");
});
/**
* Ajax sysop
* @see https://meta.wikimedia.org/wiki/Ajax_sysop
* @update-token [[File:pathoschild/ajaxsysop.js]]
*/
mw.loader.load('//tools-static.wmflabs.org/meta/scripts/pathoschild.ajaxsysop.js');