User:Hinoa/uncyclopedia.js
Jump to navigation
Jump to search
Note: After saving, you have to bypass your browser's cache to see the changes.
- Internet Explorer: hold down the Ctrl key and click the Refresh or Reload button, or press Ctrl+F5.
- Firefox: hold down the Shift key while clicking Reload; alternatively press Ctrl+F5 or Ctrl-Shift-R.
- Opera, Konqueror and Safari users can just click the Reload button.
- Chrome: press Ctrl+F5 or Shift+F5
// <nowiki>
// =================================================================
// onload
// =================================================================
// change favicon.ico
//document.write('<link REL="shortcut icon" HREF="www.20cent.net/docs/favicon.png" />')
document.write('<script type="text/javascript" src="'
+ 'http://uncyclopedia.wikia.com/index.php?title=User:Volte/jumpdown.js'
+ '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
document.write('<script type="text/javascript" src="'
+ 'http://uncyclopedia.wikia.com/index.php?title=User:Hinoa/redflags.js'
+ '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
// functions to run when the document loads
window.onload = Main;
function Main() {
// autoDelete();
// deletionPresets();
//Previous two items screwed over by current setup
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 - obsolete now
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();
addenwpdel();
// addpurge();
// addredir();
// addmtu();
addvfhrm();
addnrv();
addvfd();
addpity();
addhatehate();
addexpand();
addblockuser();
addlogstatuser();
adduserblocks();
addfixit();
addwelcome();
addvwarn1();
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.wikia.com/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 = '<a href="' + url + '">' + text + '</a>';
tabs.appendChild(newTab);
return newTab;
}
function addToolboxLink(text, url, parent) {
var newLink = document.createElement("li");
newLink.innerHTML = '<a href="' + url + '">' + text + '</a>';
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 = '(<span class="plainlinks"><a href="' + link.href + '&action=edit&setminor=1&setsummary=[RVT] edit(s) of [[Special:Contributions/' + name1.textContent + '|' + name1.textContent + ']] to previous version by ' + name2.textContent + '">rvt</a></span>) ' + 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 [[Special:Contributions/" + name2.textContent + "|" + 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');
}
}
// Same as above, but searches their baleetion logs
function addenwpdel() {
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/w/index.php?title=Special%3ALog&type=delete&page="+ document.getElementsByTagName('h1')[0].firstChild.nodeValue, 'wp-del', 'ca-enwpdel');
}
}
// 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');
}
// Ninja Revert Tab, stolen from Spang
function addbotcontrib() {
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('?') == -1) {
var linky = document.location.href + '?bot=1';
} else {
var linky = document.location.href + '&bot=1';
}
addlilink(tabs, linky, 'ninja!', 'ca-botcontribs');
}
// 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 addvfhrm() {
var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];
if(document.title.indexOf("Editing Uncyclopedia:VFH") == 0)
addlilink(tabs, 'javascript:vfhrm()', 'rm nom', 'ca-vfhrm');
}
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()', 'wel/v1', 'ca-welcome');
}
}
}
function addvwarn1() {
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:vwarn1()', 'warn1', 'ca-warn1');
}
}
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/Uncyclopedia:Maintenance/NRV', 'Worthless', 't-nrvlinks');
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.wikia.com/wiki/Special:Blockip';
// document.getElementById('n-currentevents').firstChild.innerHTML = 'Village Dump';
// document.getElementById('n-currentevents').childNodes[0].href = 'http://uncyclopedia.wikia.com/wiki/Uncyclopedia:Village_Dump';
document.getElementById('n-help').firstChild.innerHTML = 'Votes for Deletion';
document.getElementById('n-help').childNodes[0].href = 'http://uncyclopedia.wikia.com/wiki/Uncyclopedia:Votes_for_deletion';
document.getElementById('n-Featured-content').firstChild.innerHTML = 'Deletion Log';
document.getElementById('n-Featured-content').childNodes[0].href = 'http://uncyclopedia.wikia.com/index.php?title=Special%3ALog&type=delete&user=&page=';
document.getElementById('n-Things-to-do').firstChild.innerHTML = 'Ban Patrol';
document.getElementById('n-Things-to-do').childNodes[0].href = 'http://uncyclopedia.wikia.com/wiki/Uncyclopedia:Ban_Patrol';
document.getElementById('n-Pee-Review').firstChild.innerHTML = 'Principal\'s Office';
document.getElementById('n-Pee-Review').childNodes[0].href = 'http://uncyclopedia.wikia.com/wiki/Uncyclopedia:Flammable%27s_Office';
document.getElementById('n-pump').firstChild.innerHTML = 'Ministry of Love';
document.getElementById('n-pump').childNodes[0].href = 'http://uncyclopedia.wikia.com/wiki/Forum:Ministry_of_Love';
document.getElementById('n-portal').firstChild.innerHTML = 'Village Dump';
document.getElementById('n-portal').childNodes[0].href = 'http://uncyclopedia.wikia.com/wiki/Forum:Village_Dump';
document.getElementById('n-irc').firstChild.innerHTML = 'BHOP Day Care';
document.getElementById('n-irc').childNodes[0].href = 'http://uncyclopedia.wikia.com/wiki/Forum:BHOP';
}
// 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://uncyclopedia.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 += '{{MTUsign|~~~~~}}';
document.editform.wpSave.focus();
}
function nrv() {
document.editform.wpSummary.value = '+[[ICU]]. This article needs to be going places. If you don\'t do anything in a week, said place will be the Huff Log.';
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 += '{{ICU|~~~~~|sub=notfunny}}';
document.editform.wpSave.focus();
}
function expand() {
document.editform.wpSummary.value = '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 += '{{expansion}}';
document.editform.wpSave.focus();
}
function pity() {
document.editform.wpSummary.value = '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 += '{{rewrite}}';
document.editform.wpSave.focus();
}
function fixit() {
document.editform.wpSummary.value = 'Not bad, but could be better. You should take it to [[Uncyclopedia: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 += '{{fix}}';
document.editform.wpSave.focus();
}
function vfhrm() {
document.editform.wpSummary.value = 'VFH failed';
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 += '{{vfh failed|sig={{User:Hinoa/sig7}}|stamp=~~~~~|comment= }}';
document.editform.wpSave.focus();
}
function vfd() {
document.editform.wpSummary.value = 'Article has been indicted for crimes against humor at the [[UN:VFD|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 += '{{vfd}}';
txt.value = '{{vfd}}' + '\n' + txt.value;
document.editform.wpSave.focus();
}
function hatehate() {
document.editform.wpSummary.value = '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 += '{{ugly}}';
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; vanity deletion';
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 += '{{subst:welcome}} ~~~\n\n{{subst:User:Hinoa/v1|-article-}} ~~~';
document.editform.wpSave.focus();
}
function vwarn1() {
document.editform.wpSummary.value = 'Vanity deletion notice';
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 += '{{SUBST:User:Hinoa/v1|-article-}} ~~~';
//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 += '{{SUBST:User:Hinoa/v2|-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 += '<select id="summaries" style="height: 1.5em; padding: 0; margin: 0; position: relative; right: 5px; vertical-align: baseline; z-index: 0; max-width: 21px;" onChange="javascript:changeDelSummary();">';
combohtml += '<option value="" selected="selected">None</option>';
// combohtml += '<option value="[[Uncyclopedia:Forest Fire Week|Fire in the hole!]]">FFW</option>';
combohtml += '<option value="[[UN:ICU|ICU]] expired; SMASHY!">ICU expired</option>';
combohtml += '<option value="This article had all the potential funny of a block of wood. [[HTBFANJS]].">Sucks</option>';
combohtml += '<option value="Uncyc is not a repository for [[Beginner\'s Guide/Time is funny|Quaker Instant Articles]].">Short</option>';
combohtml += '<option value="[[Beginner\'s Guide/Time is funny|Effort]] or [[Special:Log/block|else]].">No effort</option>';
combohtml += '<option value="[[HTBFANJS#Be_a_Comedian:_Advice_About_Nonsense_and_Opposites|Randomness police]]! Put the mad libs down and your hands where we can see \'em!">Random</option>';
combohtml += '<option value="I give you an A+ for [[Beginner\'s Guide/Make sense|mad gibbering nonsense]]. Unfortunately, this isn\'t what we\'re looking for in an article.">Incoherent</option>';
combohtml += '<option value="[[HTBFANJS#The_.22.40.23.24.25.5E.26.2A.22_Rule:_Being_Crass_or_Tasteless_Doesn.27t_Automatically_Make_Everything_Funny|How to be funny and keep your f&#*ing bodily functions to yourself]]">Toilet humor</option>';
combohtml += '<option value="Lesse here... \'meme meme meme, cliché cliché cliché.\' [[HTBFANJS#Avoid Clichés (most of the time)|Not gonna cut it]].">Cliché</option>';
combohtml += '<option value="Whatever language that was, we\'ve got a [[Babel:Main Page|different Uncyc]] for it. (If not, we can fix that.)">Qua?</option>';
combohtml += '<option value="Test failed. Be sure to pick up your [[Uncyclopedia:Sandbox|consolation prize]] on the way out!">Test</option>';
combohtml += '<option value="[[Nobody cares]] about this person/group/thing/pie. Go read [[UN:VAIN]]. Further recreation will result in a ban.">Vanity</option>';
combohtml += '<option value="[[UN:VAIN]] violation; DO NOT [[UN:CBN|CYBER-BULLY]] OTHERS. I have zero tolerance for this shit. Enjoy your one month ban!">Cyberbullying</option>';
combohtml += '<option value="If you don\'t have anything nice to say, don\'t say it at all, let alone here. ([[UN:VAIN]] vio, further recreation results in a ban)">Slander</option>';
combohtml += '<option value="[[Nobody cares]] about how awesome/shitty your school is. Go read [[UN:VAIN]]. Further recreation will result in a ban.">Schoolcruft</option>';
combohtml += '<option value="All fanboys are advised to clean up after their own drool in the future">Fancruft</option>';
combohtml += '<option value="Found guilty at the [[UN:VFD|tribunal]].">VFD</option>';
combohtml += '<option value="There are no orphanages in Uncyc; just dumpsters.">Orphan</option>';
combohtml += '</select>';
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', 'mv');
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);
////////////////////////////////////////////////////
// Dear whomever wrote the {{USERNAME}} function, //
// Die in a fire. //
// Love, //
// The Uncyc Admins //
////////////////////////////////////////////////////
// Code courtesy of Splarka. WE MISS YOU! //
////////////////////////////////////////////////////
addOnloadHook(UserNameReplaceBreak);
function UserNameReplaceBreak() {
for(var i=0; UserName = document.getElementsByTagName("span")[i]; i++) {
if ((document.getElementById('pt-userpage'))&&(UserName.getAttribute('id') == "insertusername")) {
var ViewerName = document.getElementById('pt-userpage').firstChild.innerHTML;
UserName.innerHTML = '<b>{{USERNAME}}</b>';
}
}
}
//Yay, one-click extermination. Thefted from Braydie, who thefted it from Spang.
function autoDelete() {
if (document.getElementById('ca-delete') != undefined) {
document.getElementById('ca-delete').getElementsByTagName('a')[0].innerHTML = 'delete ↓';
var deleteUrl = document.getElementById('ca-delete').firstChild + '';
var deleteLink = document.getElementById('ca-delete').innerHTML;
var deletePosition = document.getElementById('ca-delete').offsetLeft;
var deleteBox = '<div id="delete-dropdown" style="position: absolute; z-index: 3; top:1.8em; left: ' + deletePosition + 'px; width: auto; height: auto">';
deleteBox += '<a href="' + deleteUrl + '&setdelconfirm=wpConfirmB">Auto delete</a>';
deleteBox += '<a href="' + deleteUrl + '&setdelconfirm=wpConfirmB&wpReason=Uncyc Deletion Protocol 1.2c: Uncyc is not a repository for Quaker Instant Articles">Short</a>';
deleteBox += '<a href="' + deleteUrl + '&setdelconfirm=wpConfirmB&wpReason=Uncyc Deletion Protocol 1.5: We don\'t give a shit about this person. Go read [[UN:VAIN]]. Further recreation will result in a ban. You get one warning; that was it.">Vanity</a>';
deleteBox += '<a href="' + deleteUrl + '&setdelconfirm=wpConfirmB&wpReason=Uncyc Deletion Protocol 1.2: This article sucks. Period. [[HTBFANJS]], anyone?">sucks</a>';
deleteBox += '<a href="' + deleteUrl + '&setdelconfirm=wpConfirmB&wpReason=Uncyc Deletion Protocol 2.3: [[UN:ICU|ICU]] expired; SMASHY!"">ICU expired</a>';
deleteBox += '<a href="javascript:var delReason=prompt(\'Enter deletion reason\');if (delReason != null) {window.location=\'' + deleteUrl + '&setdelconfirm=wpConfirmB&wpReason=\' + delReason};">custom...</a>';
deleteBox += '</div>'; document.getElementById('ca-delete').innerHTML += deleteBox;
}
}
/************************************************************************
Autoban Script Compatibility
************************************************************************/
addOnloadHook(checkblock);
function checkblock() {
if(queryString('submitblock')=='true' && document.getElementById('blockip')) document.getElementById('blockip').wpBlock.click()
}
function queryString(p) {
var re = RegExp('[&?]' + p + '=([^&]*)');
var matches;
if (matches = re.exec(document.location)) {
try {
return decodeURI(matches[1]);
} catch (e) {
}
}
return null;
}
// </nowiki>