// Requires: [[User:Mike Dillon/Scripts/easydom.js]], [[User:Mike Dillon/Scripts/i18n.js]]
/* <pre><nowiki> */
var preloadNewArticleOptions;
/* Message */
wfAddMsg("en", "preloadNewArticleLabel", "Article template");
wfAddMsg("en", "preloadNewArticleButtonText", "Preload article template");
addOnloadHook(function () {
if (preloadNewArticleOptions == null) return;
var newarticletext = document.getElementById("newarticletext");
if (!newarticletext) return;
with (easyDom) {
var preloadSelect = select({ name: "preload" });
for (var label in preloadNewArticleOptions) {
var template = preloadNewArticleOptions[label];
preloadSelect.appendChild(option({ value: template }, label));
}
if (preloadSelect.childNodes.length == 0) {
return;
}
newarticletext.appendChild(hr());
newarticletext.appendChild(form(
{ method: "GET", action: wgScriptPath + "/index.php" },
input({ type: "hidden", name: "title", value: wgPageName }),
input({ type: "hidden", name: "action", value: "edit" }),
div(strong(wfMsg("preloadNewArticleLabel"), ": "), preloadSelect, " ",
input({ type: "submit", value: wfMsg("preloadNewArticleButtonText") }))
));
}
});
/* </nowiki></pre> */