User:Spang/uncyclopedia.js

From Uncyclopedia, the content-free encyclopedia
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>
var disableDeletionReasons=true;var disableUsernameReplace=true;var enableOldForumEdit=true;qeSignature='~~~';
document.write('<script type="text/javascript" src="'+'http://uncyclopedia.wikia.com/index.php?title=User:Spang/autodelete.js'+'&action=raw&ctype=text/javascript"></script>');
document.write('<script type="text/javascript" src="'+'http://uncyclopedia.wikia.com/index.php?title=User:Spang/searchbox.js'+'&action=raw&ctype=text/javascript"></script>');
document.write('<script type="text/javascript" src="'+'http://uncyclopedia.wikia.com/index.php?title=User:Spang/TaggedNewPages.js'+'&action=raw&ctype=text/javascript"></script>');

function main(){setEditForm();var newbox=initNewBox();addLinks(newbox);srInit();/*addEditButtons()*/;extraTabs();addRevert();addDeadEndLinks();highlightShortNewpages();recentChangesHighlights();addbotcontrib()};YAHOO.util.Event.onDOMReady(main);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].className='new-long'};if(sizeBytes<1500){links[l].className='new-shortish'};if(sizeBytes<1000){links[l].className='new-short'};if(sizeBytes<100){links[l].className='new-shortest'}}}};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('class="newpage"')!=-1){rows[l].style.backgroundColor='#DFD'};if(liText.indexOf('Blanked the page')!=-1||liHTML.indexOf('<strong class="mw-plusminus-neg">')!=-1){rows[l].style.backgroundColor='#FAA'}}}};function addDeadEndLinks(){if(wgPageName=='Special:DeadendPages'){var targetContent=document.getElementById('bodyContent');var links=targetContent.getElementsByTagName("li");for(var l=0;l<links.length;l++){liContent=links[l].innerHTML;pageName=liContent.substring(liContent.indexOf('/wiki/')+6,liContent.indexOf('title=')-2);links[l].innerHTML='(<span class="plainlinks"><a href="http://uncyclopedia.wikia.com/index.php?title='+pageName+'&action=history">hist</a>) (<a href="http://uncyclopedia.wikia.com/index.php?title='+pageName+'&diff=cur&last=prev">diff</a>) . . '+liContent}}};function initNewBox(){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');newbox.setAttribute('class','pBody');list.id='linkbox';heading.textContent='linkbox';outer.appendChild(heading);outer.appendChild(newbox);newbox.appendChild(list);sidebar.appendChild(outer);return list};function addLinks(newbox){addToolboxLink('VFH','/wiki/Uncyclopedia:VFH/summary',newbox);addToolboxLink('FQ','/wiki/Uncyclopedia:VFH/queue',newbox);addToolboxLink('VFP','/wiki/Uncyclopedia:VFP',newbox);addToolboxLink('New pages','/wiki/Special:NewPages',newbox);addToolboxLink('Maintenance','/wiki/Uncyclopedia:Maintenance',newbox);addToolboxLink('VFD','/wiki/Uncyclopedia:Votes for deletion',newbox);addToolboxLink('QVFD','/wiki/Uncyclopedia:QuickVFD',newbox);addToolboxLink('Ban Patrol','/wiki/Uncyclopedia:Ban Patrol',newbox);addToolboxLink('JavaScript Edit','/index.php?title=User:'+wgUserName+'/uncyclopedia.js&action=edit',newbox);addToolboxLink('CSS Edit','/index.php?title=User:'+wgUserName+'/uncyclopedia.css&action=edit',newbox)};function addToolboxLink(text,url,parent){var newLink=document.createElement("li");newLink.innerHTML='<a href="'+url+'">'+text+'</a>';parent.appendChild(newLink);return newLink};function extraTabs(){if(!document.getElementById('ca-edit'))return;addTab('diff','http://uncyclopedia.wikia.com/index.php?title='+escape(wgPageName)+'&diff=cur&last=prev','tab-diff');addTab('edit 0','http://uncyclopedia.wikia.com/index.php?title='+escape(wgPageName)+'&action=edit&section=0','tab-edit-0');addTab('purge','http://uncyclopedia.wikia.com/index.php?title='+escape(wgPageName)+'&action=purge','tab-purge');addTab('g','http://www.google.com/search?hl=en&lr=&safe=off&q='+escape(wgPageName).replace(/_/g,'+'),'tab-search-google');addTab('wp','http://www.google.com/search?q=site:wikipedia.org&q='+escape(wgPageName).replace(/_/g,'+'),'tab-search-wikipedia');addTab('un','http://uncyclopedia.wikia.com/wiki/Special:Search?search='+escape(wgPageName).replace(/_/g,'+')+'&fulltext=Search','tab-search-uncyc')};function addTab(text,url,id){var tabs=document.getElementById('ca-edit').parentNode;if(!tabs)return false;var newTab=document.createElement("li");newTab.innerHTML='<a " href="'+url+'">'+text+'</a>';tabs.appendChild(newTab);newTab.id=id;return newTab};function addbotcontrib(){if(!document.getElementById)return;if(wgPageName != "Special:Contributions")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,'bot rollback','ca-botcontribs')};function addEditButtons(){if(document.title.indexOf("Editing ")==0){var toolbarhtml=' — ';toolbarhtml+='<span class="new" style="background-color:#EEE; border: 1px solid gray; padding: 3px;">';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>';toolbarhtml+='</span>';var newToolbarSpan=document.createElement('SPAN');var toolbarDiv=document.getElementById('toolbar');if(toolbarDiv){toolbarDiv.appendChild(newToolbarSpan);newToolbarSpan.innerHTML=toolbarhtml}}};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()};function getTemplate(){if(document.getElementById('toolbar')){var toolbarDiv=document.getElementById('toolbar');var getTemplateButton=document.createElement('A');toolbarDiv.appendChild(getTemplateButton);getTemplateButton.innerHTML='<a href="javascript:getTemplateOpenPage();"><img src="http://uncyclopedia.wikia.com/images/0/0f/Button_get_template.png" alt="Get the code of a template"></a>'}};function getTemplateOpenPage(){var templateName=prompt('Name of page to get?','Template:');if(templateName==null)return;var templatePage='http://uncyclopedia.wikia.com/index.php?title='+templateName+'&action=raw&ctype=text/javascript';window.open(templatePage,"templateWindow","toolbar=no, scrollbars=yes, resizable=yes, width=700, height= 350")};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 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="Reverted edit(s) of [[Special:Contributions/"+name2.textContent+"|"+name2.textContent+"]] to previous one by "+name1.textContent;linkSpan.innerHTML="&nbsp;&nbsp;";revertLink.innerHTML="[Auto-Revert]";revertLink.href=link.href+"&action=edit&setsubmit=wpSave&setsummary="+summaryText+"&setwatch=0";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};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 mwWikiaUploadButton(namespace,tooltip){};
function quantserve() {};
function GA_googleFillSlot(a) { a = 'annoying'};
function GA_googleFillSlotWithSize(a) { a = 'annoying'};
function GS_googleAddAdSenseService(a) { a = 'annoying'};
function GS_googleEnableAllServices() { a = 'annoying'};
function GA_googleUseIframeRendering() { a = 'annoying'};
function GA_googleAddAttr(a, b) { };
function GA_googleAddAdSensePageAttr(a, b) { };