User:Hinoa/monobook.js

//

// ================================================================= // onload // =================================================================

// change favicon.ico

//document.write('')

document.write(' ');

document.write(' ');

// My thefting of Keitei's thefting of Interiot's Edit Counter Tool, direct from en.wp document.write(' ');

// functions to run when the document loads

window.onload = Main; function Main { //   deletionPresets; addactions; //   changeactions; addtoolbox; changetoolbox; addnavbox; changenavbox; addpersonal; changepersonal; changekeys; //   autowant; addRevert; //Add a "Revert To Here" link to every diff page addHistoryEdit; //Add "edit" links to the history page to provide a way to directly edit each revision setEditForm; //Automate the submission of forms by auto-filling textboxes and auto-pushing buttons //   flagUsers; //Flag users on Recent Changes //   addRecentContribs; //In the Recent Changes page, add 'contribs' link to each user // Last item has been rendered obsolete by MW 1.7.

}

// ================================================================= // functions called from onload // =================================================================

// useful changable: 'p-personal' 'p-logo' 'p-nav' 'p-search' 'p-tbx' 'p-lang' 'p-cactions'

// functions to pick and order additional action links

function addactions { addgoogle; addenwp; //   addpurge; //   addredir; //   addmtu; //   addnrv; //   addvfd; //   addpity; //   addhatehate; //   addexpand; //   addblockuser; //   addlogstatuser; //   adduserblocks; //   addfixit; //   addvanity2; //   addwelcome; addw1; //   addvwarn2 }

function addRecentContribs { if (document.title != 'Recent changes - Uncyclopedia') return;

var xp_talkLinks = document.evaluate("//a[contains(@href, 'User_talk') and .='Talk']", document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);

var curLink; var i;

for (i = 0; i < xp_talkLinks.snapshotLength; i++) { var n = i + 1; var newLink; var linkSpan; var bar; var re;

curLink = xp_talkLinks.snapshotItem(i);

if (curLink.href.indexOf("/index.php") > 0) { re = RegExp("title=User_talk:(.*)&"); } else { re = RegExp("wiki/User_talk:(.*)"); }       var matches = re.exec(curLink.href); newLink = document.createElement("a"); bar = document.createElement("span"); linkSpan = document.createElement("span"); newLink.href = "http://uncyclopedia.org/wiki/Special:Contributions/" + matches[1]; newLink.textContent = "contribs"; linkSpan.setAttribute("class", "plainlinks"); linkSpan.appendChild(newLink); bar.textContent = " | "; insertAfter(curLink.parentNode, bar, curLink); insertAfter(curLink.parentNode, linkSpan, bar); } }

function addTab(text, url) { var xp_tabs = document.evaluate("//div[@id='p-cactions']/ul", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null); var tabs = xp_tabs.singleNodeValue; var newTab = document.createElement("li");

newTab.innerHTML = '' + text + ''; tabs.appendChild(newTab);

return newTab; }

function addToolboxLink(text, url, parent) { var newLink = document.createElement("li");

newLink.innerHTML = '' + text + ''; parent.appendChild(newLink);

return newLink; };

function addHistoryEdit { var pageHistory = document.getElementById('pagehistory'); if (!pageHistory) return;

var links = document.evaluate("//li[input[@type='radio']]", document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null); var xp_name1 = document.evaluate("//li[input[@type='radio']][1]/descendant::a[last]", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null); if (!xp_name1) return; var name1 = xp_name1.singleNodeValue; var curLink; var i;   for (i = 0; i < links.snapshotLength; i++) { var n = i + 1; curLink = links.snapshotItem(i); var xp_name2 = document.evaluate("//li[input[@type='radio']][" + n + "]/descendant::input/following::a[2]", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null); if (!xp_name2) return; var xp_link = document.evaluate("//li[input[@type='radio']][" + n + "]/descendant::input/following::a[1]", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null); if (!xp_link) return; var name2 = xp_name2.singleNodeValue; var link = xp_link.singleNodeValue; if (i == 0) { curLink.innerHTML = '(rvt) ' + curLink.innerHTML; } else { curLink.innerHTML = '( rvt ) ' + curLink.innerHTML; }   } };

function setEditForm { var editform = document.getElementById("editform"); if (!editform) return; var summaryText = queryString('setsummary'); if (summaryText) { var summary = document.getElementsByName("wpSummary")[0]; if (summary) summary.value = summaryText; }   var setMinor = queryString('setminor'); if (setMinor) { var minor = document.getElementById("wpMinoredit"); if (minor) minor.checked = (setMinor == '1'); }   var setWatch = queryString('setwatch'); if (setWatch) { var watch = document.getElementById("wpWatchthis"); if (watch) watch.checked = (setWatch == '1'); }   var setSubmit = queryString('setsubmit'); if (setSubmit) { var btn = document.getElementById(setSubmit); if (document.getElementById("editform") && btn) { btn.textContent += " (auto clicking...)"; btn.click; }   } };

function setDelForm { var delconfirm = document.getElementById("deleteconfirm"); if (!delconfirm) return; var reasonText = queryString('setreason'); if (reasonText) { var reason = document.getElementsByName("wpReason")[0]; if (reason) reason.value = reasonText; } /*      var setMinor = queryString('setminor'); if (setMinor) { var minor = document.getElementById("wpMinoredit"); if (minor) minor.checked = (setMinor == '1'); }   var setWatch = queryString('setwatch'); if (setWatch) { var watch = document.getElementById("wpWatchthis"); if (watch) watch.checked = (setWatch == '1'); }   var setSubmit = queryString('setsubmit'); if (setSubmit) { var btn = document.getElementById(setSubmit); if (document.getElementById("editform") && btn) { btn.textContent += " (auto clicking...)"; btn.click; }   }*/ };

function addRevert { if(!queryString("diff")) return; var xp_link = document.evaluate("//a[starts-with(., 'Revision')]", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null); if (!xp_link) return; var link = xp_link.singleNodeValue; var xp_name1 = document.evaluate("/descendant::a[.='Talk'][1]/preceding-sibling::a", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null); if (!xp_name1) return; var xp_name2 = document.evaluate("/descendant::a[.='Talk'][2]/preceding-sibling::a", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null); if (!xp_name2) return; var name1 = xp_name1.singleNodeValue; var name2 = xp_name2.singleNodeValue;

var linkSpan = document.createElement("span"); var revertLink = document.createElement("a"); var summaryText = "[RVT] edit of " + name2.textContent + " to previous one by " + name1.textContent

linkSpan.innerHTML = " ";

revertLink.innerHTML = "[Revert to here]"; revertLink.href = link.href + "&action=edit&setsubmit=wpSave&setsummary=" + summaryText + "&setminor=1";

insertAfter(link.parentNode, linkSpan, link); insertAfter(link.parentNode, revertLink, linkSpan); };

function insertAfter(parent, node, referenceNode) { if(referenceNode.nextSibling) { return parent.insertBefore(node, referenceNode.nextSibling); } else { return parent.appendChild(node); } };

function queryString(p) { var re = RegExp('[&?]' + p + '=([^&]*)'); var matches;

if (matches = re.exec(document.location)) { try { return decodeURI(matches[1]); } catch (e) { }   }    return null; };

// adds a google search link for the title of 'normal' pages

function addgoogle { if(document.title.indexOf("Editing") != 0) { if(!document.getElementById) return; var x = document.getElementById('ca-history'); var y = document.getElementById('ca-edit'); var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0]; if((!x)&&(!y)) return; addlilink(tabs, "http://www.google.com/search?q=%22"+ document.getElementsByTagName('h1')[0].firstChild.nodeValue +"%22", 'goog', 'ca-google');

} }

