MediaWiki:Change-editlink.js

   

Fra Villmark

(Forskjeller mellom versjoner)
Gå til: navigasjon, søk
Admin (Diskusjon | bidrag)
(Ny side: /** * Copyright 2006, Marc Mongenet. Licence GPL et GFDL. * Changed 2009, John Erling Blad * * The function looks for <span class="editsection">, and move them * at the end of their pa…)

Nåværende revisjon fra 22. jul 2009 kl. 23:42

/**
 * Copyright 2006, Marc Mongenet. Licence GPL et GFDL.
 * Changed 2009, John Erling Blad
 *
 * The function looks for <span class="editsection">, and move them
 * at the end of their parent and display them inline in small font.
 * var oldEditsectionLinks=true disables the function.
 */
if (wgIsArticle && wgAction == 'view') {
    addOnloadHook( function () {
        try {
            if (!(typeof oldEditsectionLinks == 'undefined' || oldEditsectionLinks == false)) return;
            var elements= [ 'h2', 'h3', 'h4', 'h5', 'h6' ];
            for (var i in elements) {
                var list = document.getElementsByTagName(elements[i]);
                for(var i=0;i!=list.length;i++) {
                    var span=list[i].firstChild;
                    if (span.className == "editsection") {
                        span.style.fontSize = "x-small";
                        span.style.fontWeight = "normal";
                        span.style.verticalAlign = "5%";
                        span.style.cssFloat = span.style.styleFloat = "none";
                        span.parentNode.appendChild(document.createTextNode(" "));
                        span.parentNode.appendChild(span);
                    }
                }
            }
        }
        catch (e) {
            // just go away without notice 
        }
    });
}
Personlige verktøy