MediaWiki:Gadget-TurnBackAnchors.js
Nota: dopo aver pubblicato, potrebbe essere necessario pulire la cache del proprio browser per vedere i cambiamenti.
- Firefox / Safari: tieni premuto il tasto delle maiuscole Shift e fai clic su Ricarica, oppure premi Ctrl-F5 o Ctrl-R (⌘-R su Mac)
- Google Chrome: premi Ctrl-Shift-R (⌘-Shift-R su un Mac)
- Internet Explorer / Edge: tieni premuto il tasto Ctrl e fai clic su Aggiorna, oppure premi Ctrl-F5
- Opera: premi Ctrl-F5.
/**
* For people without access to the home key :)
*
* @license [[WFTPL]] COMING WITH ABSOLUTELY NO WARRANTY
* @author [[Utente:Valerio Bozzolan]] and history contributors
*/
window.turnBackAnchors = {};
window.turnBackAnchors.opts = {
prependMsg: '[Vai giù ↓]',
appendMsg: '[Torna su ↑]',
append: true,
prepend: true
};
window.turnBackAnchors.init = function () {
var ns = mw.config.get('wgNamespaceNumber');
if(ns === -1 || ns % 2 === 0) {
return; // Discussions are even
}
function $anchor( href, msg ) {
return $('<div>').css('text-align', 'right').append(
$('<a>').attr('href', href)
.html( msg )
);
}
var $content = $('#bodyContent');
var opts = window.turnBackAnchors.opts;
opts.append && $content.append(
$anchor('#', opts.appendMsg)
);
opts.prepend && $content.prepend(
$anchor('#footer', opts.prependMsg)
);
};
window.turnBackAnchors.init();