User:Edoderoo/vector.js
Appearance
Code that you insert on this page could contain malicious content capable of compromising your account. If you import a script from another page with "importScript", "mw.loader.load", "iusc", or "lusc", take note that this causes you to dynamically load a remote script, which could be changed by others. Editors are responsible for all edits and actions they perform, including by scripts. User scripts are not centrally supported and may malfunction or become inoperable due to software changes. A guide to help you find broken scripts is available. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. This code will be executed when previewing this page. |
The accompanying .css page for this skin is at User:Edoderoo/vector.css. |
//------------------------------------------------------------------------------------
// Script plaatst interwiki's naar grotere Wikipedia's indien aanwezig bovenaan
// (Duits, Engels, Frans, Italiaans, Portugees, Spaans, Fins, Noors, Pools en Zweeds)
// Tevens enkele aan het Nederlands verwante talen
// (Afrikaans, Fries, Limburgs, Nedersaksisch, West-Vlaams en Zeeuws)
//
// Based on script found on [[:nn:MediaWiki/monobook.js]]
// Maintainers: [[:no:User:Jeblad]], fix voor nl: [[nl:User:Zanaq]]
//
// Indien andere talen gewenst het script kopiëren en de talen achter prefs= aanpassen
// Voeg de code importScript('Gebruiker:Troefkaart/interwiki.js'); toe aan monobook.js
// Vervang Troefkaart door eigen naam bij kopiëren gehele code
//
// Door bv li.interwiki-de, li.interwiki-en { font-weight: bold; } in het monobook.css
// te plaatsen worden interwiki's naar aangegeven talen vet gemaakt.
// Werkt ook zonder dit script
//------------------------------------------------------------------------------------
addOnloadHook( function () {
//if (!prefs) return;
prefs=["nl", "de", "en", "fr", "it", "pl", "pt", "sv", "es"]
var iwlinks = [];
for (i=0;i<prefs.length;i++) {
iwlinks["interwiki-" + prefs[i]] = 1;
}
var container = document.getElementById("p-lang");
if (!container) return;
var keeps = Array();
var ul = container.getElementsByTagName("ul");
if (!ul) return;
if (ul.length != 1) return;
ul = ul[0];
var childs = container.getElementsByTagName("li");
for (i=0;i<childs.length;i++) {
// the following test fails if there are several classes for the actual child
if ( iwlinks[ childs[i].getAttribute( 'class' ) ] ) {
keeps.push(childs[i]);
}
}
var n = childs.length;
for (i=childs.length-1;i>=0;i--) {
if ( !iwlinks[ childs[i].getAttribute( 'class' ) ] ) {
keeps[--n] = childs[i];
}
else {
childs[i].setAttribute( 'class', childs[i].getAttribute( 'class' ) + ' iw-focus' );
}
}
var child;
while (child = ul.firstChild) {
ul.removeChild(child);
}
for (i=0;i<keeps.length;i++) {
ul.appendChild(keeps[i]);
}
});
importScript(':nl:Gebruiker:Michielderoo/interwiki-translate-nl.js');
importScript(':nl:Gebruiker:Edoderoo/interwiki.js');