ميدياويكي:Gadget-easydb.js

ملاحظة: بعد الحفظ، قد يلزمك إفراغ الكاش لرؤية التغييرات.

/*Script to tag pages for speedy deletion - User:Anonlta/easydb.js*/
function csdShowBox(){var e=document.editform;var t=document.createElement("div");t.align="center";var n=document.createElement("div");n.id="dbContainer";n.align="center";n.style.width="250px";n.style.backgroundColor="#fee";n.style.border="2px solid #b22222";var r=document.createElement("h4");r.innerHTML="Delete because:";n.appendChild(r);var i=document.createElement("button");i.id="csdOption1";i.innerHTML="CSD";i.style.marginBottom="5px";i.style.marginRight="20px";i.style.width="100px";i.onclick=csdRedPill;n.appendChild(i);var s=document.createElement("button");s.id="csdOption2";s.innerHTML="Reason";s.style.marginBottom="5px";s.style.width="100px";s.onclick=csdBluePill;n.appendChild(s);t.appendChild(n);e.parentNode.insertBefore(t,e)}function csdRedPill(){var e=document.getElementById("dbContainer");var t=document.getElementById("csdOption1");var n=document.getElementById("csdOption2");t.parentNode.removeChild(t);n.parentNode.removeChild(n);var r=document.createElement("select");csdDeleteForm.FillSelect(r,csdDeleteForm.ValueArray);r.name="csdOptions";r.id="csdOptions";r.style.marginLeft="10px";r.style.marginBottom="8px";e.appendChild(r);var i=document.createElement("br");e.appendChild(i);var s=document.createElement("button");s.innerHTML="Delete";s.style.marginBottom="5px";s.onclick=csdSubmitAction;e.appendChild(s)}function csdBluePill(){var e=document.getElementById("dbContainer");var t=document.getElementById("csdOption1");var n=document.getElementById("csdOption2");t.parentNode.removeChild(t);n.parentNode.removeChild(n);var r=document.createElement("input");r.type="text";r.size="25";r.name="dbReason";r.id="dbReason";e.appendChild(r);var i=document.createElement("br");e.appendChild(i);var s=document.createElement("button");s.innerHTML="Delete";s.style.marginBottom="5px";s.onclick=csdSubmitReason;e.appendChild(s)}function csdSubmitAction(){var e=document.getElementById("csdOptions").value.split("+");var t=e[0];var n=e[1];if(!n){n=t.toLowerCase()}if(e.length>2){var r="";var i=null;for(var s=2;s<e.length;s++){i=prompt(e[s]);if(i!=null&&i!=""){r=r.concat("|",i)}}n=n.concat(r)}var o=document.editform,u=o.wpTextbox1;u.value="{"+"{db-"+n+"}}\n"+u.value;o.wpSummary.value="JS: Requesting speedy deletion ([[WP:CSD#"+t+"|CSD "+t.toUpperCase()+"]])";o.wpSave.click();return}function csdSubmitReason(){var e=document.getElementById("dbReason").value;if(e=="")return;var t=document.editform,n=t.wpTextbox1;n.value="{"+"{db|"+e+"}}\n"+n.value;t.wpSummary.value="JS: Requesting speedy deletion";t.wpSave.click();return}function easyDb(){var e=wgPageName.replace("&","%26").replace("+","%2B");location.assign("/w/index.php?&action=edit&easydb&title="+e)}var csdDeleteForm={FillSelect:function(e,t){for(var n=0;n<t.length;n++){var r=new Option(t[n].display,t[n].value);if(r.innerHTML!=t[n].display){r.innerHTML=t[n].display}if(t[n].value==""){r.style.color="gray";r.disabled=true}e.appendChild(r)}return true},ValueArray:[{value:"",display:"General"},{value:"G1",display:"G1 - Nonsense"},{value:"G2",display:"G2 - Test Pages"},{value:"G3+vandalism",display:"G3 - Pure Vandalism"},{value:"G3+pagemove",display:"G3 - Nonsense Redirect"},{value:"G4",display:"G4 - Recreated Deleted"},{value:"G5+banned+Name of banned user",display:"G5 - Banned User"},{value:"G6+histmerge+Page to merge history from",display:"G6 - History Merge"},{value:"G6+move+Target location+Reason for move",display:"G6 - Move"},{value:"G6+copypaste+otherpage=?",display:"G6 - Copypaste Cleanup"},{value:"G6+xfd",display:"G6 - Marked for Deletion"},{value:"G6+maintenance",display:"G6 - Housekeeping"},{value:"G7+author",display:"G7 - Author Request"},{value:"G7+blanked",display:"G7 - Author Blanked"},{value:"G8+talk",display:"G8 - Orphaned Talk Page"},{value:"G8+subpage",display:"G8 - Orphaned Subpage"},{value:"G8+imagepage",display:"G8 - Orphaned Image Page"},{value:"G10",display:"G10 - Attack Pages"},{value:"G11",display:"G11 - Advertising"},{value:"G12+copyvio+url=?",display:"G12 - Copyright"},{value:"",display:"Articles"},{value:"A1",display:"A1 - No Context"},{value:"A2",display:"A2 - Foreign Language"},{value:"A3",display:"A3 - No Content"},{value:"A5",display:"A5 - Transwikied"},{value:"A7+bio",display:"A7 - Unremarkable Bio"},{value:"A7+person",display:"A7 - Unremarkable Person"},{value:"A7+band",display:"A7 - Unremarkable Band"},{value:"A7+club",display:"A7 - Unremarkable Group"},{value:"A7+inc",display:"A7 - Unremarkable Corporation"},{value:"A7+web",display:"A7 - Unremarkable Website"},{value:"",display:"Redirects"},{value:"R1",display:"R1 - Bad Target"},{value:"R2",display:"R2 - User Page Redirect"},{value:"R3",display:"R3 - Implausible Typo"},{value:"",display:"Images"},{value:"I1+i1+replacement image.ext",display:"I1 - Redundant"},{value:"I2",display:"I2 - Corrupt/Empty"},{value:"I3",display:"I3 - Improper License"},{value:"I4",display:"I4 - Lack of License"},{value:"I5",display:"I5 - Unused Unfree"},{value:"I6",display:"I6 - No Fair Use"},{value:"I7",display:"I7 - Invalid Fair Use"},{value:"I8+i8+Name on commons.ext",display:"I8 - On Commons"},{value:"I9+imgcopyvio+url=?",display:"I9 - Copyright"},{value:"I10",display:"I10 - Bad File Type"},{value:"",display:"Categories"},{value:"C1",display:"C1 - Empty"},{value:"C2",display:"C2 - Speedy Rename"},{value:"C3",display:"C3 - Template Deleted"},{value:"",display:"User Pages"},{value:"U1",display:"U1 - User Request"},{value:"U2",display:"U2 - No User"},{value:"U3",display:"U3 - Fair Use Gallery"},{value:"",display:"Templates"},{value:"T1",display:"T1 - Divisive"},{value:"T2",display:"T2 - Policy"},{value:"T3+t3|11:40, 3 October 2008 (UTC)+Other template name",display:"T3 - Duplicate or Inferior"},{value:"",display:"Portals"},{value:"P2",display:"P2 - Underpopulated"}]};$(function(){if(document.URL.lastIndexOf("&easydb")!=-1){if(document.title.indexOf("تحرير ")==-1)return;if(wgCurRevisionId==false){alert("The page has already been deleted.");return}csdShowBox()}if(wgCanonicalNamespace=="Special")return;mw.util.addPortletLink("p-cactions","javascript:easyDb()","easy db","ca-db","Request speedy deletion","")})