MediaWiki:Common.js: Unterschied zwischen den Versionen
Aus MM*Stat
Keine Bearbeitungszusammenfassung |
Keine Bearbeitungszusammenfassung |
||
Zeile 3: | Zeile 3: | ||
$(function () { | $(function () { | ||
if (document.getElementById('sk-subpagetoc')) { | if (document.getElementById('sk-subpagetoc')) { | ||
answer = new mw.Api().get( { action: "query", titles: [ page+"/R", page+"/Hauptseite" ] } ).done( | answer = new mw.Api().get( { action: "query", titles: [ page+"/R", page+"/Hauptseite" ] } ).done( | ||
function ( result ) { | function ( result ) { | ||
Zeile 13: | Zeile 11: | ||
if (!('missing' in pages[keys[i]])) { | if (!('missing' in pages[keys[i]])) { | ||
title = pages[keys[i]].title.substring(1+page.length); | title = pages[keys[i]].title.substring(1+page.length); | ||
nonmissing.push(title); | nonmissing.push({title = title, url = pages[keys[i]].title} ); | ||
} | } | ||
} | } | ||
if (nonmissing.length) { | if (nonmissing.length) { | ||
document.getElementById('sk-subpagetoc').innerHTML = html; | document.getElementById('sk-subpagetoc').innerHTML = html; | ||
} | } |
Version vom 22. November 2018, 07:42 Uhr
/* Das folgende JavaScript wird für alle Benutzer geladen. */
$(function () {
if (document.getElementById('sk-subpagetoc')) {
answer = new mw.Api().get( { action: "query", titles: [ page+"/R", page+"/Hauptseite" ] } ).done(
function ( result ) {
nonmissing = [];
pages = result.query.pages;
keys = Object.keys(pages);
for (i = 0; i<keys.length; i++) {
if (!('missing' in pages[keys[i]])) {
title = pages[keys[i]].title.substring(1+page.length);
nonmissing.push({title = title, url = pages[keys[i]].title} );
}
}
if (nonmissing.length) {
document.getElementById('sk-subpagetoc').innerHTML = html;
}
}
);
}
}());