User:OrbFu/global.js

if (wgPageName == "User:OrbFu/Sandbox") { var fileref=document.createElement('script'); fileref.setAttribute("type","text/javascript"); fileref.setAttribute("src", "http://funorb.wikia.com/index.php?title=User:OrbFu/DACalc.js&action=raw&ctype=text/javascript"); document.getElementsByTagName("head")[0].appendChild(fileref); }

function fowAchTableSort { var results = document.evaluate("id('Ach_OrderHeader')/a", document, null, XPathResult.ANY_TYPE, null); var aResult; if (aResult = results.iterateNext) { aResult.onclick; return aResult; } return null; }

function fowAchTableSortSetup { var aResult = fowAchTableSort; if (aResult) { var tbl = aResult; while (tbl.nodeName.toLowerCase != "table") { tbl = tbl.parentNode; if (tbl == null) return; }   var p = document.createElement('p'); p.appendChild(document.createTextNode('[')); var btn = document.createElement('a'); btn.setAttribute("onclick", "fowAchTableSort;return false;"); btn.setAttribute("href", "#"); btn.appendChild(document.createTextNode("Default order")); p.appendChild(btn); p.appendChild(document.createTextNode(']')); tbl.parentNode.insertBefore(p, tbl); } } addOnloadHook(fowAchTableSortSetup);