Widget: Homepage: Difference between revisions
From LINKS Community Center
Eschmidt (talk | contribs) No edit summary |
Eschmidt (talk | contribs) No edit summary |
||
Line 114: | Line 114: | ||
})); | })); | ||
const logoUrlQuery = '/api.php?action=query&format=json&prop=imageinfo&iiprop=url&titles=' + | |||
encodeURIComponent(sources.map(source => source.image).join('|')); | encodeURIComponent(sources.map(source => source.image).join('|')); | ||
const logoUrlResponse = await fetch(logoUrlQuery).then(response => response.json()); | |||
Object.getOwnPropertyNames(logoUrlResponse.query.pages).forEach(pageId => { | |||
const logoFileName = logoUrlResponse.query.pages[pageId].title; | |||
const logoUrl = logoUrlResponse.query.pages[pageId].imageinfo[0].url; | |||
sources[sources.findIndex(source => source.image === logoFileName)].image = logoUrl; | |||
}); | |||
console.log(sources) | |||
} | } | ||
Revision as of 13:18, 2 June 2022
Development verstion of the DCT Homepage.
Not ready for production!