Widget:Autorenbox: Unterschied zwischen den Versionen
Aus ZUM-Unterrichten
| KKeine Bearbeitungszusammenfassung Markierung: 2017-Quelltext-Bearbeitung | KKeine Bearbeitungszusammenfassung Markierung: 2017-Quelltext-Bearbeitung | ||
| Zeile 9: | Zeile 9: | ||
| <script type="text/javascript"> | <script type="text/javascript"> | ||
| (function(){ | (function(){ | ||
| const paramArtikel = "<!--{$artikel|escape:'javascript'}-->"||null; | |||
| const kategorieArtikel = "<!--{$kategorie|escape:'javascript'}-->"||null; | |||
| const element = document.currentScript && document.currentScript.previousElementSibling; | const element = document.currentScript && document.currentScript.previousElementSibling; | ||
| if(element){ | if(element){ | ||
| Zeile 23: | Zeile 26: | ||
| .   const query = kategorieArtikel ? { | |||
|       action:'query', | |||
|       indexpageids: 1, | |||
|       prop:['revisions', 'contributors', 'info'], | |||
|       generator: categorymembers, | |||
|       gcmtitle: `Kategorie:${category}`, | |||
|       gcmnamespace:0, | |||
|       gcmtype: 'page', | |||
|       gcmlimit: 500 | |||
|       rvlimit:1000 | |||
|      } : { | |||
|        action:'query', |        action:'query', | ||
|        indexpageids: 1, |        indexpageids: 1, | ||
|        prop:['revisions', 'contributors', 'info'], |        prop:['revisions', 'contributors', 'info'], | ||
|        titles: |        titles: paramArtikel || getCurrentTitle(); | ||
|        rvlimit:1000 |        rvlimit:1000 | ||
| }; | |||
|      const response = api.get(query); | |||
|      response.then((data) => { |      response.then((data) => { | ||
|     //TODO continuation handling | |||
|        if (data.query.pageids[0] === "-1") { |        if (data.query.pageids[0] === "-1") { | ||
|          return; |          return; | ||
