Creation.js – MediaWiki
Categories:
Categories:
Note: After publishing, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
- Opera: Press Ctrl-F5.
/*****************************************************************************************
* JavaScript here will be loaded by MediaWiki:Common.js when "creation" is detected.
*
*****************************************************************************************/
(function() { // BEGIN WRAPPER
/*****************************************************************************************
* Function adding a UI feature that if used, preloads templates
* helpful during certain page creations.
* Maintainer: BIKI User:Fred Gandt
*/
function offerCreationPreload(pl) {
var cb = document.getElementById("ca-edit"),
cbc = cb.getElementsByTagName("span")[0].cloneNode(true),
cbca = cbc.getElementsByTagName("a")[0];
cbca.removeAttribute("accesskey");
cbca.setAttribute("title", "Preload a " + pl + " guide for this creation");
cbca.setAttribute("href", cbca.getAttribute("href") + "&preload=Template:" + pl + "/preload");
cbca.innerHTML = "Preload (<i style='color:green'>experimental</i>)";
cb.appendChild(cbc);
}
if (mw.config.get("wgCanonicalNamespace") === "Template") {
offerCreationPreload("Template");
} else if (mw.config.get("wgCanonicalNamespace") === "") {
if (mw.config.get("wgTitle").indexOf("BIS fnc ") === 0) {
offerCreationPreload("Function");
} else {
offerCreationPreload("Command");
}
}
/*****************************************************************************************/
/*****************************************************************************************
* Next ***
*/
// code code code
/*****************************************************************************************/
}()); // END WRAPPER