Widget: Homepage: Difference between revisions

From LINKS Community Center
Jump to: navigation, search
Eschmidt (talk | contribs)
No edit summary
Eschmidt (talk | contribs)
No edit summary
Line 109: Line 109:
             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(pName => {
                 return { name: name, image: platformResponse.query.results[name].printouts.IMAGE[0].fulltext.replace('PAGENAME:', '') };
                 return { name: pName, image: platformResponse.query.results[pName].printouts.IMAGE[0].fulltext.replace('PAGENAME:', '') };
             });
             });


             // var urlQuery = platformData.map(platform => {
             var imageUrlQuery = '/api.php?action=query&format=json&prop=imageinfo&iiprop=url&titles=' +  
            //    var url = '/api.php?action=query&format=json&prop=imageinfo&iiprop=url'
                                encodeURIComponent(platformData.map(platform => platform.image).join('|'));
            //    return
             console.log(imageUrlQuery)
            // })
             var res = await fetch(imageUrlQuery).then(response => response.json());
            // console.log(platformData);
            var url = '/api.php?action=query&format=json&prop=imageinfo&iiprop=url&titles=' + encodeURIComponent( platformData[0].image);
             console.log(url)
             var res = await fetch(url).then(response => response.json());
             console.log(res)
             console.log(res)
         }
         }

Revision as of 12:37, 2 June 2022

Development verstion of the DCT Homepage.
Not ready for production!