// adds a wikipedia link for the title of 'normal' pages

function addenwp { if((document.title.indexOf("Editing") != 0) && (document.title.indexOf("Confirm delete") != 0)) { if(!document.getElementById) return; var x = document.getElementById('ca-history'); var y = document.getElementById('ca-edit'); var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0]; if((!x)&&(!y)) return; addlilink(tabs, "http://en.wikipedia.org/wiki/Special:Search?search="+ document.getElementsByTagName('h1')[0].firstChild.nodeValue +"&go=Go", 'wp', 'ca-enwp');

} }

// purge button, borrowed code

function addpurge { if(!document.getElementById) return; var x = document.getElementById('ca-history'); var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0]; if(!x) return; if(x.children) x = x.children[0]; else x = x.childNodes[0]; addlilink(tabs, x.href.replace(/=history/, "=purge"), 'purge', 'ca-purge'); }

// a javascript button (the javascript is a template append macro)

function addredir { var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0]; if(document.title.indexOf("Editing") == 0) addlilink(tabs, 'javascript:redir', '+redir', 'ca-redir'); }

function addmtu { var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0]; if(document.title.indexOf("Editing") == 0) addlilink(tabs, 'javascript:mtu', 'MTU', 'ca-mtu'); }

function addnrv { var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0]; if((document.title.indexOf("Editing") == 0) && (document.title.indexOf("User") == -1)) addlilink(tabs, 'javascript:nrv', 'ICU', 'ca-nrv'); }

