MediaWiki:Gadget-morebits.js: Difference between revisions
Content deleted Content added
MusikAnimal (talk | contribs) Repo at 66e1c54: various bug fixes, localization features |
MusikAnimal (talk | contribs) Repo at dd76177: read discretionary sanctions information from a wiki page (#1479) |
||
Line 2,470:
}
};
/** Retrieves wikitext from a page. Caching enabled, duration 1 day. */
Morebits.wiki.getCachedJson = function(title) {
var query = {
action: 'query',
prop: 'revisions',
titles: title,
rvslots: '*',
rvprop: 'content',
format: 'json',
smaxage: '86400', // cache for 1 day
maxage: '86400' // cache for 1 day
};
return new Morebits.wiki.api('', query).post().then(function(apiobj) {
apiobj.getStatusElement().unlink();
var response = apiobj.getResponse();
var wikitext = response.query.pages[0].revisions[0].slots.main.content;
return JSON.parse(wikitext);
});
};
|