User:Dto/monobook.js/dto
From Wikipedia, the free encyclopedia
< User:Dto | monobook.js
/* By User:Dto. */
/*
*/
var dto = new Object();
dto.addEditButton = function(button) {
var b = document.getElementById("wpDiff");
if(!b)
return false;
while(b.nextSibling.nodeName.toLowerCase() == "input")
b = b.nextSibling;
if(!b.nextSibling)
b.parentNode.appendChild(button);
else
b.parentNode.insertBefore(button, b.nextSibling);
return true;
};
dto.makeButton = function(bId, bValue, clickhandler) {
var b = document.createElement("input");
b.setAttribute("type", "button");
b.setAttribute("id", bId);
b.setAttribute("name", bId);
b.setAttribute("value", bValue);
b.onclick = clickhandler;
return b;
};
dto.feelingLucky = function() {
var txt = document.getElementById("wpTextbox1");
txt.value = txt.value.replace(/Link \(The Legend of Zelda series\)/g, "Link (The Legend of Zelda)");
txt.value = txt.value.replace(/Link \(Legend of Zelda\)/g, "Link (The Legend of Zelda)");
//document.getElementById("wpMinoredit").checked = true;
//document.getElementById("wpWatchthis").checked = false;
//var s = document.getElementById("wpSummary");
//if(s.value.indexOf("bypass redirects") < 0)
// s.value += "bypass redirects";
}
dto.onLoad = function() {
if(document.getElementById("wpTextbox1"))
dto.addEditButton(dto.makeButton("dtofeelingluckyenwp", "I'm Feeling Lucky", dto.feelinklucky));
};
hookEvent("load", dto.onLoad);
/*
*/

