Widget: DCTList: Difference between revisions
From LINKS Community Center
Eschmidt (talk | contribs) No edit summary |
Eschmidt (talk | contribs) No edit summary |
||
Line 2: | Line 2: | ||
<includeonly> | <includeonly> | ||
<script> | <script> | ||
async function getImages(imageTitles) { | |||
const imageUrlQuery = '/api.php?action=query&format=json&prop=imageinfo&iiprop=url&titles=' + | |||
encodeURIComponent(imageTitles.join('|')); | |||
const imageUrlResponse = await fetch(imageUrlQuery).then(response => response.json()); | |||
} | |||
async function getSources() { | async function getSources() { | ||
const sourceQuery = '/api.php?action=ask&format=json&query=' + encodeURIComponent('[[Category:Social media platform]]|?IMAGE'); | const sourceQuery = '/api.php?action=ask&format=json&query=' + encodeURIComponent('[[Category:Social media platform]]|?IMAGE'); | ||
Line 14: | Line 20: | ||
encodeURIComponent(sources.map(source => source.image).join('|')); | encodeURIComponent(sources.map(source => source.image).join('|')); | ||
const logoUrlResponse = await fetch(logoUrlQuery).then(response => response.json()); | const logoUrlResponse = await fetch(logoUrlQuery).then(response => response.json()); | ||
console.log(logoUrlResponse) | |||
Object.getOwnPropertyNames(logoUrlResponse.query.pages).forEach(pageId => { | Object.getOwnPropertyNames(logoUrlResponse.query.pages).forEach(pageId => { |
Revision as of 14:02, 2 June 2022
Development verstion of the DCT List.
Not ready for production!