function addpity { var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0]; if((document.title.indexOf("Editing") == 0) && (document.title.indexOf("User") == -1)) addlilink(tabs, 'javascript:pity', 'rw', 'ca-pity'); }

function addexpand { var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0]; if((document.title.indexOf("Editing") == 0) && (document.title.indexOf("User") == -1)) addlilink(tabs, 'javascript:expand', 'expd', 'ca-expand'); }

function addvfd { var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0]; if((document.title.indexOf("Editing") == 0) && (document.title.indexOf("User") == -1)) addlilink(tabs, 'javascript:vfd', 'VFD', 'ca-vfd'); }

function addhatehate { var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0]; if((document.title.indexOf("Editing") == 0) && (document.title.indexOf("User") == -1)) addlilink(tabs, 'javascript:hatehate', 'ugly', 'ca-hatehate'); }

function addfixit { var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0]; if((document.title.indexOf("Editing") == 0) && (document.title.indexOf("User") == -1)) addlilink(tabs, 'javascript:fixit', 'fix', 'ca-fixit'); }

function addvanity2 { var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0]; if((document.title.indexOf("Editing") == 0) && (document.title.indexOf("User") == -1)) addlilink(tabs, 'javascript:vanity2', 'v2', 'ca-van2'); }

function addwelcome { if(!document.editform) return; var txt = document.editform.wpTextbox1; var url = window.location; if(txt.value.length == 0) { if (url.search.indexOf("User_talk:") != -1) { var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0]; if(document.title.indexOf("Editing") == 0) addlilink(tabs, 'javascript:welcome', 'welcome!', 'ca-welcome'); }   } }

function addw1 { if(!document.editform) return; var txt = document.editform.wpTextbox1; var url = window.location; if (url.search.indexOf("User_talk:") != -1) { var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0]; if(document.title.indexOf("Editing") == 0) addlilink(tabs, 'javascript:w1', 'warning 1', 'ca-w1'); } }

function addvwarn2 { if(!document.editform) return; var txt = document.editform.wpTextbox1; var url = window.location; if (url.search.indexOf("User_talk:") != -1) { var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0]; if(document.title.indexOf("Editing") == 0) addlilink(tabs, 'javascript:vwarn2', 'warn2', 'ca-warn2'); } }

// add a 'block user' button to the Special:Contribs pages (both wiki and index)

function addblockuser { if(!document.getElementById) return; if(!document.title.indexOf("User contributions") == 0) return; var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0]; if(document.location.href.indexOf("\/Special:Contributions\/") == -1) addlilink(tabs, "\/index.php?title=Special:Blockip&ip=" + document.location.href.substring(document.location.href.indexOf("target=")+7), 'ban user', 'ca-blockuser'); else addlilink(tabs, "\/index.php?title=Special:Blockip&ip=" + document.location.href.substring(document.location.href.indexOf("Special:Contributions\/")+22), 'ban user', 'ca-blockuser'); }

