blob: f3b6f9af195457532e516d18728ecdb3c62cfde5 (
plain)
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
|
arrows = [];
const minSpeed = 3;
const maxSpeed = 8;
const delay = 1500;
const lifetime = 20000;
function make_arrow() {
const svg = document.getElementById("protoarrow").cloneNode();
svg.style.left = Math.random() * 100 + '%';
svg.style.display = 'block';
document.getElementById('arrows').append(svg);
const ob = {
y: -800,
svg: svg,
speed: Math.random() * (maxSpeed - minSpeed) + minSpeed
};
arrows.push(ob);
setTimeout(make_arrow, delay);
setTimeout(() => {
svg.remove();
arrows.shift();
}, lifetime);
}
function update() {
for (const arrow of arrows) {
arrow.y += arrow.speed;
arrow.svg.style.bottom = arrow.y + 'px';
}
window.requestAnimationFrame(update);
}
make_arrow();
update();
function clear_hero_errors()
{
var errors = document.getElementsByClassName("hero_form_error");
var i;
for (i = 0; i < errors.length; i++)
{
errors[i].hidden = true;
}
}
function validate_hero_login_form()
{
var username=document.forms["login_form"]["username"].value;
var flag=true;
clear_hero_errors();
if(username.length==0)
{
document.getElementById("username-length-error").hidden=false;
flag=false;
}
document.activeElement.blur();
return flag;
}
function validate_hero_form()
{
var username=document.forms["register_form"]["username"].value;
var email=document.forms["register_form"]["email"].value;
var password=document.forms["register_form"]["password"].value;
var password2=document.forms["register_form"]["password2"].value;
var flag=true;
clear_hero_errors();
if(username.length==0)
{
document.getElementById("username-length-error").hidden=false;
flag=false;
}
if(!email.match(/\S+@\S+/))
{
document.getElementById("email-error").hidden=false;
flag=false;
}
if(password.length==0)
{
document.getElementById("password-length-error").hidden=false;
flag=false;
}
if(password !== password2)
{
document.getElementById("password-match-error").hidden=false;
flag=false;
}
document.activeElement.blur();
return flag;
}
function showLogin(l) {
document.getElementById("loginform").style.display = l ? "flex" : "none";
document.getElementById("signupform").style.display = l ? "none" : "flex";
}
|