User:Casper2k3/Javascript/prod.js
Appearance
Code that you insert on this page could contain malicious content capable of compromising your account. If you import a script from another page with "importScript", "mw.loader.load", "iusc", or "lusc", take note that this causes you to dynamically load a remote script, which could be changed by others. Editors are responsible for all edits and actions they perform, including by scripts. User scripts are not centrally supported and may malfunction or become inoperable due to software changes. A guide to help you find broken scripts is available. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. This code will be executed when previewing this page. |
Documentation for this user script can be added at User:Casper2k3/Javascript/prod. |
//<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;"> [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> [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> [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> [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> [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> [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> [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> [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>