// add 'user logs' (non-edit actions) and 'status' (rights/bans) to Special:Contribs pages (both wiki and index)

function addlogstatuser { if(!document.getElementById) return; if(!document.title.indexOf("User contributions") == 0) return; var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0]; if(document.location.href.indexOf("\/Special:Contributions\/") == -1) addlilink(tabs, "\/index.php?title=Special%3ALog&type=&page=&user=" + document.location.href.substring(document.location.href.indexOf("target=")+7), 'user logs', 'ca-userlogs'); else addlilink(tabs, "\/index.php?title=Special%3ALog&type=&page=&user=" + document.location.href.substring(document.location.href.indexOf("Special:Contributions\/")+22), 'user logs', 'ca-userlogs'); if(document.location.href.indexOf("\/Special:Contributions\/") == -1) addlilink(tabs, "\/index.php?title=Special%3ALog&type=&user=&page=User:" + document.location.href.substring(document.location.href.indexOf("target=")+7), 'status', 'ca-userstatus'); else addlilink(tabs, "\/index.php?title=Special%3ALog&type=&user=&page=User:" + document.location.href.substring(document.location.href.indexOf("Special:Contributions\/")+22), 'status', 'ca-userstatus'); }

function adduserblocks { if(!document.getElementById) return; if(!document.title.indexOf("User:") == 0) return; var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0]; addlilink(tabs, "\/index.php?title=Special:Blockip&ip=" + document.location.href.substring(document.location.href.indexOf("User:")+5), 'ban', 'ca-blockuser'); addlilink(tabs, "\/index.php?title=Special:Blockip&action=submit&wpBlockExpiry=other&wpBlockOther=11+minutes&wpBlockReason=Time out. Read HTBFANJS.&wpBlock=Block+this+user&wpBlockAddress=" + document.location.href.substring(document.location.href.indexOf("User:")+5), '11m', 'ca-blockuser0'); addlilink(tabs, "\/index.php?title=Special:Blockip&action=submit&wpBlockExpiry=2+hours&wpBlockReason=(reason)&wpBlock=Block+this+user&wpBlockAddress=" + document.location.href.substring(document.location.href.indexOf("User:")+5), '2h', 'ca-blockuser1'); addlilink(tabs, "\/index.php?title=Special:Blockip&action=submit&wpBlockExpiry=other&wpBlockOther=2+days&wpBlockReason=(reason)&wpBlock=Block+this+user&wpBlockAddress=" + document.location.href.substring(document.location.href.indexOf("User:")+5), '2d', 'ca-blockuser2'); addlilink(tabs, "\/index.php?title=Special:Blockip&action=submit&wpBlockExpiry=other&wpBlockOther=11+days&wpBlockReason=(reason)&wpBlock=Block+this+user&wpBlockAddress=" + document.location.href.substring(document.location.href.indexOf("User:")+5), '11d', 'ca-blockuser3'); addlilink(tabs, "\/index.php?title=Special:Blockip&action=submit&wpBlockExpiry=1+year&wpBlockReason=(reason)&wpBlock=Block+this+user&wpBlockAddress=" + document.location.href.substring(document.location.href.indexOf("User:")+5), '1y', 'ca-blockuser4'); }

// change the name and function of action buttons

