Jump to content

User:B. Wolterding/prod-wpnn.js

From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
// "Proposed deletion" automation for the Notability wikiproject

$(addDeletionLink);

function addDeletionLink(){
  if (/[?&]action=edit/.test(window.location.href) && !(/[?&]title=(Talk|User|User talk):/.test(window.location.href)) ) {
	addPortletLink ('p-tb', 'javascript:proposeDeletion()', 'Propose deletion (WPNN)');
  }
}

function proposeDeletion() {

  var reason = prompt("Enter the rationale for deletion:","Fails [[WP:N]]; no independent sources cited.");

  if (reason) {
  	var prodtag = "{"+"{subst:prod|"+reason+"}}\n";
  	var editsummary = "Proposal for deletion. Sorted as part of the [[WP:WPNN|Notability wikiproject]].";

  	var textbox = document.editform.wpTextbox1;

  	textbox.value = prodtag + textbox.value;

  	var edits = document.editform.wpSummary;

  	edits.value = editsummary;

	document.editform.wpWatchthis.checked = true;

	document.editform.wpPreview.click();
  }

}