MediaWiki:Common.js: Difference between revisions
No edit summary Tag: Reverted |
No edit summary Tag: Reverted |
||
| Line 1: | Line 1: | ||
mw.loader.using(['mediawiki.api']).then(function () { | |||
var box = document.getElementById('random-teaser'); | |||
if (!box) { console.warn('[teaser] #random-teaser not found'); return; } | |||
box.textContent = 'JS loaded, calling API…'; | |||
new mw.Api().get({ action: 'query', meta: 'siteinfo', formatversion: 2 }) | |||
.then(function(){ box.textContent = 'API OK — teaser will load next…'; }) | |||
.catch(function(e){ box.textContent = 'API error: ' + e; console.error(e); }); | |||
}); | |||
/* Any JavaScript here will be loaded for all users on every page load. */ | /* Any JavaScript here will be loaded for all users on every page load. */ | ||