function changeactions { //   document.getElementById('ca-edit').firstChild.innerHTML = 'edit page'; //   document.getElementById('ca-history').childNodes[0].href = 'http://www.google.com'; }

// add to the toolbox

function addtoolbox { var tb = document.getElementById('p-tb').getElementsByTagName('ul')[0]; addlilink(tb, '/wiki/Special:Shortpages', 'Short pages', 't-short'); addlilink(tb, '/wiki/Special:Newpages', 'New pages', 't-new'); addlilink(tb, '/wiki/Special:Uncategorizedpages', 'Ronin Articles', 't-nocat'); //   addlilink(tb, '/wiki/Special:Ipblocklist', 'Block List', 't-blocks'); }

// change the name and function of toolbox links

function changetoolbox { //   document.getElementById('t-upload').firstChild.innerHTML = 'google'; //   document.getElementById('t-upload').childNodes[0].href = 'http://www.google.com'; }

// add to the navigation box

function addnavbox { //   var tb = document.getElementById('p-nav').getElementsByTagName('ul')[0]; //   addlilink(tb, 'http://www.google.com/', 'google', 'p-google'); }

// change the name and function of navigation box links

function changenavbox { //   document.getElementById('n-Babel').firstChild.innerHTML = 'Block User'; //   document.getElementById('n-Babel').childNodes[0].href = 'http://uncyclopedia.org/wiki/Special:Blockip'; //   document.getElementById('n-currentevents').firstChild.innerHTML = 'Village Dump'; //   document.getElementById('n-currentevents').childNodes[0].href = 'http://uncyclopedia.org/wiki/Uncyclopedia:Village_Dump'; //   document.getElementById('n-help').firstChild.innerHTML = 'Votes for Deletion'; //   document.getElementById('n-help').childNodes[0].href = 'http://uncyclopedia.org/wiki/Uncyclopedia:Votes_for_deletion'; //   document.getElementById('n-Things-to-do').firstChild.innerHTML = 'Ban Patrol'; //   document.getElementById('n-Things-to-do').childNodes[0].href = 'http://uncyclopedia.org/wiki/Uncyclopedia:Ban_Patrol'; //   document.getElementById('n-Pee-Review').firstChild.innerHTML = 'Principal\'s Office'; //   document.getElementById('n-Pee-Review').childNodes[0].href = 'http://uncyclopedia.org/wiki/Uncyclopedia:Flammable%27s_Office'; }

// add to the personal links

function addpersonal { //   var tb = document.getElementById('p-personal').getElementsByTagName('ul')[0]; //   addlilink(tb, 'http://www.google.com/', 'google', 't-personalgoogle'); }

// change the name and function of personal links

function changepersonal { if(!document.getElementById) return; document.getElementById('pt-mytalk').firstChild.innerHTML = 'talk'; document.getElementById('pt-mytalk').childNodes[0].href = '/index.php?title=User_talk:Hinoa'; //   document.getElementById('pt-preferences').firstChild.innerHTML = 'preferences'; document.getElementById('pt-watchlist').firstChild.innerHTML = 'on notice'; document.getElementById('pt-mycontris').firstChild.innerHTML = 'contributions'; document.getElementById('pt-logout').childNodes[0].href = 'http://goldensun.wikia.com/wiki/Special:Log'; document.getElementById('pt-logout').firstChild.innerHTML = 'logs'; }

// change various shortcut keys

function changekeys { //   ta['ca-google'] = ['g', 'Google search this topic']; //   ta['ca-enwp'] = ['`', 'Check en.wikipedia for this topic']; //   ta['ca-undic'] = ['u', 'Edit into Undictionary']; //   ta['ca-mtu'] = ['u', 'Tag with MTU']; //   ta['ca-nrv'] = ['d', 'Tag with NRV']; //   ta['ca-nogwax'] = ['n', 'Keep gwax away from this article! RAAAAAAAAAR']; //   ta['ca-redir'] = ['r', 'Turn page into a redirect']; //   ta['ca-purge'] = ['p', 'Purge the internal cache for this page']; //   ta['pt-logout'] = ['Ü', 'Log out']; //   ta['t-contributions'] = ['a', 'User contributions']; //   ta['t-admin'] = ['', 'My admin tools']; //   ta['t-parole'] = ['', 'My list of users to watch']; //   ta['t-blocks'] = ['', 'All blocks']; //   ta['ca-blockuser'] = ['b', 'Block user']; //   ta['ca-userlogs'] = ['u', 'All Special:Logs which the user has performed']; //   ta['ca-userstatus'] = ['s', 'All Special:Logs which the user was the target']; akeytt; }

// autoselect the checkbox on a delete form /* Annoying errormaker. function autowant { if(document.title.indexOf("Confirm delete") == 0) { document.forms[0].wpConfirm.checked = true; //       document.forms[0].wpReason.select; //       document.forms[0].wpReason.focus; } } */

// ================================================================= // functions called from document // =================================================================

// MTU button, inserts MTU template, adjusts checkboxes, sets focus on submit

function mtu { document.editform.wpSummary.value = '+MTU tagging (please move/expand/delete)'; document.editform.wpMinoredit.checked = true; document.editform.wpWatchthis.checked = false; var txt = document.editform.wpTextbox1; if(txt.value.length > 0) txt.value += '\n'; txt.value += ''; document.editform.wpSave.focus; }

function nrv { document.editform.wpSummary.value = '[+ICU] MEDIC! (Make better within seven days, please. You can rebuild it. You have the technology.)'; document.editform.wpMinoredit.checked = true; document.editform.wpWatchthis.checked = false; var txt = document.editform.wpTextbox1; if(txt.value.length > 0) txt.value += '\n'; txt.value += ''; document.editform.wpSave.focus; }

function expand { document.editform.wpSummary.value = '[+expand] MORE FUNNY!'; document.editform.wpMinoredit.checked = true; document.editform.wpWatchthis.checked = false; var txt = document.editform.wpTextbox1; if(txt.value.length > 0) txt.value += '\n'; txt.value += ''; document.editform.wpSave.focus; }

function pity { document.editform.wpSummary.value = '[+rewrite] Eh... the idea\'s fairly good. The article, though... yeah. Try again.'; document.editform.wpMinoredit.checked = true; document.editform.wpWatchthis.checked = false; var txt = document.editform.wpTextbox1; if(txt.value.length > 0) txt.value += '\n'; txt.value += ''; document.editform.wpSave.focus; }

function fixit { document.editform.wpSummary.value = '[+fix] Not bad, but could be better. You should take it to Pee Review and get some help.'; document.editform.wpMinoredit.checked = true; document.editform.wpWatchthis.checked = false; var txt = document.editform.wpTextbox1; if(txt.value.length > 0) txt.value += '\n'; txt.value += ''; document.editform.wpSave.focus; }

function vanity2 { document.editform.wpSummary.value = '[+v2] This has potential to be allowable. You have seven days to make it thusly. Look here for help.'; document.editform.wpMinoredit.checked = true; document.editform.wpWatchthis.checked = false; var txt = document.editform.wpTextbox1; if(txt.value.length > 0) txt.value += '\n'; txt.value += ''; document.editform.wpSave.focus; }

function vfd { document.editform.wpSummary.value = '[+VFD] Article has been indicted for crimes against humor at the tribunal. Go vote on its fate.'; document.editform.wpMinoredit.checked = true; document.editform.wpWatchthis.checked = false; var txt = document.editform.wpTextbox1; //if(txt.value.length > 0) txt.value += '\n'; //txt.value += ''; txt.value = '' + '\n' + txt.value; document.editform.wpSave.focus; }

function hatehate { document.editform.wpSummary.value = '[+ugly] This article ranks in the Top 10 Causes of Eye Bleeding. Wikiformat it properly, please.'; document.editform.wpMinoredit.checked = true; document.editform.wpWatchthis.checked = false; var txt = document.editform.wpTextbox1; if(txt.value.length > 0) txt.value += '\n'; txt.value += '';

document.editform.wpSave.focus; }

function redir { var pagetitle = document.getElementsByTagName('h1')[0].firstChild.nodeValue; pagetitle = pagetitle.substring(pagetitle.indexOf("Editing ")+8); document.editform.wpSummary.value = 'Redirecting.'; document.editform.wpMinoredit.checked = true; document.editform.wpWatchthis.checked = false; var txt = document.editform.wpTextbox1; if(txt.value.length > 0) txt.value += '\n'; txt.value = '#REDIRECT:' + pagetitle + ''; // comment out the following two lines if not using mozilla (too lazy to make it work in IE) txt.selectionStart=12; txt.selectionEnd=pagetitle.length+12; document.editform.wpTextbox1.focus; }

function welcome { document.editform.wpSummary.value = 'Welcome to Uncyclopedia!'; document.editform.wpMinoredit.checked = false; document.editform.wpWatchthis.checked = false; var txt = document.editform.wpTextbox1; if(txt.value.length > 0) txt.value += '\n'; txt.value += ''; document.editform.wpSave.focus; }

function w1 { document.editform.wpSummary.value = 'Vandalism warning'; document.editform.wpMinoredit.checked = false; document.editform.wpWatchthis.checked = false; var txt = document.editform.wpTextbox1; if(txt.value.length > 0) txt.value += '\n'; txt.value += ' ~'; //document.editform.wpSave.focus; }

function vwarn2 { document.editform.wpSummary.value = 'You WERE warned...'; document.editform.wpMinoredit.checked = false; document.editform.wpWatchthis.checked = false; var txt = document.editform.wpTextbox1; if(txt.value.length > 0) txt.value += '\n'; txt.value += '-article- '; //document.editform.wpSave.focus; }

// ================================================================= // functions needed that I didn't write and don't fully understand // =================================================================

// function to add buttons/tabs/links

function addlilink(tabs, url, name, id) { var na = document.createElement('a'); na.href = url; na.id = id; na.appendChild(document.createTextNode(name)); var li = document.createElement('li'); li.appendChild(na); tabs.appendChild(li); return li; }

// =============================================================== // Spang's Preset Deletion Summary Thingy // =============================================================== function deletionPresets { if (window.location.href.indexOf("&action=delete") != -1) { var targetContent = document.getElementById('deleteconfirm'); var insertSummary = targetContent.getElementsByTagName('td')[1]; var combohtml = ' '; combohtml += ''; combohtml += 'None '; //   combohtml += 'FFW '; combohtml += 'NRV expired '; //   combohtml += 'V2 expired '; combohtml += 'Sucks '; combohtml += '<option value="Uncyc Deletion Protocol 1.5: Violated the vanity policy. Recreation in further violation is grounds for a 36-hour ban.">Vanity '; //   combohtml += '<option value="Factual.">Facts '; combohtml += '<option value="Uncyc Deletion Protocol 2.2: Found guilty at the tribunal.">VFD '; combohtml += '<option value="Uncyc Deletion Protocol 3.7: No orphanages in Uncyc. Just dumpsters.">Orphan '; combohtml += '<option value="Uncyc Deletion Protocol 1.11: I\'m not drunk, so it\'s not funny.">Randum '; //   combohtml += '<option value="Ctrl-C/Ctrl-V THIS.  (plagiarized)">Plagiarism '; combohtml += ' '; insertSummary.innerHTML += combohtml; }; };

function changeDelSummary{ var targetContent = document.getElementById('deleteconfirm'); var inputBoxTD = targetContent.getElementsByTagName('td')[1]; var box = inputBoxTD.getElementsByTagName('input')[0]; inputBoxTD.removeChild(box); var boxhtml = ''; boxhtml += '<input type="text" size="60" name="wpReason" id="wpReason" value="';  boxhtml += document.getElementById('summaries').value;   boxhtml += '" />'; inputBoxTD.innerHTML = boxhtml + inputBoxTD.innerHTML; targetContent.wpConfirmB.focus; };

function tabNames { changeTabText('ca-talk',   'disc'); //   changeTabText('ca-edit',    'edit'); changeTabText('ca-history', 'hist'); changeTabText('ca-delete', 'del'); changeTabText('ca-watch',  'wch'); changeTabText('ca-unwatch',  'unwch'); //   changeTabText('ca-move',    'move'); changeTabText('ca-protect', 'pct'); changeTabText('ca-unprotect', 'unpct'); };

function changeTabText(id, text) { if (document.getElementById(id)) { var tabname = document.getElementById(id).firstChild; tabname.removeChild(tabname.firstChild); tabname.appendChild(document.createTextNode(text)) return tabname; } };

window.addEventListener('load', tabNames, false); //