//[[Category:User scripts|Mike.lifeguard]]// Outline for an automatic delete link generator.// Not highly tested. Started by Splarka @ test.wikipedia// Written for & maintained by Mike_lifeguard @ en.wikibooks//GO IF contribs or log or newpages or [article AND (submit|view|purge)]if(mw.config.get('wgCanonicalSpecialPageName')=="BrokenRedirects"||mw.config.get('wgCanonicalSpecialPageName')=="Contributions"||mw.config.get('wgCanonicalSpecialPageName')=="WhatLinksHere"||mw.config.get('wgCanonicalSpecialPageName')=="Log"||mw.config.get('wgCanonicalSpecialPageName')=="PrefixIndex"||mw.config.get('wgCanonicalSpecialPageName')=="NewPages"||(mw.config.get('wgIsArticle')==true&&(mw.config.get('wgAction')=="submit"||mw.config.get('wgAction')=="view"||mw.config.get('wgAction')=="purge")))addOnloadHook(function(){mw.util.addPortletLink('p-cactions','javascript:deleteLinkify()','Автоудаление','ca-dellink','создать ссылки для удаления');})functiondeleteLinkify(){varreason=prompt('Введите причину удаления','согласно [[ВП:КБУ]]');if(!reason)return;varlinks=document.getElementById('bodyContent').getElementsByTagName('a');vararp=mw.config.get('wgServer')+mw.config.get('wgArticlePath').replace(/\$1/,'');if(links.length==0)returnfor(vari=0;i<links.length;i++){if(links[i].href.replace(/https?:/,'').indexOf(arp)==0&&links[i].href.indexOf('action=delete')==-1&&links[i].href.indexOf('Служебная:')==-1){links[i].href+='?action=delete&submitdelete=true&deletetalkalso=true&wpReason='+encodeURIComponent(reason);links[i].innerHTML+=' (удалить)';}}}if(queryString('submitdelete')=='true')addOnloadHook(function(){if(document.getElementById('ca-talk').className.indexOf('new')==-1&&queryString('deletetalkalso')=='true'&&(mw.config.get('wgNamespaceNumber')%2==0)){//if the talk tab is redlinked and this is the first time 'round AND this is not a talk page then:document.getElementById('deleteconfirm').action+='&deletetalk=true&wpReason='+queryString('wpReason');}varsub=(document.getElementById('wpConfirmB'))?document.getElementById('wpConfirmB'):document.getElementById('mw-filedelete-submit')sub.click();})if(mw.config.get('wgAction')=='delete'&&queryString('deletetalk')=='true')addOnloadHook(function(){varurl=document.getElementById('ca-talk').getElementsByTagName('a')[0].href+'?action=delete&submitdelete=true&wpReason='+queryString('wpReason');document.location.href=url;})functionqueryString(p){varre=RegExp('[&?]'+p+'=([^&]*)');varmatches;if(matches=re.exec(document.location)){try{returndecodeURI(matches[1]);}catch(e){}}returnnull;}