-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
138 lines (122 loc) · 3.01 KB
/
script.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
134
135
136
137
138
let passStrength = 0;
let password = "";
let length = 0;
function getPass() {
let passInput = document.getElementById("passInput").value;
password = passInput;
return password;
}
function getLength() {
let passLength = password.length;
length = passLength;
return length;
}
function lengthReq() {
if (length > 11 && passStrength == 0) {
passStrength++;
}
if (length < 12 && passStrength >= 1) {
passStrength--;
}
}
function upperReq() {
let chars = password;
if (/[a-z].?[A-Z]/g.test(chars) && passStrength <= 1) {
passStrength++;
}
}
function numReq() {
let chars = password;
if (/[0-9]{1}/.test(chars) && passStrength <= 1) {
passStrength++;
}
}
function specialReq() {
let chars = password;
if (/[!@#\$%\^\&*\)\(+=._-]/g.test(chars) && passStrength <= 3) {
passStrength++;
}
}
function checkStrength() {
switch(passStrength) {
case 0:
swordLeft.reverse();
swordRight.reverse();
wings.reverse();
crown.reverse();
break;
case 1:
swordLeft.play();
swordRight.reverse();
wings.reverse();
crown.reverse();
break;
case 2:
swordLeft.play();
swordRight.play();
wings.reverse();
crown.reverse();
break;
case 3:
swordLeft.play();
swordRight.play();
wings.play();
crown.reverse();
break;
case 4:
swordLeft.play();
swordRight.play();
wings.play();
crown.play();
break;
}
}
function deletePass() {
if (password == "") {
passStrength = 0;
}
}
function eventFunction() {
getPass();
getLength();
lengthReq();
upperReq();
numReq();
specialReq();
deletePass();
checkStrength();
console.log(passStrength);
};
function toggle() {
var x = document.getElementById("passInput");
if (x.type === "password") {
$("#showPass").css({"display": "block"});
$("#hidePass").css({"display": "none"});
x.type = "text";
} else {
$("#showPass").css({"display": "none"});
$("#hidePass").css({"display": "block"});
x.type = "password";
}
}
$("#showHide").click(function() {
getPass();
toggle();
});
gsap.set("#swords", {y: -60});
gsap.set("#sword-left", {x: -30, rotate: -30, transformOrigin: "center"});
gsap.set("#sword-right", {x: 30, rotate: 30, transformOrigin: "center"});
gsap.set("#wings", {scale: 0, y: 60, transformOrigin: "center"});
gsap.set("#crown", {rotate: 30, transformOrigin: "center", y: 60});
var swordLeft = gsap.timeline();
swordLeft.to("#sword-left", .5, {opacity: 1, rotate: 0, y: 60, x: 0, ease: Back.easeOut});
swordLeft.pause();
var swordRight = gsap.timeline();
swordRight.to("#sword-right", .5, {opacity: 1, rotate: 0, y: 60, x: 0, ease: Power4.easeInOut});
swordRight.pause();
var wings = gsap.timeline();
wings.to("#wings", .5, {delay: .5, opacity: 1, scale: 1, y: 0, ease: Back.easeOut, transformOrigin: "center"});
wings.pause();
var crown = gsap.timeline();
crown.to("#crown", .5, {delay: 1, opacity: 1, y: 0, rotate: 0, ease: Back.easeOut});
crown.pause();