Geavaheaddji:Jeblad/lemmatool.js
Fuomáš: Maŋŋel go almmuhat, soaitá leat dárbbašlaš sihkkut neahttalohkkii gaskaráju vai oainnat rievdadusaid.
- Firefox / Safari: Doala Shift dan botta go deattát Reload, dahje deaddil Ctrl-F5 dahje Ctrl-R (⌘-R Mac'as)
- Google Chrome: Deaddil Ctrl-Shift-R (⌘-Shift-R Mac'as)
- Internet Explorer / Edge: Doala Ctrl dan botta go deattát Álggat ođđasit, dahje deaddil Ctrl-F5
- Opera: deaddil Ctrl-F5.
var wgLemmaTool = {
query: { prop: 'text', format: 'json' },
build: function() {
// make sure both exists before we complete
if (!wgLemmaTool.msg || !wgLemmaTool.wiki) return;
$('#bodyContent #editform').before(wgLemmaTool.msg);
if (wgArticleId) $('#bodyContent #editform').before('<div class="prefill-expanded">' + wgLemmaTool.wiki + '</div>');
else $('#bodyContent #editform #wpTextbox1').html(wgLemmaTool.wiki);
},
msg: null,
wiki: null,
params : {}
};
if (0<=wgNamespaceNumber && wgAction == "edit") {
try {
if (typeof($j) == 'undefined') mw.loader.load("//bits.wikimedia.org/skins-1.5/common/jquery.min.js");
addOnloadHook( function() {
var hash = location.hash;
if (hash.length<2) return;
hash = hash.substr(1).split('&');
for (var x in hash) {
var idx = hash[x].indexOf('=');
if (0<=idx) wgLemmaTool.params[hash[x].substr(0, idx)] = hash[x].substr(idx+1);
}
if(!wgLemmaTool.params['expand']) return;
location.replace(location.href.replace(/#.*/, '#'));
var msg = '{{Mediawiki:lemma-' + (wgArticleId ? 'is' : 'empty') + '-article|' + wgTitle + '}}';
$.getJSON(wgScriptPath + "/api.php", jQuery.extend({ action: 'parse', text: msg }, wgLemmaTool.query), function(data, txt) {
var msg = data.parse.text['*'];
wgLemmaTool.msg = msg.substr(0, msg.lastIndexOf('\n\n<!--'));
wgLemmaTool.build();
});
$.getJSON(wgScriptPath + "/api.php", jQuery.extend({ action: 'expandtemplates', text: wgLemmaTool.params['expand'] }, wgLemmaTool.query), function(data, txt) {
wgLemmaTool.wiki = data.expandtemplates['*'];
wgLemmaTool.build();
});
});
}
catch (e) { /* just go away */ }
}