Widget:HouseTile

Aus Herrenhäuser
Wechseln zu: Navigation, Suche

<script> var params = {

   action: 'query',
   prop: 'images',
   titles: 'Christinehof',  // Replace this with the desired page title
   format: 'json'

}, api = new mw.Api();

api.get(params).done(function (data) {

   var pages = data.query.pages,
       page, firstImage;
   for (page in pages) {
       // Check if the page has images
       if (pages[page].images && pages[page].images.length > 0) {
           firstImage = pages[page].images[0];  // Get the first image
           console.log(firstImage.title);  // Output the title of the first image
           break;  // Stop after finding the first image
       } else {
           console.log('No images found.');
       }
   }

}); </script>