Translation - Μετάφραση

Resources, Technical Assistance and Technology News => Translator resources => Tips on Using Computers => Topic started by: spiros on 04 Oct, 2021, 18:48:15

Title: Back to top links in Mediawiki/Wikipedia
Post by: spiros on 04 Oct, 2021, 18:48:15
Back to top links in Mediawiki/Wikipedia

Back to top and search suggestions on Project:Support desk (https://www.mediawiki.org/wiki/Topic:To8cmrzza2odjp5h)
Wikipedia:Back to top - Wikipedia (https://en.wikipedia.org/wiki/Wikipedia:Back_to_top)

Or, if you have Edit section disabled you can use mw-headline to trigger the event (add in Common.js):

Code: [Select]
( function () {
var elems = document.getElementsByClassName('mw-headline'); // *** NOTE: ClassName may need to be 'mw-editsection' instead
for (i = 0; i < elems.length; i++) {
var span = document.createElement('span');
span.classList.add('ttop');
var link = document.createElement('a');
link.href = '#top';
link.appendChild(document.createTextNode('back to top'));
span.appendChild(document.createTextNode('['));
span.appendChild(link);
span.appendChild(document.createTextNode('] '));
elems[i].insertBefore(span, elems[i].firstChild);
}
});

Since I also added a style, you need to add the following in Common.css to have the text in a small size and right-aligned.

Code: [Select]
span.ttop {
    float: right;
    font-size: small;
}