Widget: Homepage: Difference between revisions
From LINKS Community Center
Eschmidt (talk | contribs) No edit summary |
Eschmidt (talk | contribs) No edit summary |
||
Line 108: | Line 108: | ||
var platformQuery = '/api.php?action=ask&format=json&query=' + encodeURIComponent('[[Category:Social media platform]]|?IMAGE'); | var platformQuery = '/api.php?action=ask&format=json&query=' + encodeURIComponent('[[Category:Social media platform]]|?IMAGE'); | ||
var platformResponse = await fetch(platformQuery).then(response => response.json()); | var platformResponse = await fetch(platformQuery).then(response => response.json()); | ||
console.log(platformResponse) | // console.log(platformResponse) | ||
var platformData = Object.getOwnPropertyNames(platformResponse.query.results).map(name => { | var platformData = Object.getOwnPropertyNames(platformResponse.query.results).map(name => { | ||
return { name: name, image: platformResponse.query.results[name].printouts.IMAGE[0].fulltext } | return { name: name, image: platformResponse.query.results[name].printouts.IMAGE[0].fulltext }; | ||
}); | }); | ||
console.log(platformData); | |||
// var urlQuery = platformData.map(platform => { | |||
// var url = '/api.php?action=query&format=json&prop=imageinfo&iiprop=url' | |||
// return | |||
// }) | |||
// console.log(platformData); | |||
var url = '/api.php?action=query&format=json&prop=imageinfo&iiprop=url&titles=' + platformData[0].image | |||
var res = await fetch(url).then(response => response.json()); | |||
console.log(res) | |||
} | } | ||
Revision as of 12:26, 2 June 2022
Development verstion of the DCT Homepage.
Not ready for production!