-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
151 lines (129 loc) · 3.53 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
139
140
141
142
143
144
145
146
147
148
149
150
151
// Home Page Script
// For Loading Spinner
const spinner=document.querySelector('.spinner-wrap');
window.addEventListener('load', () => {
spinner.style.opacity='0';
setTimeout(() => {
spinner.style.display='none'
}, 500);
});
// For Dark-Light theme switch
const toggle = document.getElementById('toggleLight');
const body = document.querySelector('body');
toggle.addEventListener('click', function(){
this.classList.toggle('bi-moon');
if(this.classList.toggle('bi-brightness-high-fill')){
body.style.background = 'rgb(20, 22, 24)';
body.style.color = 'white';
body.style.transition = '2s';
}else{
body.style.background = 'rgb(186, 186, 186)';
body.style.color = 'black';
body.style.transition = '2s';
}
});
// Year Getter
const date=new Date();
let year= date.getFullYear();
document.getElementById('getYear').innerHTML=year;
// For the Validation Buttons
let popUp=document.getElementById('openpopup');
function openPopup(){
popUp.classList.add("open-pop");
};
function closePop(){
popUp.classList.remove("open-pop");
};
// For the Contact Us Validation
function message(){
var Name = document.getElementById('name');
var email = document.getElementById('email');
var msg = document.getElementById('zip');
const success = document.getElementById('success');
const danger = document.getElementById('danger');
if(Name.value === '' || email.value === '' || msg.value === ''){
danger.style.display = 'block';
}
else{
setTimeout(() => {
Name.value = '';
email.value = '';
msg.value = '';
}, 2000);
openPopup();
}
setTimeout(() => {
danger.style.display = 'none';
}, 3000);
}
// For the Newsletter Validation
function messageNewsletter(){
var email = document.getElementById('email-newsletter');
if(email.value===''){
dangerNewsletter.style.display='block';
}
else{
setTimeout(() => {
email.value = '';
}, 2000);
openPopup();
}
setTimeout(() => {
dangerNewsletter.style.display = 'none';
}, 2000);
};
// Log In Page Validation
function messageLogin(){
var email = document.getElementById('emailLogin');
var password = document.getElementById('passLogin');
if(email.value === '' || password.value === ''){
dangerLogin.style.display = 'block';
}
else{
setTimeout(() => {
email.value = '';
password.value = '';
}, 2000);
openPopup();
}
setTimeout(() => {
dangerLogin.style.display = 'none';
}, 3000);
};
function LoginclosePop(){
popUp.classList.remove("open-pop");
window.location.href ="ChatBox.html";
};
// Sign Up Page Validation
function messageSignup(){
var name = document.getElementById('nameSignup');
var email = document.getElementById('emailSignup');
var password = document.getElementById('passSignup');
var repassword = document.getElementById('repassSignup');
if(name.value === '' || email.value === '' || password.value === '' || repassword.value === ''){
dangerSignup.style.display = 'block';
}
else{
setTimeout(() => {
name.value='';
email.value = '';
password.value = '';
repassword.value='';
}, 2000);
openPopup();
}
setTimeout(() => {
dangerSignup.style.display = 'none';
}, 3000);
};
// Dynamic Text
$(function () {
count = 0;
wordsArray = ["Chat", "Connect", "Enjoy", "and Have Fun"];
setInterval(function () {
count++;
$("#word").fadeOut(500, function () {
$(this).text(wordsArray[count % wordsArray.length]).fadeIn(500);
});
}, 2000);
});