aboutsummaryrefslogtreecommitdiffstats
path: root/view/js/mod_register.js
blob: 6607579a262d22aa786fb126ebd684014aee2e94 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
$(document).ready(function() {
	$("#id_email").blur(function() {
		var zreg_email = $("#id_email").val();
		$.get("register/email_check.json?f=&email=" + encodeURIComponent(zreg_email), function(data) {
			$("#help_email").html(data.message);
			zFormError("#help_email",data.error);
		});
	});
	$("#id_password").blur(function() {
		if(($("#id_password").val()).length < 6 ) {
			$("#help_password").html(aStr.pwshort);
			zFormError("#help_password", true);
		}
		else {
			$("#help_password").html("");
			zFormError("#help_password", false);
		}
	});
	$("#id_password2").blur(function() {
		if($("#id_password").val() != $("#id_password2").val()) {
			$("#help_password2").html(aStr.pwnomatch);
			zFormError("#help_password2", true);
		}
		else {
			$("#help_password2").html("");
			zFormError("#help_password2", false);
		}
	});

	$("#id_name").blur(function() {
		$("#name-spinner").show();
		var zreg_name = $("#id_name").val();
		$.get("new_channel/autofill.json?f=&name=" + encodeURIComponent(zreg_name),function(data) {
			$("#id_nickname").val(data);
			if(data.error) {
				$("#help_name").html("");
				zFormError("#help_name",data.error);
			}
			$("#name-spinner").hide();
		});
	});

	$("#id_nickname").blur(function() {
		$("#nick-spinner").show();
		var zreg_nick = $("#id_nickname").val();
		$.get("new_channel/checkaddr.json?f=&nick=" + encodeURIComponent(zreg_nick),function(data) {
			$("#id_nickname").val(data);
			if(data.error) {
				$("#help_nickname").html("");
				zFormError("#help_nickname",data.error);
			}
			$("#nick-spinner").hide();
		});
	});

});