User:Lyrithya/welcome.js

From Uncyclopedia, the content-free encyclopedia
Jump to navigation Jump to search

Note: After saving, you have to bypass your browser's cache to see the changes.

  • Internet Explorer: hold down the Ctrl key and click the Refresh or Reload button, or press Ctrl+F5.
  • Firefox: hold down the Shift key while clicking Reload; alternatively press Ctrl+F5 or Ctrl-Shift-R.
  • Opera, Konqueror and Safari users can just click the Reload button.
  • Chrome: press Ctrl+F5 or Shift+F5
//<nowiki>

function welcomebutton() {
	if(document.title.indexOf("Editing User talk:") == 0 || wgPageName == "User:Lyrithya/welcome.js") { 
		if (tabbedls == true) addPortletLink('p-cactions', 'javascript:welcomes(0)', 'WC', 'ca-welcome', 'Welcome this user to Uncyclopedia');
		else addPortletLink('p-cactions', 'javascript:welcomes(0)', 'Welcome', 'ca-welcome', 'Welcome this user to Uncyclopedia');
		var welcomeBox = new Array(3);
		welcomeBox[0] = ['javascript:welcomes(1)', 'Welcome'];
		welcomeBox[1] = ['javascript:welcomes(2)', 'Hello'];
		welcomeBox[2] = ['javascript:welcomes(3)', 'Oh dear'];
		addCactionsDropdown('ca-welcome', welcomeBox);
	}
}
function welcomelink() {
	alinks = document.getElementsByTagName('a');
	for(i = 0; i < alinks.length; i++) {
		if(alinks[i].getAttribute('class') != 'new' || alinks[i].innerHTML != 'Talk' || alinks[i-1].getAttribute('title').indexOf('User:') != 0)
		continue;
		alinks[i].setAttribute('style', 'font-weight:bold; color: #e50000;');
	}
}

YAHOO.util.Event.onContentReady('p-cactions', welcomebutton);
addOnloadHook( welcomelink );

function welcomes(q) {
	switch (q) {
	case 0:
		sumnary = 'Welcome.';
		tlxt = 'Welcome';
		break;
	case 1:
		sumnary = 'Welcome.';
		tlxt = 'User:Lyrithya/welcome';
		break;
	case 2:
		sumnary = 'Hello.';
		tlxt = 'User:Lyrithya/welcome|no';
		break;
	case 3:
		sumnary = 'Oh dear.';
		tlxt = 'User:Lyrithya/welcome|crap';
		break;
	}	
	document.editform.wpSummary.value = sumnary;
	document.editform.wpMinoredit.checked = true;
	document.editform.wpWatchthis.checked = false;
	var txt = document.editform.wpTextbox1;
	if(txt.value.length > 0) txt.value += '\n';
	txt.value += '{{SUBST:' + tlxt + '}} ~~~';
	document.editform.wpSave.click();
}

//</nowiki>