MediaWiki:Gadget-TurnBackAnchors.js
Vai alla navigazione
Vai alla ricerca
Nota: Dopo aver salvato le preferenze, perché i cambi abbiano effetto, devi bypassare la cache del tuo browser. Mozilla / Firefox / Safari: tieni premuto Shift mentre clicchi Reload, o premi Ctrl-Shift-R (Cmd-Shift-R per Apple Mac); Google Chrome: premi Ctrl o Shift mentre clicchi F5; IE: premi Ctrl mentre clicchi Refresh, o premi Ctrl-F5; Konqueror:: clicca semplicemente il pulsante di Reload, o premi F5; se usi Opera devi cancellare completamente la chache nel menu Tools→Preferences.
/**
* 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)
);
};
mw.loader.using('mediawiki.util', window.turnBackAnchors.init);