User:GeorgeMoney/UserScripts/autodel
From Wikipedia, the free encyclopedia
//
var pathurl = "http://en.wikipedia.org/w/index.php"; var p = wgPageName; //REST OF PAGES ARE IN SETTINGS, ONLY ALTER THESE FOR PERMANENT var pagestochangelink = p=='sfdfsdf'||p=='fgdfgsdf'||p=='ddfgdsfg'; var autoclose = false; //still under development. please keep false //------------- BEGIN AUTODELETE CODE -------- //---------------------------------DO NOT EDIT UNDER THIS LINE IF YOU DONT KNOW JAVASCRIPT var summary = readCookie('delsummary'); var blacklist = (p == 'Main_Page'); var pages = (p == readCookie('dellinkchange') || pagestochangelink); function isbadpage() { if(blacklist) { return true; } else { return false; } } if(readCookie('delcookieset') != 'yes' && window.location.href.indexOf('delmanage') == -1 && readCookie('deldisabled') != 'yes') { window.location.href = ('http://en.wikipedia.org/wiki/User:GeorgeMoney/delmanage'); } function enabledel() { createCookie('deldisabled', 'no', 365); alert('AutoDelete Successfully Enabled'); window.location.href = (window.location.href.replace('delenable', 'delmanage')); } if(window.location.href.indexOf('delenable') != -1) { addOnloadHook(function(){ enabledel(); }); } if(!isbadpage() && readCookie('deldisabled') != 'yes') { function docookies() { var inputboxsum = document.getElementById('delsummary').value; var inputboxlinkpage = document.getElementById('dellinkchange').value; var inputboxlinkpage = inputboxlinkpage.replace(' ', '_'); createCookie('delsummary', inputboxsum, 365); createCookie('dellinkchange', inputboxlinkpage, 365); createCookie('delcookieset', 'yes', 365); createCookie('deldisabled', 'no', 365); alert('Settings saved!'); window.location.href = (window.location.href); } function disabledel() { createCookie('deldisabled', 'yes', 365); alert('AutoDelete Successfully Disabled. To re-enable it add "delenable" to the url. it is the only way to re-enable'); window.location.href = (window.location.href); } function changecontents() { document.getElementById('bodyContent').innerHTML = '<div class="dontshow" style="display: none !important;"></div>\n' + '<h1 class="firstHeading" style="display:block;">Deletion Script Manager</h1>\n' + 'Deletion summary: <input type="text" id="delsummary" value="' + readCookie('delsummary') + '" /><br>\n'+ 'Page to alter links: <input type="text" id="dellinkchange" value="' + readCookie('dellinkchange') + '" /><br>\n' + '<input type="button" value="save settings" onclick="docookies();" accesskey="s" /><br>\n' + '<input type="button" value="disable autodelete" onclick="disabledel();" accesskey="s" /><br>\n' + '<h3>Notes</h3>\n<input type="button" value="save notes" onclick="createCookie(\'delnotes\', escape(document.getElementById(\'delnotes\').value), 365);" /><textarea rows="50" id="delnotes" style="width:100%;">' + unescape(readCookie('delnotes')) + '</textarea>' + '' + '' + '' + ''; document.write('<style type="text/css">.firstHeading, .editsection {display:none;} .dontshow { display: none !important; } #content {background: honeydew !important; border: 3px solid green;} #p-cactions {display: none;}</style>'); } if(window.location.href.indexOf('delmanage') != -1) { addOnloadHook(function(){ changecontents(); }); } function dodelete() { var mydel = document.getElementById('wpReason'); var olddelsum = mydel.value; var newdelsum = summary+" "+olddelsum; document.getElementById('wpReason').value = newdelsum; var inputs = document.getElementsByTagName('input'); for (i=0; i<inputs.length; i++) { if (inputs[i].name == 'wpConfirmB') { inputs[i].click(); } } if(autoclose) { window.close(); } } if (window.location.href.indexOf('action=delete') != -1 && window.location.href.indexOf('autodelete=1') != -1) { addOnloadHook(function(){ dodelete(); }); } if(wgCanonicalNamespace != "Special") { addOnloadHook(function(){ var taburl = pathurl+"?title="+wgPageName+"&action=delete&autodelete=1&usedtab=1"; var taburl2 = pathurl+"?title=User:GeorgeMoney/delmanage"; addTab(taburl, "auto delete", "ca-autodel", "Delete automatically with CFD summary", "a"); addTab(taburl2, "deletion manager", "ca-autodelm", "Delete automatically with CFD summary", "a"); }); } if (pages) { addOnloadHook(function(){ var len=document.links.length; for(var i=0; i<len; ++i) { var l=document.links[i]; if (l.className != 'new' && l.parentNode.id != "ca-autodel" && l.parentNode.id != "ca-edit" && l.parentNode.id != "ca-delete" && l.parentNode.id != "ca-protect") { l.href=l.href+"?action=delete&autodelete=1"; l.style.cursor = "crosshair"; l.style.color = "green"; } } }); } } // ---------------------- END AUTODELETE CODE //