User:Technical 13/SandBox/ACCHelp.js/Special:Userlogin.js

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.
/*
var api = new mw.Api();// leave on top
api.get( {// Check to see if page is watched
	    action: 'query',
	    prop: 'info',
	    inprop: 'watched',
	    titles: mw.config.get('wgPageName')
	} ).done( function ( data ) {
		var pid = $.map(data.query.pages, function (v, k) {return k;})[0];
		if(typeof(data.query.pages[pid].watched) === undefined){
			var isPageWatched = false;
		} else {
			var isPageWatched = true;
		}
	});
$( '#ca-nstab-user:first("a")').on('click', function (e) { 
	e.preventDefault();
	 if(isPageWatched === false){
		/// If page is not watched, watch it
		api.watch( mw.config.get('wgPageName') ).done( function (){
			$( '#ca-nstab-user:first("a")').text('watched');
		});
		isPageWatched = true;
	} else {
		/// Otherwise, unwatch it
		api.unwatch( mw.config.get('wgPageName') ).done( function (){
			$( '#ca-nstab-user:first("a")').text('unwatched');
		});
		isPageWatched = false;
	}
});
/* Notes:
// Notable configuration settings on successful creation
mw.config.set({"wgCanonicalNamespace":"Special","wgCanonicalSpecialPageName":"Userlogin","wgNamespaceNumber":-1,"wgPageName":"Special:UserLogin","wgTitle":"UserLogin","wgCurRevisionId":0,"wgRevisionId":0,"wgArticleId":0,"wgIsArticle":false,"wgIsRedirect":false,"wgAction":"view","wgUserName":"Technical 13","wgUserGroups":["accountcreator","massmessage-sender","reviewer","templateeditor","*","user","autoconfirmed"],"wgCategories":[], ...

// API call to get a list of user created by me (will need a continue if over 500)
https://en.wikipedia.org/wiki/Special:ApiSandbox#action=query&list=logevents&format=json&leprop=title|timestamp|comment|parsedcomment&letype=newusers&leuser=Technical_13&lelimit=500

// Section to change on successful creation
<div id="mw-content-text"><p>A randomly generated password for <a href="/w/index.php?title=User_talk:RON_J&amp;action=edit&amp;redlink=1" class="new" title="User talk:RON J (page does not exist)">RON J</a> has been sent to Email@ISP.com. It can be changed on the <i><a href="/wiki/Special:ChangePassword" title="Special:ChangePassword">change password</a></i> page upon logging in.
</p><p id="mw-returnto">Return to <a href="https://en.wikipedia.org/wiki/Main_Page" title="Main Page">Main Page</a>.</p>
</div>
*//*

if(mw.config.get( 'wgCanonicalSpecialPageName' ) === "Userlogin"){
	/// INITIALIZE VARIABLES
	// Get new user's username
	var userNameCreated = $("div#mw-content-text").find("a:first").text();
	// Get watchlist token
	var watchtoken = mw.user.tokens.get( 'watchToken' );
	watchtoken = "&token=" + watchtoken.substr(0, watchtoken.length -2) + "%2B%5C";
	// define destination for "watch" link (to do it the old fashioned way until I figure out ajax method)
	var hrefURL = 'https://en.wikipedia.org/w/index.php?title=User:' + userNameCreated + '&action=watch' + watchtoken;
	/// Function to warn that tb-override or spoof-overide boxes are checked
	function warnSpoofTB(){
		var tbChecked = $("#wpIgnoreTitleBlacklist").is(":checked");
		var spoofChecked = $("#wpIgnoreAntiSpoof").is(":checked");
		var buttonWarnTB = "";
		var buttonWarnSpoof = "";
		var buttonWarn = "";
		if(tbChecked === true){
			$("#wpIgnoreTitleBlacklist").parent("label").css({"background-color": "#FAA", "font-weight": "bold"});
			buttonWarnTB = "\nIgnoring blacklist!"
			buttonWarn = "Create another account\n\nWarning:" + buttonWarnTB + buttonWarnSpoof;
			$("#wpCreateaccount").val(buttonWarn)
		} else {
			$("#wpIgnoreTitleBlacklist").parent("label").css({"background-color": "", "font-weight": ""});
			buttonWarnTB = ""
			buttonWarn = "Create another account\n\nWarning:" + buttonWarnTB + buttonWarnSpoof;
			$("#wpCreateaccount").val(buttonWarn);
		}
		if(spoofChecked === true){
			$("#wpIgnoreAntiSpoof").parent("label").css({"background-color": "#FAA", "font-weight": "bold"});
			buttonWarnSpoof = "\nIgnoring spoofing checks!";
			buttonWarn = "Create another account\n\nWarning:" + buttonWarnTB + buttonWarnSpoof;
			$("#wpCreateaccount").val(buttonWarn);
		} else {
			$("#wpIgnoreAntiSpoof").parent("label").css({"background-color": "", "font-weight": ""});
			buttonWarnSpoof = "";
			buttonWarn = "Create another account\n\nWarning:" + buttonWarnTB + buttonWarnSpoof;
			$("#wpCreateaccount").val(buttonWarn);
		}
		if(tbChecked === true || spoofChecked === true){
			$("#wpCreateaccount").css("background-image", "linear-gradient(rgb(255, 100, 100) 0px, rgb(105, 50, 50) 100%)");
		} else {
			$("#wpCreateaccount").css("background-image", "");
			$("#wpCreateaccount").val("Create another account")
		}
	}
	/// onload, do all these things
	warnSpoofTB();
	$("#wpReason").replaceWith("<textarea class=\"" + $("#wpReason").attr("class") + "\" id=\"wpReason\" tabindex=\"" + $("#wpReason").attr("tabindex") + "\" rows=\"3\" placeholder=\"Why you are creating another account\" name=\"wpReason\">" + $("#wpReason").attr("value") + "</textarea>");
	$("#wpIgnoreTitleBlacklist").attr("onClick", "warnSpoofTB();");
	$("#wpIgnoreAntiSpoof").attr("onClick", "warnSpoofTB();");
	// Create initial links after account created
	//	$("div#mw-content-text").find("a:first").after('( <span id="nu-tb"></span> )');
	//	$("#nu-tb").html("<a id=\"watchLink\" href=\"" + hrefURL + "\">watch</a>");
}
*/