-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
258 lines (247 loc) · 10.5 KB
/
Copy pathscript.js
File metadata and controls
258 lines (247 loc) · 10.5 KB
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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
function validateFirstName () {
document.getElementById('fname').value = document.getElementById('fname').value.trim();
var fname = document.getElementById('fname').value;
var fnameerr = document.getElementById('fnameerr');
const regexpname = /^[a-zA-Z]+$/;
//First name validation
if(fname.length >= 3 && fname.length <=25 && regexpname.test(fname)) {
document.getElementById('fname').style.border = "green 3px solid";
fnameerr.style.color = "#ffffbd";
fnameerr.innerHTML = "<i class='fa fa-check' aria-hidden='true'></i>"
fnameerr.style.display = "inline";
return true;
}
else if(fname === "" || fname.length < 3 || fname.length > 25) {
document.getElementById('fname').style.border = "orange 2px solid";
fnameerr.style.color = "orange";
fnameerr.innerHTML = "<i class='fa fa-exclamation' style='padding-right:10px' aria-hidden='true'></i> First name must be at least 3 characters and at most 25 characters long.";
fnameerr.style.display = "inline";
return false;
}
else if(!regexpname.test(fname)) {
document.getElementById('fname').style.border = "orange 2px solid";
fnameerr.style.color = "orange";
fnameerr.innerHTML = "<i class='fa fa-exclamation' style='padding-right:10px' aria-hidden='true'></i> First name must contain only alphabets.";
fnameerr.style.display = "inline";
return false;
}
}
function validateLastName () {
document.getElementById('lname').value = document.getElementById('lname').value.trim();
var lname = document.getElementById('lname').value;
var lnameerr = document.getElementById('lnameerr');
const regexpname = /^[a-zA-Z]+$/;
//Last name validation
if(lname.length >= 3 && lname.length <=25 && regexpname.test(lname)) {
document.getElementById('lname').style.border = "green 3px solid";
lnameerr.style.color = "#ffffbd";
lnameerr.innerHTML = "<i class='fa fa-check' aria-hidden='true'></i>"
lnameerr.style.display = "inline";
return true;
}
else if(lname === "" || lname.length < 3 || lname.length > 25) {
document.getElementById('lname').style.border = "orange 2px solid";
lnameerr.style.color = "orange";
lnameerr.innerHTML = "<i class='fa fa-exclamation' style='padding-right:10px' aria-hidden='true'></i> Last name must be at least 3 characters and at most 25 characters long.";
lnameerr.style.display = "inline";
return false;
}
else if(!regexpname.test(lname)) {
document.getElementById('lname').style.border = "orange 2px solid";
lnameerr.style.color = "orange";
lnameerr.innerHTML = "<i class='fa fa-exclamation' style='padding-right:10px' aria-hidden='true'></i> Last name must contain only alphabets.";
lnameerr.style.display = "inline";
return false;
}
}
function validateUsername () {
document.getElementById('username').value = document.getElementById('username').value.trim();
var username = document.getElementById('username').value;
var unameerr = document.getElementById('unameerr');
const regexpuname = /^[a-zA-Z]+[0-9a-zA-Z_]+$/;
if(username.length >= 6 && regexpuname.test(username)) {
document.getElementById('username').style.border = "green 3px solid";
unameerr.style.color = "#ffffbd";
unameerr.innerHTML = "<i class='fa fa-check' aria-hidden='true'></i>";
unameerr.style.display = "inline";
return true;
}
else if(username.length < 6) {
document.getElementById('username').style.border = "orange 2px solid";
unameerr.style.color = "orange";
unameerr.innerHTML = "<i class='fa fa-exclamation' style='padding-right:10px' aria-hidden='true'></i> Username must be at least 6 characters long.";
unameerr.style.display = "inline";
return false;
}
else if(!regexpuname.test(username)) {
document.getElementById('username').style.border = "orange 2px solid";
unameerr.style.color = "orange";
unameerr.innerHTML = "<i class='fa fa-exclamation' style='padding-right:10px' aria-hidden='true'></i> Username must begin with an alphabet and can contain alphabets, numbers and underscores only.";
unameerr.style.display = "inline";
return false;
}
}
function validatePassword () {
document.getElementById('password').value = document.getElementById('password').value.trim();
validateCnfPassword();
var password = document.getElementById('password').value;
var passworderr = document.getElementById('passworderr');
const regexppassword = /^(?=.*[0-9])(?=.*[!@#$%^&*])[a-zA-Z0-9!@#$%^&*]{6,}$/;
//Password validation
if(regexppassword.test(password)) {
document.getElementById('password').style.border = "green 3px solid";
passworderr.style.color = "#ffffbd";
passworderr.innerHTML = "<i class='fa fa-check' aria-hidden='true'></i></br>";
passworderr.style.display = "inline";
return true;
}
else {
document.getElementById('password').style.border = "orange 2px solid";
passworderr.style.color = "orange";
passworderr.innerHTML = "<i class='fa fa-exclamation' style='padding-right:10px' aria-hidden='true'></i> Password must be at least 6 characters long and must contain at least one number and special character.";
passworderr.style.display = "inline";
return false;
}
}
function validateCnfPassword () {
document.getElementById('cnfpwd').value = document.getElementById('cnfpwd').value.trim();
var cnfpwd = document.getElementById('cnfpwd').value;
var cnfpwderr = document.getElementById('cnfpwderr');
var password = document.getElementById('password').value;
const regexppassword = /^(?=.*[0-9])(?=.*[!@#$%^&*])[a-zA-Z0-9!@#$%^&*]{6,}$/;
//Confirm password validation
if(regexppassword.test(password) && password === cnfpwd) {
document.getElementById('cnfpwd').style.border = "green 3px solid";
cnfpwderr.style.color = "#ffffbd";
cnfpwderr.innerHTML = "<i class='fa fa-check' aria-hidden='true'></i></br>";
cnfpwderr.style.display = "inline";
return true;
}
else if(!regexppassword.test(password)) {
document.getElementById('cnfpwd').style.border = "orange 2px solid";
cnfpwderr.style.color = "orange";
cnfpwderr.innerHTML = "<i class='fa fa-exclamation' style='padding-right:10px' aria-hidden='true'></i> Password does not follow the norms.";
cnfpwderr.style.display = "inline";
return false;
}
if(password !== cnfpwd) {
document.getElementById('cnfpwd').style.border = "orange 2px solid";
cnfpwderr.style.color = "orange";
cnfpwderr.innerHTML = "<i class='fa fa-exclamation' style='padding-right:10px' aria-hidden='true'></i> Passwords do not match.";
cnfpwderr.style.display = "inline";
return false;
}
}
function validateEmail () {
document.getElementById('email').value = document.getElementById('email').value.trim();
var email = document.getElementById('email').value;
var emailerr = document.getElementById('emailerr');
const regexpemail = /^[a-zA-Z0-9_.-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,7}$/i;
//Email validation
if(regexpemail.test(email)) {
document.getElementById('email').style.border = "green 3px solid";
emailerr.style.color = "#ffffbd";
emailerr.innerHTML = "<i class='fa fa-check' aria-hidden='true'></i>";
emailerr.style.display = "inline";
return true;
}
else {
document.getElementById('email').style.border = "orange 2px solid";
emailerr.style.color = "orange";
emailerr.innerHTML = "<i class='fa fa-exclamation' style='padding-right:10px' aria-hidden='true'></i> Invalid email address.";
emailerr.style.display = "inline";
return false;
}
}
function onValid() {
if(validateFirstName() && validateLastName() && validateUsername() && validatePassword() && validateCnfPassword() && validateEmail()) {
document.getElementById('submitsignup').disabled = false;
}
else {
document.getElementById('submitsignup').disabled = true;
}
}
$(document).ready(function(){
$('[data-toggle="tooltip"]').tooltip();
$('.anime').fadeIn(4000);
});
var divdemo = $(".demo");
// console.log(divdemo.length);
var current=0;
$('#down').on('click',function(e){
// console.log(current);
$(divdemo[current]).fadeIn(3000);
current= current + 1;
if(current == divdemo.length){
$('#down').css('display','none');
}
$('.ui-tooltip').css('display','none');
e.stopPropagation();
});
$('.slider').slick({
dots: true,
infinite: false,
speed: 300,
slidesToShow: 1,
slidesToScroll: 1,
responsive: [
{
breakpoint: 1024,
settings: {
slidesToShow: 1,
slidesToScroll: 1,
infinite: true,
dots: true
}
},
{
breakpoint: 600,
settings: {
slidesToShow: 1,
slidesToScroll: 1
}
},
{
breakpoint: 480,
settings: {
slidesToShow: 1,
slidesToScroll: 1
}
}
// You can unslick at a given breakpoint now by adding:
// settings: "unslick"
// instead of a settings object
]
});
$( function() {
$( document ).tooltip({
position: {
my: "center bottom-20",
at: "center top",
using: function( position, feedback ) {
$( this ).css( position );
$( "<div>" )
.addClass( "arrow" )
.addClass( feedback.vertical )
.addClass( feedback.horizontal )
.appendTo( this );
}
}
});
});
let url = window.location.href;
let len = url.split("/");
let page = len[len.length-1];
let element;
if (page == 'index.php') {
element = document.getElementById('home-link');
}
if (page == 'aboutus.php') {
element = document.getElementById('about-link');
}
if (page == 'contactus.php') {
element = document.getElementById('contact-link');
}
if (element != undefined) {
element.classList.add('link-select');
}