Tech, emailconfirmed, Administrators (Semantic MediaWiki), Curators (Semantic MediaWiki), Administrators
12,451
edits
Bongolium500 (talk | contribs) No edit summary |
Bongolium500 (talk | contribs) No edit summary |
||
Line 21: | Line 21: | ||
var csLoader = $(this).children(".csl")[0]; | var csLoader = $(this).children(".csl")[0]; | ||
var json = $(csLoader).children(".csd")[0].innerHTML; | var json = $(csLoader).children(".csd")[0].innerHTML; | ||
var storedText; | |||
if (storedText) { | |||
csLoader.innerHTML = storedText; | |||
var | |||
csLoader.innerHTML = | |||
$(csLoader).removeClass("csl"); | $(csLoader).removeClass("csl"); | ||
sessionStorage.setItem('CS-' + json, citationText); | } else { | ||
var params = { | |||
action: 'parse', | |||
text: '{{#invoke:cite source|generateCollapsibleTextFromJSON|' + json + ' }}', | |||
format: 'json' | |||
}; | |||
var api = new mw.Api(); | |||
api.get(params).done(function(data) { | |||
var response = $(data.parse.text['*']); | |||
var citationText = $(response).children("p")[0].innerHTML; | |||
csLoader.innerHTML = citationText; | |||
$(csLoader).removeClass("csl"); | |||
sessionStorage.setItem('CS-' + json, citationText); | |||
}); | |||
} | |||
} | } | ||
}); | }); |
edits