MediaWiki:Gadget-morebits.js: Difference between revisions

Content deleted Content added
Repo at 0d275c4: Fix commentOutImage for multiple files with same params (#1615)
Repo at b92c23d: load RL modules required for previews
Line 4,750:
var query = {
action: 'parse',
prop: ['text', 'modules'],
pst: 'true', // PST = pre-save transform; this makes substitution work properly
preview: true,
text: wikitext,
title: pageTitle || mw.config.get('wgPageName'),
disablelimitreport: true,
disableeditsection: true,
format: 'json'
};
Line 4,766 ⟶ 4,768:
 
var fnRenderSuccess = function(apiobj) {
var htmlresponse = apiobj.getResponse().parse.text;
var html = response.parse.text;
if (!html) {
apiobj.statelem.error('failed to retrieve preview, or template was blanked');
Line 4,772 ⟶ 4,775:
}
previewbox.innerHTML = html;
mw.loader.load(response.parse.modulestyles);
$(previewbox).find('a').attr('target', '_blank'); // this makes links open in new tab
mw.loader.load(response.parse.modules);
 
// this makes links open in new tab
$(previewbox).find('a').attr('target', '_blank'); // this makes links open in new tab
};