Difference between revisions of "Widget:DCTList"
From LINKS Community Center
Line 20: | Line 20: | ||
})); | })); | ||
− | + | const imageData = await getImages(sources.map(source => source.image)); | |
− | console.log('img', | + | imageData.forEach(img => { |
+ | sources[sources.findIndex(source => source.image === img.title)].image = img.url; | ||
+ | }) | ||
+ | // console.log('img', imageData) | ||
− | const logoUrlQuery = '/api.php?action=query&format=json&prop=imageinfo&iiprop=url&titles=' + | + | // const logoUrlQuery = '/api.php?action=query&format=json&prop=imageinfo&iiprop=url&titles=' + |
− | + | // 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) | + | // console.log(logoUrlResponse) |
− | Object.getOwnPropertyNames(logoUrlResponse.query.pages).forEach(pageId => { | + | // 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) | console.log(sources) |
Revision as of 15:18, 2 June 2022
Development verstion of the DCT List.
Not ready for production!