User:Casper2k3/Javascript/prod.js

Source: 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.
//<nowiki>
function doProd(){
document.getElementById('jsWaitMessageBox').innerHTML = '<br><h2>Prodding article - Please wait...</h2>';
var urlArticle = prompt("What is prod reason?");
doTag('prod', '|'+urlArticle, 'Prodding article - reason: '+urlArticle);
};
function doProd2(){
document.getElementById('jsWaitMessageBox').innerHTML = '<br><h2>Prodding article - Please wait...</h2>';
doTag('prod2', '', 'Endorsing prod');
};
function doEndorseReason(){
document.getElementById('jsWaitMessageBox').innerHTML = '<br><h2>Prodding article - Please wait...</h2>';
var urlArticle = prompt("What is prod endorse reason?");
doTag('prod2a', '|'+urlArticle, 'Endorsing prod');
};
function doTag(tag, exInfo, reason){
document.location = document.URL + "?action=edit&autoedit=s/^/\n{{sub" + "st:" + tag + exInfo + "}}\n/&autosummary=" + reason + " by [[User:Casper2k3|Casper2k3]] ([[WP:WPPDP]])&autoclick=wpSave";
};

$(function (){
  //Add the links
  if (location.href.indexOf("&action=edit&issueuserprod=") == -1) return; //Are we here to issue a warning?
  //Get new warning
  userprodRegExp = /&action=edit&issueuserprod=(.*)/;
  userprod = userprodRegExp.exec(location.href)[1];
  //Modify the form
document.getElementById('wpSummary').value = "{{" + userprod + "}} by [[User:Casper2k3|Casper2k3]] ([[WP:WPPDP]])";
document.getElementById('wpTextbox1').value +=  "\n{{sub" + "st:" + userprod + "}} --~" + "~" + "~" + "~";
document.getElementById('editform').submit();

});

$(function (){
  //Add the links
  if (location.href.indexOf("&action=edit&issueuserprodnamed=") == -1) return; //Are we here to issue a warning?
  //Get new warning
  userprodRegExp = /&action=edit&issueuserprodnamed=(.*)/;
var urlArticle = prompt("What is article name?");
if(urlArticle == "" || urlArticle == null){
alert ("You didn't enter the name of the page! Prod message cancelled.")
 return;
}
  userprod = userprodRegExp.exec(location.href)[1];
  //Modify the form
document.getElementById('wpSummary').value = "{{" + userprod + "|" + urlArticle + "}} by [[User:Casper2k3|Casper2k3]] ([[WP:WPPDPfini]])";
document.getElementById('wpTextbox1').value +=  "\n{{sub" + "st:" + userprod + "|" + urlArticle+ "}} --~" + "~" + "~" + "~";
document.getElementById('editform').submit();

});

var userprodUrl = "http://en.wikipedia.org/w/index.php?title=User_talk:" + wgTitle + "&action=edit&issueuserprod=";
var userprodUrlNamed = "http://en.wikipedia.org/w/index.php?title=User_talk:" + wgTitle + "&action=edit&issueuserprodnamed=";


function prodButton(){
document.getElementById('jsArticleMessageBox').innerHTML = '<div style="background-color:yellow; -moz-border-radius:15px;">&nbsp;[Prod Article]: <a href="javascript:doProd()"><font color="#0000FF">Issue Prod</font></a><sup>(<a href="http://en.wikipedia.org/wiki/Template:Prod" target="_blank"><font color="#0000FF">+</font></a>)</sup> - <a href="javascript:doProd2()"><font color="#0000FF">Endorse Prod</font></a><sup>(<a href="http://en.wikipedia.org/wiki/Template:Prod-2" target="_blank"><font color="#0000FF">+</font></a>)</sup><br>&nbsp;[Prod re-added after being removed, or Prod on an article previously up for AfD]: <sup>(Deprod)</sup> <a href="' + userprodUrlNamed + 'deprod-reprod"><font color="#0000FF">Prodder message</font></a><sup>(<a href="http://en.wikipedia.org/wiki/Template:Deprod-reprod" target="_blank"><font color="#0000FF">+</font></a>)</sup><br>&nbsp;[Prod and AfD on the same article]: <sup>(Deprod)</sup> <a href="' + userprodUrlNamed + 'deprod-reprod"><font color="#0000FF">Prodder message</font></a><sup>(<a href="http://en.wikipedia.org/wiki/Template:Deprod-reprod" target="_blank"><font color="#0000FF">+</font></a>)</sup><br>&nbsp;[Prod on an article you dont want to have deleted]: <sup>(Deprod)</sup> <a href="' + userprodUrlNamed + 'deprod-disagree"><font color="#0000FF">Prodder message</font></a><sup>(<a href="http://en.wikipedia.org/wiki/Template:Deprod-disagree" target="_blank"><font color="#0000FF">+</font></a>)</sup><br>&nbsp;[Prod on an article you feel may be controversial to delete]: <sup>(Deprod)</sup> Consider sending to AfD, if you do:<a href="' + userprodUrlNamed + 'deprod-afd"><font color="#0000FF">Prodder message</font></a><sup>(<a href="http://en.wikipedia.org/wiki/Template:Deprod-afd" target="_blank"><font color="#0000FF">+</font></a>)</sup> - otherwise:<a href="' + userprodUrlNamed + 'deprod-contro"><font color="#0000FF">Prodder message</font></a><sup>(<a href="http://en.wikipedia.org/wiki/Template:Deprod-contro" target="_blank"><font color="#0000FF">+</font></a>)</sup><br>&nbsp;[Prod left without using an edit summary]: <sup>(Leave prod)</sup> <a href="' + userprodUrl + 'prod-summary"><font color="#0000FF">Prodder message</font></a><sup>(<a href="http://en.wikipedia.org/wiki/Template:Prod-summary" target="_blank"><font color="#0000FF">+</font></a>)</sup><br>&nbsp;[Prod reason missing or inadequate for deletion]: <sup>(Leave prod)</sup> <a href="javascript:doEndorseReason()"><font color="#0000FF">Endorse prod with reason</font></a><sup>(<a href="http://en.wikipedia.org/wiki/Template:Prod-2a" target="_blank"><font color="#0000FF">+</font></a>)</sup> - <a href="' + userprodUrled + 'prod-reason"><font color="#0000FF">Prodder message</font></a><sup>(<a href="http://en.wikipedia.org/wiki/Template:Prod-reason" target="_blank"><font color="#0000FF">+</font></a>)</sup><br>&nbsp;[Prod on article someone worked hard on]: <sup>(Leave prod)</sup> <a href="' + userprodUrlNamed + 'prodnote"><font color="#0000FF">If creator not notified of prod, leave note</font></a><sup>(<a href="http://en.wikipedia.org/wiki/Template:prodnote" target="_blank"><font color="#0000FF">+</font></a>)</sup><br></div>';
};
//</nowiki>