MediaWiki:Common.js: Unterschied zwischen den Versionen

Aus MM*Stat

Wechseln zu: Navigation, Suche
Zeile 2: Zeile 2:
  
 
$(function () {
 
$(function () {
   api   = new mw.Api();
+
   api   = new mw.Api();
   pages = api.get( { action: "query", titles: [ "R", "Main Page" ] } )
+
   answer = api.get( { action: "query", titles: [ "R", "Main Page" ] } )
 +
  pages  = answer['query']['pages'];
 
   html  = '';
 
   html  = '';
 
   for (var i = 0; i < pages.length; i++) {
 
   for (var i = 0; i < pages.length; i++) {
  alert(pages[i]);
+
    html += (pages[i]['title'] + '; ');  
 
   }
 
   }
   $('#mw-mywiki-example').html(html);
+
   alert(html);
 
}());
 
}());

Version vom 21. November 2018, 14:16 Uhr

/* Das folgende JavaScript wird für alle Benutzer geladen. */

$(function () {
  api    = new mw.Api();
  answer = api.get( { action: "query", titles: [ "R", "Main Page" ] } )
  pages  = answer['query']['pages'];
  html  = '';
  for (var i = 0; i < pages.length; i++) {
    html += (pages[i]['title'] + '; '); 
  }
  alert(html);
}());