-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjoin.js
133 lines (124 loc) · 4.38 KB
/
join.js
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
function joinEmailConfirm(){
console.log("email confirm");
if( !joinEmailCheck() )
return false;
var elEmail = document.getElementById("joinEmail");
var elEmailConfirm = document.getElementById("joinEmailConfirm");
var elError = document.getElementById("joinusError");
if( elEmailConfirm.value != elEmail.value ){
elEmailConfirm.style.backgroundColor = "red";
elError.style.display = "block";
elError.innerHTML = "confirm fail";
return false;
}
else{
elEmailConfirm.style.backgroundColor = "green";
elError.style.display = "none";
return true;
}
}
function joinEmailCheck(){
var elEmail = document.getElementById("joinEmail");
var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
var elError = document.getElementById("joinusError");
if(reg.test(elEmail.value) == false){
elEmail.style.backgroundColor = "red";
elError.style.display = "block";
elError.innerHTML = "invalidate email";
return false;
}
else{
elEmail.style.backgroundColor = "white";
elError.style.display = "none";
// xml request call
var mmapi = new MindmapAPI();
mmapi.checkEmailRsp = function(boolResult){
if( boolResult ){
elEmail.style.backgroundColor = "green";
}
else{
elEmail.style.backgroundColor = "red";
elError.style.display = "block";
elError.innerHTML = "email address exist";
}
}
mmapi.checkEmail( elEmail.value );
return true;
}
}
function joinPasswdConfirm(){
var elPasswd = document.getElementById("joinPasswd");
var elPasswdConfirm = document.getElementById("joinPasswdConfirm");
var elError = document.getElementById("joinusError");
var elEmail = document.getElementById("joinEmail");
if( elPasswdConfirm.value != elPasswd.value ){
elPasswdConfirm.style.backgroundColor = "red";
elEmail.style.backgroundColor = "red";
elError.style.display = "block";
elError.innerHTML = "passwd confirm fail";
return false;
}
else{
elPasswdConfirm.style.backgroundColor = "white";
elError.style.display = "none";
return true;
}
}
function formConfirm(){
if( !joinEmailCheck() )
return false;
if( !joinEmailConfirm() )
return false;
if( !joinPasswdConfirm() )
return false;
console.log("confirm true");
var elEmail = document.getElementById("joinEmail");
var elPasswd = document.getElementById("joinPasswd");
var elError = document.getElementById("joinusError");
var mmapi = new MindmapAPI();
mmapi.joinRsp = function(boolResult){
if(boolResult){
var divPopupFail = document.getElementById("popupJoinFail");
divPopupFail.style.display = "none";
var divPopupOk = document.getElementById("popupJoinOk");
divPopupOk.style.display = "block";
var divPopupJoin = document.getElementById("popupJoinus");
divPopupJoin.style.display = "none";
popupPosisionCenter(divPopupOk);
}else{
var divPopupFail = document.getElementById("popupJoinFail");
divPopupFail.style.display = "block";
var divPopupOk = document.getElementById("popupJoinOk");
divPopupOk.style.display = "none";
var divPopupJoin = document.getElementById("popupJoinus");
divPopupJoin.style.display = "none";
popupPosisionCenter(divPopupFail);
}
}
mmapi.join( elEmail.value, elPasswd.value );
return false;
}
function joinComplete(){
var elJoinOk = document.getElementById("popupJoinOk");
elJoinOk.style.visibility = "hidden";
}
function joinCancel(){
var elJoin = document.getElementById("popupJoinus");
elJoin.style.visibility = "hidden";
}
function joinRetry(){
var elEmail = document.getElementById("joinEmail");
var elPasswd = document.getElementById("joinPasswd");
var elEmailConfirm = document.getElementById("joinEmailConfirm");
var elPasswdConfirm = document.getElementById("joinPasswdConfirm");
elEmail.value = "";
elEmailConfirm.value = "";
elPasswd.value = "";
elPasswdConfirm.value = "";
var divPopupFail = document.getElementById("popupJoinFail");
divPopupFail.style.display = "none";
var divPopupOk = document.getElementById("popupJoinOk");
divPopupFail.style.display = "none";
var divPopupJoin = document.getElementById("popupJoinus");
divPopupJoin.style.display = "block";
}