User:Spang/autodelete.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
function autoDelete(){if(document.getElementById('ca-delete')!=undefined&&window.location.href.indexOf("&action=delete")==-1){document.getElementById('ca-delete').getElementsByTagName('a')[0].innerHTML='delete ↓';var deleteUrl=document.getElementById('ca-delete').firstChild+'';if(wgCanonicalNamespace=='Image')deleteUrl+='&image='+wgTitle;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=Fails QA. Read [[BGBU|The beginner\'s guide]] and [[HTBFANJS]]">sucks</a>';deleteBox+='<a href="'+deleteUrl+'&setdelconfirm=wpConfirmB&wpReason=Vanity. See [[UN:VAIN]].">vanity</a>';deleteBox+='<a href="'+deleteUrl+'&setdelconfirm=wpConfirmB&wpReason=[[ICU]] expired">icu expired</a>';deleteBox+='<a href="'+deleteUrl+'&setdelconfirm=wpConfirmB&wpReason=[[vfd|Voted for deletion]]">vfd</a>';if(document.cookie.indexOf('lastDelReason')!=-1){var cStart=document.cookie.indexOf('lastDelReason')+14;var cEnd=document.cookie.indexOf(';',cStart);if(cEnd==-1)cEnd=document.cookie.length;lastReason=unescape(document.cookie.substring(cStart,cEnd));deleteBox+='<a href="'+deleteUrl+'&setdelconfirm=wpConfirmB&wpReason='+escape(lastReason)+'">last: <i>'+lastReason.substr(0,10)+'...</i></a>'}deleteBox+='<a accesskey="g" href="javascript:var delReason=prompt(\'Enter deletion reason\');if (delReason != null) {document.cookie= \'lastDelReason=\' + escape(delReason) + \'; path=/\'; window.location=\''+escape(deleteUrl)+'&setdelconfirm=wpConfirmB&wpReason=\' + escape(delReason); };">custom...</a>';deleteBox+='</div>';document.getElementById('ca-delete').innerHTML+=deleteBox}};YAHOO.util.Event.onDOMReady(autoDelete);function setDeleteForm(){var deleteconfirm=document.getElementById("deleteconfirm");if(!deleteconfirm)return;var summaryText=queryString('setsummary');if(summaryText){var summary=document.getElementsByName("wpSummary")[0];if(summary)summary.value=summaryText}var setDelConfirm=queryString('setdelconfirm');if(setDelConfirm){var btn=document.getElementsByName(setDelConfirm)[0];if(deleteconfirm&&btn){btn.textContent+=" (auto clicking...)";btn.click()}}};YAHOO.util.Event.onDOMReady(setDeleteForm);function queryString(p){var re=RegExp('[&?]'+p+'=([^&]*)');var matches;if(matches=re.exec(document.location)){try{return decodeURI(matches[1])}catch(e){}}return null};document.write('<link rel="stylesheet" type="text/css" href="'+'http://en.uncyclopedia.co/w/index.php?title=User:Spang/autodelete.css'+'&action=raw&ctype=text/css">');