MediaWiki:Interwiki.js
Erscheinungsbild
Hinweis: Leere nach dem Veröffentlichen den Browser-Cache, um die Änderungen sehen zu können.
- Firefox/Safari: Umschalttaste drücken und gleichzeitig Aktualisieren anklicken oder entweder Strg+F5 oder Strg+R (⌘+R auf dem Mac) drücken
- Google Chrome: Umschalttaste+Strg+R (⌘+Umschalttaste+R auf dem Mac) drücken
- Edge: Strg+F5 drücken oder Strg drücken und gleichzeitig Aktualisieren anklicken
/*******************************************************************************************/
/* <pre><nowiki> MediaWiki:Interwiki.js */
/*-----------------------------------------------------------------------------------------*/
/* - show inter language links and other language versions */
/*******************************************************************************************/
function interwikiExtra()
{
var spans = document.getElementsByTagName("span");
for(var i=0; i<spans.length; i++) {
var a = spans[i];
// if found a linkInfo span
if(a.className == "interwiki-info") {
// iterate over all <li>-elements
var count=0;
var lis = document.getElementsByTagName("li");
for (var j=0; j<lis.length; j++) {
var b = lis[j];
if(b.className == "interwiki-" + a.id) {
b.innerHTML = b.innerHTML + " "+a.title;
if(a.title == "(OV)") { b.title = "Originaltext"; }
}
else if(b.className == "interwiki-" + a.id.substr(0,a.id.length-1)) {
count = count+1;
if(a.id.charAt(a.id.length-1) == count) {
b.innerHTML = b.innerHTML + " "+a.title;
}
}
}
}
if(a.className == "AndereVersion") {
p = a.title.indexOf("|");
pvers = document.getElementById("p-version");
if (pvers == null) {
c = document.getElementById("column-one");
c.innerHTML = c.innerHTML
+ "<div class=\"portlet\" id=\"p-version\">"
+ "<h5>Andere Versionen</h5>"
+ "<div class=\"pBody\">"
+ "<ul>"
+ "</ul>"
+ "</div>";
pvers = document.getElementById("p-version");
}
e = pvers.getElementsByTagName("ul")[0];
e.innerHTML = e.innerHTML
+ "<li class=\"\"><a href='"
+ a.title.substr(0,p)
+ "'>" + a.title.substr(p+1,a.title.length-1)+ "</a> " +"</li>"
}
if(a.className == "AnderesFormat") {
p = a.title.indexOf("|");
pvers = document.getElementById("p-format");
if (pvers == null) {
c = document.getElementById("column-one");
c.innerHTML = c.innerHTML
+ "<div class=\"portlet\" id=\"p-format\">"
+ "<h5>Andere Formate</h5>"
+ "<div class=\"pBody\">"
+ "<ul>"
+ "</ul>"
+ "</div>";
pvers = document.getElementById("p-format");
}
e = pvers.getElementsByTagName("ul")[0];
e.innerHTML = e.innerHTML
+ "<li class=\"\"><a href=':"
+ a.title.substr(0,p)
+ "'>" + a.title.substr(p+1,a.title.length-1)+ "</a> " +"</li>"
}
}
}
function BilingualLink()
{
if( document.body.className.substring(0,4) != "ns-0" ) return;
var doc_url = document.URL;
var url = '';
// iterate over all <li>-elements
var lis = document.getElementsByTagName("li");
for (var j=0; j<lis.length; j++) {
var b = lis[j];
if(b.className.substring(0,10) == "interwiki-" ) {
var lang = b.className.substring(10,b.className.length);
if( doc_url.indexOf('?title=') != -1 ) {
var qm = doc_url.indexOf('&match=');
if( qm != -1 ) url = doc_url.substring(0,qm)+"&match="+lang;
else url = doc_url+"&match="+lang;
} else {
var qm = doc_url.indexOf('?');
if( qm != -1 ) url = doc_url.substring(0,qm)+"?match="+lang;
else url = doc_url+"?match="+lang;
}
b.innerHTML = b.innerHTML+
"<a href='"+url+"'> ⇔</a>";
}
}
}
$(interwikiExtra);
$(BilingualLink);
/*******************************************************************************************/
/* </nowiki></pre><noinclude>[[Kategorie:Wikisource:Javascript]]</noinclude> */
/*******************************************************************************************/