MediaWiki:Common.js: Unterschied zwischen den Versionen

Aus MM*Stat

Wechseln zu: Navigation, Suche
Zeile 15: Zeile 15:
 
         }
 
         }
 
         if (nonmissing.length) {
 
         if (nonmissing.length) {
 
+
          toc = document.getElementById('toc');
 +
alert(toc.toSource());
 
           document.getElementById('sk-subpagetoc').innerHTML = html;
 
           document.getElementById('sk-subpagetoc').innerHTML = html;
 
         }
 
         }

Version vom 22. November 2018, 07:47 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) {
          toc = document.getElementById('toc');
alert(toc.toSource());
          document.getElementById('sk-subpagetoc').innerHTML = html;
        }
      }
    );
  }
}());