User:Starnestommy/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
//<pre>
//Settings
popupDelay = 3.5; //navpop delay timer
disableSearchSuggest = true; //Disables search suggest
enableOldForumEdit = true; //Enable edit button on old forums
displayFlashOverride = true; //Enable flash
//Scripts to import
importScript('User:Starnestommy/qvfd2.js'); //Fork of Villahj Ideeut's QVFD.js
//importScript('User:Starnestommy/userundo.js'); //Old userundo script
importScript('User:Starnestommy/rollback.js'); //Recent Changes rollback
//importScript('User:Starnestommy/bot.js'); //Auto-Revert script, aka SckrTrckrBot
//importScript('User:Starnestommy/popups.js'); //Navpops
importScript('User:Spang/vote.js'); //Spang's one-click VFH voting script
//importScript('User:Olipro/retardedshit.js'); //Some retarded shit by Olipro
//Highlight talk page links for users who haven't been welcomed
function replaceTalk() {
if(wgPageName != "Special:RecentChanges")
return;
alinks = document.getElementById("bodyContent").getElementsByTagName("ul")[0].getElementsByTagName('a');
for(i = 0; i < alinks.length; i++) {
prevsib = alinks[i].previousSibling;
if(prevsib == null)
continue;
while(prevsib.nodeType != 1) {
prevsib = prevsib.previousSibling;
if(prevsib == null) {
prevsib = alinks[i].previousSibling;
break;
}
}
if(prevsib == null)
continue;
if(alinks[i].getAttribute('class') != 'new' || alinks[i].innerHTML != 'Talk' || typeof(prevsib.title) == "undefined" || prevsib.title.indexOf('User:') != 0)
continue;
alinks[i].setAttribute('href', alinks[i].getAttribute('href') + '&autoWelcome=true');
alinks[i].setAttribute('class', 'limegreen');
}
}
function doAutoWelcome() {
carryon = queryString('autoWelcome');
if(carryon == null)
return;
if(document.getElementById('wpTextbox1').value != '') {
alert('looks like someone beat you to it');
return;
}
document.getElementById('wpTextbox1').value = '{{subst:welcome}} --~~~';
document.getElementById('wpSummary').value = 'Welcome to Uncyclopedia';
document.getElementById('editform').submit();
}
function autoTalkLoad() {
replaceTalk();
doAutoWelcome();
}
function queryString(p) {
var re = RegExp('[&?]' + p + '=([^&]*)');
var matches;
if (matches = re.exec(document.location)) {
try {
return decodeURI(matches[1]);
} catch (e) {
}
}
return null;
};
addOnloadHook(autoTalkLoad);
//RC Highlighting
*/ function recentChangesHighlights() {
if (wgPageName == 'Special:RecentChanges') {
var targetContent = document.getElementById('bodyContent');
var rows = targetContent.getElementsByTagName ("li");
for (var l = 0; l < rows.length; l++) {
liHTML = rows[l].innerHTML
liText = rows[l].textContent;
if (liHTML.indexOf('/wiki/Special:Log/') != -1) {
rows[l].style.backgroundColor = '#DDF';
}
if (liHTML.indexOf('/wiki/Special:Log/block') != -1 || liHTML.indexOf('/wiki/Special:Log/delete') != -1) {
rows[l].style.backgroundColor = '#FEE';
}
if (liHTML.indexOf('<span class="newpage"') != -1) {
rows[l].style.backgroundColor = '#DFD';
}
if (liText.indexOf('Blanked the page') != -1 || liHTML.indexOf('mw-plusminus-neg') != -1 && liHTML.indexOf('<strong') != -1) {
rows[l].style.backgroundColor = '#FAA';
}
}
}
}
//addOnloadHook(recentChangesHighlights);
//Newpages highlight
function highlightShortNewpages () {
if (wgPageName == 'Special:Newpages') {
var targetContent = document.getElementById('bodyContent');
var links = targetContent.getElementsByTagName ("li");
for (var l = 0; l < links.length; l++) {
liContent = links[l].textContent;
sizeText = liContent.substring(liContent.indexOf('[')+1,liContent.indexOf('bytes]'));
sizeBytes = sizeText.replace(',', '');
if (sizeBytes > 10000) {
links[l].style.backgroundColor = '#DFD';
}
if (sizeBytes < 1500) {
links[l].style.backgroundColor = '#FEE';
}
if (sizeBytes < 1000) {
links[l].style.backgroundColor = '#FAA';
}
if (sizeBytes < 100) {
links[l].style.backgroundColor = '#f44';
}
}
}
}
//addOnloadHook(highlightShortNewpages);
//Tagging buttons
function addEditButtons() {
if (document.title.indexOf("Editing ") == 0) {
var toolbarhtml = ' — ';
toolbarhtml += '<span class="new" id="tag-buttons" style="background-color:#EEE; border: 1px solid gray; padding: 3px; font-family: courier;">';
toolbarhtml += '<a href="javascript:icu();" title="Add ICU tag">icu</a> — ';
toolbarhtml += '<a href="javascript:tag(\'{{ICU|~~~~~|sub=short}}\',\'+ICU. Needs more work\');" title="Add ICU (short) tag">icu-s</a> — ';
toolbarhtml += '<a href="javascript:tag(\'{{deadend}}\',\'+deadend. Please add wikilinks\');" title="Add Dead End tag">dead</a> — ';
toolbarhtml += '<a href="javascript:tag(\'{{MTUsign|~~~~~}}\',\'+MTU. Please move/expand/delete\');" title="Add Move To Undictionary tag">mtu</a> — ';
toolbarhtml += '<a href="javascript:tag(\'{{rewrite}}\',\'+rewrite\');" title="Add Rewrite tag">rw</a> — ';
toolbarhtml += '<a href="javascript:tag(\'{{expansion}}\',\'+expansion. Please expand this into a full article\');" title="Add Expand tag">exp</a> — ';
toolbarhtml += '<a href="javascript:tag(\'{{ugly}}\',\'+ugly. Please make this more presentable\');" title="Add Ugly tag">ugly</a> — ';
toolbarhtml += '<a href="javascript:tag(\'{{stub}}\',\'+stub\');" title="Add Stub tag">stub</a>';
if (wgPageName != 'Uncyclopedia:Votes_for_deletion') {
toolbarhtml += ' — <a href="javascript:tag(\'{{vfd}}\',\'+VFD\');" title="Add VFD tag">vfd</a>';
}
else if (location.href.indexOf('§ion=2') != -1 && wgReturnTo != -1) {
toolbarhtml += ' — <a href="javascript:vfd();" title="Add VFD nomination template">vfd</a>';
}
toolbarhtml += '</span>';
var newToolbarSpan = document.createElement('SPAN');
var toolbarDiv = document.getElementById('toolbar');
if (toolbarDiv) {
toolbarDiv.appendChild(newToolbarSpan);
newToolbarSpan.innerHTML = toolbarhtml;
}
};
};
//addOnloadHook(addEditButtons);
function tag(text, summary) {
document.editform.wpSummary.value = summary;
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 += text;
document.editform.wpSave.click();
}
function icu() {
var fix = prompt('Enter fix message, or leave blank');
if (fix == null) return;
var sub = prompt('Enter sub template name, or leave blank\nOptions: format, short, notfunny, random, encyclopedic, list, and original');
if (sub == null) return;
document.editform.wpSummary.value = '+ICU. This article needs some help, stat!';
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|~~~~~|fix=' + fix + '|sub=' + sub + '}}';
document.editform.wpSave.focus();
}
//Welcoming script
function welcomeslutbutton() {
if(document.title.indexOf("Editing User talk:") == 0) {
var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];
addlilink(tabs, 'javascript:welcomeslut()', 'welcome', 'ca-welcome');
}
}
addOnloadHook( welcomeslutbutton );
function welcomeslut() {
document.editform.wpSummary.value = 'Welcome new user! (I am a linkslut)';
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 += '{{subst:welcome}}\n~~~~';
// document.editform.wpSave.focus();
document.editform.wpSave.click();
// focus() sets focus on the save button.
// click() submits it automagically.
// Uncomment whichever you prefer -Spl
}
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;
}
//
function addNavLink(portlet, ident, href, text) {
p_main = document.getElementById(portlet);
p_list = p_main.getElementsByTagName('ul')[0];
p_link = document.createElement('a');
p_link.href = href;
p_link.appendChild(document.createTextNode(text));
p_line = document.createElement('li');
p_line.id = ident;
p_line.appendChild(p_link);
p_list.appendChild(p_line);
}
function addPortlet(title, ident) {
var sidebar = document.getElementById('column-one');
var outer = document.createElement('div');
var heading = document.createElement('h5');
var newbox = document.createElement('div');
var list = document.createElement('ul');
outer.setAttribute('class', 'portlet');
outer.setAttribute('id', ident);
newbox.setAttribute('class', 'pBody');
heading.textContent = title;
outer.appendChild(heading);
outer.appendChild(newbox);
newbox.appendChild(list);
sidebar.appendChild(outer);
};
function addAllPortlets() {
addPortlet('other tools','p-other-tools');
}
//addOnloadHook(addAllPortlets);
function addAllNavLinks() {
addNavLink('p-community', 'n-bhop', '/wiki/Forum:BHOP', 'BHOP');
addNavLink('p-other-tools', 'n-news', '/wiki/User:Starnestommy/Grue_Army_news', 'Grue Army News');
addNavLink('p-other-tools', 'n-base', '/wiki/User:High_Gen._Grue/GrueArmy', 'Grue Army Base');
addNavLink('p-other-tools', 'n-cash', '/wiki/User:Gert5/Yoinxx/Account:Starnestommy', 'blah');
addNavLink('p-other-tools', 'n-mypage', 'http://starnestommy.spaznet.net', 'meh');
}
//addOnloadHook(addAllNavLinks);
//WikiEd
//document.write('<script type="text/javascript" src="'
//+ 'http://en.wikipedia.org/w/index.php?title=User:Cacycle/wikEd.js'
//+ '&action=raw&ctype=text/javascript"></script>');
//document.write('<script type="text/javascript" src="'
//+ 'http://en.wikipedia.org/w/index.php?title=User:Cacycle/wikEdDiff.js'
//+ '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
//Sandbox reset tool
function sbresettab() {
if(wgPageName.indexOf("Sandbox") != -1) {
var x = document.getElementById('ca-history');
var y = document.getElementById('ca-edit');
var sbpage = wgPageName.replace(/ /, '_');
if((!x)&&(!y)) return;
var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];
if(document.title.indexOf("Editing") == -1) {
addlilink(tabs, 'http://uncyclopedia.wikia.com/index.php?title=' + sbpage + '&action=edit&sbreset=true', 'reset', 'ca-sbreset');
}
if(document.title.indexOf("Editing") != -1) {
addlilink(tabs, 'javascript:sbreset();', 'reset', 'ca-sbreset');
}
}
}
addOnloadHook(sbresettab);
function sbreset() {
document.getElementById('wpTextbox1').value = '{{sbtop}}';
document.getElementById('wpSummary').value = 'resetting sandbox';
document.getElementById('wpSave').click();
}
function sbautoreset() {
if(location.href.indexOf("sbreset=true") == -1) return;
sbreset();
}
addOnloadHook(sbautoreset);
//</pre>