User:Whiteknight/per book/User:Whiteknight.js
From Wikibooks, open books for an open world
Note: After saving, changes may not occur immediately. Click here to learn how to bypass your browser's cache.
- Mozilla / Firefox / Safari: hold down Shift while clicking Reload, or press Ctrl-Shift-R (Cmd-Shift-R on Apple Mac);
- Internet Explorer: hold Ctrl while clicking Refresh, or press Ctrl-F5;
- Konqueror: simply click the Reload button, or press F5;
- Opera users may need to completely clear their cache in Tools→Preferences.
| Code that you insert on this page could contain malicious content capable of compromising your account. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate reading room. The code will be executed when previewing this page under some skins, including Monobook. |
|
|
Documentation for this script can be added at User:Whiteknight/per book/User:Whiteknight. This script seems to have an accompanying .css page at User:Whiteknight/per book/User:Whiteknight.css. |
//<pre>javascripts that I only load for pages in my own personal namespace function wk_import_script(name) { name = encodeURIComponent(name.replace(/ /g, '_' )); var scriptElem = document.createElement('script'); scriptElem.setAttribute('type', 'text/javascript'); scriptElem.setAttribute('src', '/w/index.php?title=' + name + '&action=raw&ctype=text/javascript'); document.getElementsByTagName('head')[0].appendChild(scriptElem); } wk_import_script('User:Whiteknight/pagetester.js'); wk_import_script('User:Whiteknight/graph.js'); if(wgPageName == "User:Whiteknight") addOnloadHook(function() { var stat; if(stat = document.getElementById("WK_Status_Span")) { a = document.createElement("a"); a.href = "javascript:WKChangeStatus();"; a.innerHTML = "Change"; b = document.createElement("a"); b.href = "javascript:WKDeleteStatus();"; b.innerHTML = "Remove"; wk.appendChildren(stat, ["[", a, "][", b, "]"]); } }); function WKChangeStatus() { var span = document.getElementById("WK_Status_Span_2"); var stat = prompt("New Status:", (span == null)?(""):(span.innerHTML)); if(stat != "" && stat != null) { wk.postEdit("User:Whiteknight/Stat", stat, "updating status", null); if(span != null) { span.innerHTML = stat; wk.toggleDisplay(span, "block"); } else { span = document.createElement("div"); span.setAttribute("class", "PrettyTextBox"); span.setAttribute("id", "WK_Status_Span_2"); span.style.textAlign = "center"; span.innerHTML = stat; var shell = document.getElementById("WK_Status_Span"); shell.appendChild(span); } } } function WKDeleteStatus() { if(confirm("Do you want to delete your status?")) { wk.postEdit("User:Whiteknight/Stat", "", "removing status message", null); wk.toggleDisplay("WK_Status_Span_2", "none"); } } //</pre>