User:DarkArchonoss/monobook.js

//---

// ============= test-n.js ============== function tnaddlilink(url, name) { var na = document.createElement('a'); na.setAttribute('href', url);

var txt = document.createTextNode(name); na.appendChild(txt);

var li = document.createElement('li'); li.appendChild(na); return li; }

function replacetxt { var undefined; i = 1; var original = document.editform.wpTextbox1.value; what = prompt("What text do you want to replace?"); if (what == ''){alert("Invalid command."); return;} else if (what == 'null'){alert("Action cancelled."); return;} else { withw = prompt("With what?"); if (withw == 'null'){alert("Action cancelled."); return;} else if (withw == ''){alert("All such appearances of text will be removed.");} else if (withw.split(what)[1] != undefined) {alert("Action cancelled to avoid infinite loop."); return;} else { if (document.editform.wpTextbox1.value.split(what)[1] != undefined) { while (i == 1) { document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.replace(what, withw); if (document.editform.wpTextbox1.value.split(what)[1] != undefined) {i = 1;} else {i = -1;} } } document.editform.wpSummary.value += 'JS: Replacing text "' + what + '" with "' + withw + '" '; } } }

//END //--- //Auto-replace addOnloadHook(replacetab); function replacetab { var c1 = document.getElementById('column-one'); var tabs = c1.getElementsByTagName('div')[0].getElementsByTagName('ul')[0]; if (document.title.indexOf("Editing ") != -1) {   tabs.appendChild(tnaddlilink('javascript:replacetxt',"replace")); } tabs.appendChild(tnaddlilink('javascript:monourl',"Monobook")); tabs.appendChild(tnaddlilink('javascript:purgepage',"Purge")); } //END //--- function monourl { location.href="http://en.wikipedia.org/wiki/User:DarkArchonoss/monobook.js"; } function purgepage { location.href = location.href + "&action=purge"; }