User:Veinor/csd.js

// function checkDb { if (document.getElementById("wpTextbox1") != null) { var hastag = document.getElementById("wpTextbox1").value.match(/\{\{((db-[^{]+)|deletedpage)\}\}/); var deleted = (document.getElementById("newarticletext") != null) var csdtagging = (document.URL.match(/Tagged%20for%20speedy%20deletion/) != null) if ((hastag || deleted) && csdtagging) { alert("Page already has CSD tag."); history.back; } } } addOnloadHook(function { if (document.title.indexOf("Editing ") != 0 && (document.URL.search(/\?/) == -1 || document.URL.search(/http:\/\/en.wikipedia.org\/w\/index.php\?title=/) != -1))  {     mw.util.addPortletLink('p-cactions', "javascript:easyDb(0)", "db-", "ca-db0", "db-", "");     mw.util.addPortletLink('p-cactions', "javascript:easyDb(1)", "db|", "ca-db1", "db|", "");

} }); function easyDb(n) { var db;  if (n == 0) {db="db-";}  if (n == 1) {db="db|";}  var type = prompt("What is X in Template:" + db + "X ?");  if (type == null || type == "") return;  var currlocation = document.URL;  document.location = document.URL + "?action=edit&autoedit=s/^/\\n\\n/&autosummary=Tagged for speedy deletion&autoclick=wpSave"; }

addOnloadHook(checkDb); //