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: | ||
|      const api = new mw.Api(); |      const api = new mw.Api(); | ||
|      api.get( { |      api.get({ | ||
|        action: 'query', |        action:'query', | ||
|        prop:'revisions',pageids:[pageid],rvlimit:1000 |        prop:['revisions', 'contributors'], | ||
|      }). |       pageids:[pageid], | ||
|       rvlimit:1000 | |||
|      }).then((data) => data | |||
|         .query | |||
|         .pages[pageid] | |||
| new Set(users). |         .revisions | ||
| $(element).append( |         .filter((r) => !r.minor) | ||
|         .map((r)=>r.user) | |||
|     ).then((users) => new Set(users)) | |||
|     .then((users) => { | |||
|       $.when(users.map((user) => api.parse(<nowiki>`{{Nutzerkarte|${user}}}`</nowiki>).then((data) => data.parse.text['*']).fail((ignored)=>null))).then((texts)=> texts.filter((t) => t!==null)).then((t)=>$(element).append(t)); | |||
|      }); |      }); | ||
|    }); |    }); | ||
