Jump to content

User:Casper2k3/Javascript/userwelcomebutton.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.
//<nowiki>
addOnloadHook(function (){
  //Add the links
  if (location.href.indexOf("&action=edit&issuewelcome=") == -1) return; //Are we here to issue a welcome?
  //Get new welcome
  welcomeRegExp = /&action=edit&issuewelcome=(.*)/;
  welcome = welcomeRegExp.exec(location.href)[1];
  //Modify the form
document.getElementById('wpSummary').value = "Welcome message: {{" + welcome + "}} by [[User:Casper2k3|Casper2k3]] ([[WP:RCP]])";
document.getElementById('wpTextbox1').value +=  "\n{{sub" + "st:" + welcome + "}} --~" + "~" + "~" + "~";
document.getElementById('editform').submit();

});

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

});

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

});

var welcomeUrl = "http://wiki.riteme.site/w/index.php?title=User_talk:" + wgTitle + "&action=edit&issuewelcome=";
var welcomeUrlNoSign = "http://wiki.riteme.site/w/index.php?title=User_talk:" + wgTitle + "&action=edit&issuewelcomenosign=";
var welcomeUrlNamed = "http://wiki.riteme.site/w/index.php?title=User_talk:" + wgTitle + "&action=edit&issuewelcomenamed=";

function userWelcomeButton(){
document.getElementById('jsArticleMessageBox').innerHTML = '<div style="background-color:yellow; -moz-border-radius:15px;">&nbsp;[General]: <a href="' + welcomeUrl + 'anon"><font color="#0000FF">Anon</font></a><sup>(<a href="http://wiki.riteme.site/wiki/Template:Anon" target="_blank"><font color="#0000FF">+</font></a>)</sup> - <a href="' + welcomeUrlNoSign + 'Welcomeg"><font color="#0000FF">Standard</font></a><sup>(<a href="http://wiki.riteme.site/wiki/Template:Welcomeg" target="_blank"><font color="#0000FF">+</font></a>)</sup><br></div>';
};
//</nowiki>