-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
729 lines (681 loc) · 26.7 KB
/
main.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
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
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
//script for vrixe
window.addEventListener("wheel", {passive: true} );
//same as process but used on main
function mainsprocess(outputId,req, iv, cu, dbid){
if (req == ""){
document.getElementById(outputId).innerHTML = "error";
return;
}
else {
if (window.XMLHttpRequest) {
// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp = new XMLHttpRequest();
} else {
// code for IE6, IE5
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
document.getElementById(outputId).innerHTML = this.responseText;
}
};
xmlhttp.open("GET","../garage/mover.php?k="+req+"&i="+iv+"&c="+cu+"&dbid="+dbid,true);
xmlhttp.send();
}
}
let search = () =>{
document.getElementById('searchboxes').style.height="395px";
document.getElementById('gtr').style.display='block';
}
//top right page menu
function pagemenu(){
var pagem = document.getElementById('menuboxes');
pagem.style.height="400px";
pagem.style.paddingBottom="4%"; pagem.style.paddingTop="2%";
pagem.style.boxShadow='0 5px 5px -3px rgba(0,0,0,0.2), 0 8px 10px 1px rgba(0,0,0,0.14), 0 3px 14px 2px rgba(0,0,0,0.12)';
}
function revpagemenu(){
var pagem = document.getElementById('menuboxes');
pagem.style.height="0px";
pagem.style.paddingBottom="0%"; pagem.style.paddingTop="0%";
pagem.style.boxShadow='none';
}
function createprogram(){
document.getElementById('createprogram').style.display="inline-block";
document.getElementById('procheck').value='present';
}
function hidesearch(){
document.getElementById('searchboxes').style.height="0";
document.getElementById('gtr').style.display='none';
}
function closecloseb(){
document.getElementById('gtr').style.display='none';
document.getElementById('searchboxes').style.height="0";
document.getElementById('sbut').style.display="inline-block";
}
//show deskmenu
function deskpop(){
document.getElementById('deskpop').style.height="85px";
document.getElementById('uboy').style.display="inline-block";
document.getElementById('deskpop').style.boxShadow=" 14px 16px 67px -31px rgb(48, 48, 48)";
document.getElementById('dboy').style.display="none";
}
//hide deskmenu
function deskpops(){
document.getElementById('deskpop').style.height="0px";
document.getElementById('uboy').style.display="none";
document.getElementById('dboy').style.display="inline-block";
}
function desksearch(){
document.getElementById('desksearch').style.height="260px";
document.getElementById('desksearch').style.padding="2%";
document.getElementById('sh').style.display="inline-block";
document.getElementById('desksearch').style.boxShadow=" 14px 16px 67px -31px rgb(48, 48, 48)";
document.getElementById('dhss').style.display="none";
}
function desksearchs(){
document.getElementById('desksearch').style.height="0px";
document.getElementById('desksearch').style.padding="0%";
document.getElementById('sh').style.display="none";
document.getElementById('dhss').style.display="inline-block";
}
function closealert(){
document.getElementById('valert').style.display="none";
}
//set all date and time input to default values onload page. invite only sofar
function presettime(){
var d = new Date();
var rawyear = d.getFullYear();
var rawmonth = d.getMonth() + 1;
var rawday = d.getDate();
if(rawmonth <= 9){var month = `0${rawmonth}`;}else{var month = rawmonth;}
if(rawday <= 9){var day = `0${rawday}`}else{var day = rawday;}
document.getElementById('timeone').value="13:00:00";
document.getElementById('timetwo').value="14:00:00";
document.getElementById('begdate').value=`${rawyear}-${month}-${day}`;
document.getElementById('enddate').value=`${rawyear}-${month}-${day}`;
document.getElementById("bdtxt").innerHTML=day; //write date
}
//set min end date to startdate on adding events used mainly on desk plan where we have two date inputs
function setlowattr(){
var nim = document.getElementById('begdate').value;
document.getElementById('enddate').setAttribute("min", nim);
document.getElementById('enddate').value=nim;
}
//lOCATION FETCHING
function showPosition(position) {
document.getElementById("lalo").value = position.coords.latitude + "," +
position.coords.longitude;
document.getElementById("err").innerHTML="Click again to calibrate GPS accuracy";
}
function showError(error) {
var x = document.getElementById("err");
switch(error.code) {
case error.PERMISSION_DENIED:
x.innerHTML = "User denied request for Geolocation."
break;
case error.POSITION_UNAVAILABLE:
x.innerHTML = "Location information is unavailable."
break;
case error.TIMEOUT:
x.innerHTML = "The request to get user location timed out."
break;
case error.UNKNOWN_ERROR:
x.innerHTML = "An unknown error occurred."
break;
}}
function getLocation() {
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(showPosition, showError);
} else {
document.getElementById("err").innerHTML = "Geolocation is not supported by this browser.";
}
}
//checks network status of every page every 5 seconds
window.addEventListener('load', function(){
setInterval(function(){
if (navigator.onLine != true){
document.getElementById('offline').style.display='block';
}
else{
document.getElementById('offline').style.display='none';
}}, 5000);
});
//show more description on event pages
function showm(){
document.getElementById("evina").style.maxHeight= "1000px";
document.getElementById("evina").style.height= "auto";
document.getElementById("showmore").style.display= "none";
document.getElementById("hidemore").style.display= "block";
}
function hidem(){
document.getElementById("evina").style.maxHeight= "70px";
document.getElementById("showmore").style.display= "block";
document.getElementById("hidemore").style.display= "none";
}
//make sure program button doesnt work on desktop event and private event.php
function showprogram(){
if (screen.width > 980){
return false;
}else{
document.getElementById("program").style.display= "block";
document.getElementById('gtr').style.display='block';
}
}
function passreset() {//auto show password rest div on index page
document.getElementById("passreset").style.height="200px";
document.getElementById("login").style.height="0px";
}
/*fetch image name in form*/
function editimgename(){
var un = document.getElementById("imgfree").value;
var sed = un.substr(12);
document.getElementById("ii").value="user";
esi.src = URL.createObjectURL(event.target.files[0]);
document.getElementById("uit").innerHTML=sed;
}
function updatename(){
var un = document.getElementById("imgfree").value;
var sed = un.substr(12);
document.getElementById("ii").value="user";
esi.src = URL.createObjectURL(event.target.files[0]);
document.getElementById("uit").innerHTML=sed;
document.getElementById('bcde').style.color='#28e828';
}
function showdeact() {//shows the account deactivation div editprofile.php
document.getElementById("deact").style.height="290px";
document.getElementById("deactshower").style.display="none";
}
//count character length of input fields
function countkeys(){
var words = document.getElementById('source').value;
var plicate = document.getElementById('plicate');
var limit = document.getElementById('source').getAttribute("maxLength");
var nums = words.length;
plicate.innerHTML= nums + " of " + limit;
if (nums < 160){
document.getElementById('plicate').style.color="#16b31c";
}
else{
document.getElementById('plicate').style.color="crimson";
}
}
//now we can make alert boxes disappear
window.addEventListener('load', function()
{
var timebox = document.getElementById("valert");
function disap(){
var timebox = document.getElementById("valert");
timebox.style.display="none";
}
if (timebox){
setTimeout(disap, 2000);
}
});
//hide all other but show clicked event desk pef
function eventbox(val){
var box = document.querySelectorAll(".pef");
for (i = 0; i < box.length; i++) {
box[i].style.display = "none";
}
val.style.display="inline-block";
}
//hide or show input for each program item
function addoninput(number){
var x = document.querySelectorAll(".proginput");
for (i = 0; i < x.length; i++) {
x[i].style.height = "0px";
x[i].style.paddingTop="0px";
x[i].style.paddingBottom="0px";
}
number.style.height="100px";
number.style.paddingTop="10px";
number.style.paddingBottom="15px";
}
//set task for desk page
function setbring(pr){
var bringing = document.getElementById("bringing");
var all = document.querySelectorAll(".bring");
bringing.value = pr;
var prid = document.getElementById(pr);
var allb;
for (allb = 0; allb < all.length; allb++) {
all[allb].style.color = "#504a77";
all[allb].style.fontWeight = "unset";
}
if(prid){
prid.style.color='#16ba16';
prid.style.fontWeight = "bold";
}
if(pr == ""){//setting it back to lack incase user cleans input and does not select anything
bringing.value = "slack";
}
}
//tickboxes selection
function allclass(chjs){
var chjsin = chjs + "id"; //eg privateid
var chjscbtn = document.getElementById(chjs + "classbtn");//eg privateclasbtn
var chjstat = document.getElementById(chjsin).value; //by name on date at
if(chjstat == "true"){ //if value was already true
if ("vibrate" in navigator){window.navigator.vibrate(10); }
document.getElementById(chjsin).value= "false";
chjscbtn.style.backgroundColor= "transparent"; //set id value
chjscbtn.style.borderColor= "#ffffff";
chjscbtn.style.borderWidth= "2px";
if(chjs == 'approve'){
if ("vibrate" in navigator){window.navigator.vibrate(10); }
document.getElementById("formerror").innerHTML="Select 'Notify' to update everyone on your changes.<br><b><a href='account/settings'>Notification settings <i class='material-icons' style='vertical-align:text-top;font-size:17px'>arrow_forward</i></a></b>";
}
//show custom messanger
if(document.getElementById(chjsin).id == "notifyid"){
document.getElementById("usercnotif").style.display="block";
}}
else{
if ("vibrate" in navigator){window.navigator.vibrate(10); }
document.getElementById(chjsin).value= "true";
chjscbtn.style.backgroundColor= "#ffffff";
chjscbtn.style.borderColor= "#2b3445";
chjscbtn.style.borderWidth= "4px";
if(chjs == 'approve'){
if ("vibrate" in navigator){window.navigator.vibrate(10); }
document.getElementById("formerror").innerHTML="<b>Save your changes and prevent further edits.<b>";
}
//show custom messanger
if(document.getElementById(chjsin).id == "notifyid"){
document.getElementById("usercnotif").style.display="block";
}}
}
//add to invite from contact
function addToInviteList(username, mail, userpic, pushid){
//get all field values
var user1 = document.getElementById("user1").value;
var user2 = document.getElementById("user2").value;
var user3 = document.getElementById("user3").value;
var user4 = document.getElementById("user4").value;
var user5 = document.getElementById("user5").value;
var user6 = document.getElementById("user6").value;
//create string
var userData = `${username}, ${mail}, ${userpic}, ${pushid}`;
//insert value function
let insertData = (userData, elementPosition, userId) =>{
document.getElementById(elementPosition).value=userData;
//increase the counter by 1
document.getElementById("invitelist").innerHTML = Number(document.getElementById("invitelist").innerHTML) + 1;
//style the selected user
var userId = document.getElementById(userId);
userId.style.background="none";
userId.style.backgroundColor="#372538";
//display remove button and show add button
document.getElementById(`remove${username}`).style.display="block";
document.getElementById(`add${username}`).style.display="none";
}
//check positions
if (user1 == ""){
var elementPosition = "user1";
//insert, userdata, which field, countnumber, div id to style
insertData(userData, elementPosition, `id${username}`);
//display count div once
document.getElementById("clist").style.top='140px';
}
else if(user2 == ""){
var elementPosition = "user2";
insertData(userData, elementPosition, `id${username}`);
}
else if(user3 == ""){
var elementPosition = "user3";
insertData(userData, elementPosition, `id${username}`);
}
else if(user4 == ""){
var elementPosition = "user4";
insertData(userData, elementPosition, `id${username}`);
}
else if(user5 == ""){
var elementPosition = "user5";
insertData(userData, elementPosition, `id${username}`);
}
else if(user6 == ""){
var elementPosition = "user6";
insertData(userData, elementPosition, `id${username}`);
}
else{
//call absolunia
var closer = 'close';
var button = '<i class=\"material-icons\" style=\"font-size: 18px;vertical-align:sub;\">mail</i> Contact Us';
var buttonlink = 'mailto:[email protected]';
var title = 'Maximum invitees reached';
var text = "For now, you can only add up to 6 contributors to an event. Planning something with more people? Please text us for a custom plan.";
callabsolunia(title, text, button, buttonlink, closer);
return false;
}}
//remove single user from invite list
function removeFromInviteList(username, removeruser){
//get all user names
var user1 = document.getElementById("user1").value.split(",")[0];
var user2 = document.getElementById("user2").value.split(",")[0];
var user3 = document.getElementById("user3").value.split(",")[0];
var user4 = document.getElementById("user4").value.split(",")[0];
var user5 = document.getElementById("user5").value.split(",")[0];
var user6 = document.getElementById("user6").value.split(",")[0];
//remove data function
let removeData = (userField, userDiv) =>{
//remove value
document.getElementById(userField).value="";
//undo style the selected user
var userId = document.getElementById(`id${username}`);
userId.style.background="linear-gradient(45deg, #252b38 0%, #252b38 44%,rgb(43, 52, 67) 44%, rgb(43, 52, 67) 45%,rgb(43, 52, 67) 61%, rgb(43, 52, 67) 67%,#0298ad 67%, #0298ad 100%)";
//hide remove button and show add to invite button
document.getElementById(`remove${username}`).style.display="none";
document.getElementById(`add${username}`).style.display="block";
//reduce the counter by 1
document.getElementById("invitelist").innerHTML = document.getElementById("invitelist").innerHTML - 1;
}
//get which user to act on
switch(username){
case (user1):
//set value to null
removeData("user1",`remove${username}`);
break;
case (user2):
//set value to null
removeData("user2",`remove${username}`);
break;
case (user3):
//set value to null
removeData("user3",`remove${username}`);
break;
case (user4):
//set value to null
removeData("user4",`remove${username}`);
break;
case (user5):
//set value to null
removeData("user5",`remove${username}`);
break;
case (user6):
//set value to null
removeData("user6",`remove${username}`);
break;
}}
//clear invite list/contact
function clearInviteList(){
//remove all values
document.getElementById("user1").value="";
document.getElementById("user2").value="";
document.getElementById("user3").value="";
document.getElementById("user4").value="";
document.getElementById("user5").value="";
document.getElementById("user6").value="";
//hide count div
document.getElementById("clist").style.top='1400vh';
//reset the counter to 0
document.getElementById("invitelist").innerHTML = 0;
//reset all elemet styling
var callpc;
var allpc = document.querySelectorAll(".cards");
var allRemoveButtons = document.querySelectorAll(".altallcopele");
var allAddButtons = document.querySelectorAll(".allcopele");
for (callpc = 0; callpc < allpc.length; callpc++) {
allpc[callpc].style.background="linear-gradient(45deg, #252b38 0%, #252b38 44%,rgb(43, 52, 67) 44%, rgb(43, 52, 67) 45%,rgb(43, 52, 67) 61%, rgb(43, 52, 67) 67%,#0298ad 67%, #0298ad 100%)";
allAddButtons[callpc].style.display="block";//show all add button
allRemoveButtons[callpc].style.display="none";//hide all remove buttons
}}
//remove user form invite desk
function junkuser(user, box){
document.getElementById(user).value="";
document.getElementById(box).style.display="none";
}
//add to calendar ajax cod. this is seprate cus we need it to output to meniassss
function ajaxmenia(req, iv, cu, dbid){
if (req == ""){
document.getElementById("meniassss").innerHTML = "error";
return;
}
else {
if (window.XMLHttpRequest) {
// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp = new XMLHttpRequest();
} else {
// code for IE6, IE5
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
document.getElementById("meniassss").innerHTML =
this.responseText;
}
};
xmlhttp.open("GET","/garage/mover.php?k="+req+"&i="+iv+"&c="+cu+"&dbid="+dbid,true);
xmlhttp.send();
}
}
//show and hide faq sections
function hideshow(all, one){
var i;
if(document.getElementById(one)){
var allSections = document.querySelectorAll(".all"); var section = document.getElementById(one);
for (i = 0; i < allSections.length; i++) {
allSections[i].style.height="0px";
}
section.style.height="auto";
}
//id given is not in dom
else{
//consider adding fallback for bug report.
}}
//suggest users on search bar. seperate because we have to show result in searh bar
function checkforuser(search){
var searchinput = document.getElementById(search);
var alllent = searchinput.value.length;
if(alllent > 1){
var wihinput = searchinput.value.charAt(0);
if(wihinput == '@'){
var req = 'fetchforusers';
var removeat = searchinput.value.substr(1, alllent);
var id = removeat;
fetchusers(req, id, search);
}}
}
function fetchusers(req, id, search){
if (req == "" && search == "hinput"){
document.getElementById("searchatprofile").innerHTML = "error";
return;
}
else if (req == "" && search == "deser"){
document.getElementById("searchatprofiledesk").innerHTML = "error";
return;
}
else {
if (window.XMLHttpRequest) {
// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp = new XMLHttpRequest();
} else {
// code for IE6, IE5
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200 && search == "hinput") {
document.getElementById("searchatprofile").innerHTML =
this.responseText;
}
else if (this.readyState == 4 && this.status == 200 && search == "deser") {
document.getElementById("searchatprofiledesk").innerHTML =
this.responseText;
}
};
xmlhttp.open("GET","/garage/mover.php?k="+req+"&i="+id+"&c="+search,true);
xmlhttp.send();
}}
//add user to push subscribers. special ajax cus we have to output to chesubpushbtn
function ajaxsubtoevt(req, iv, cu, dbid){
if (req == ""){
document.getElementById("chesubpushbtn").innerHTML = "error";
return;
}
else {
if (window.XMLHttpRequest) {
// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp = new XMLHttpRequest();
} else {
// code for IE6, IE5
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
document.getElementById("chesubpushbtn").innerHTML =
this.responseText;
}
};
xmlhttp.open("GET","/garage/mover.php?k="+req+"&i="+iv+"&c="+cu+"&dbid="+dbid,true);
xmlhttp.send();
}
}
//universal prompt from bottom
function callabsolunia(title, text, button, buttonlink, closer){
document.getElementById("absolunia_button").innerHTML=button;
document.getElementById("buttonlink").setAttribute("href", buttonlink);
document.getElementById("absolunia_title").innerHTML=title;
document.getElementById("absolunia_text").innerHTML=text;
//check if the close buton should be custominsed
if (typeof closer === "undefined"){document.getElementById("absolunia_closer").innerHTML="close";} else{document.getElementById("absolunia_closer").innerHTML=closer;}
//show the div
document.getElementById("absolunia").style.height="225px"; document.getElementById("absolunia").style.paddingTop="2%"; document.getElementById("absolunia").style.paddingBottom="2%"; document.getElementById("absolunia").style.boxShadow="rgb(204, 201, 201) 0px 20px 20px 2px";
}
//hide universal prompt
function revabsolunia(){
document.getElementById("absolunia").style.height="0px"; document.getElementById("absolunia").style.paddingTop="0px"; document.getElementById("absolunia").style.paddingBottom="0px"; document.getElementById("absolunia").style.boxShadow="none";
}
//web share reusable
var cst;
var csl;
function customshare(cst, csl){
//Set absolute link
if(window.location.href.substr(0, 16) == "https://vrixe-en"){
var sharedUrl = `https://vrixe-ennycris1429888.codeanyapp.com/${csl}`;
}else{
var sharedUrl = `https://vrixe.com/${csl}`;
}
if(navigator.share){
navigator.share({
title: document.title,
text: cst,
url: sharedUrl
}).then(() => console.log('Successful share'))
.catch(error => console.log('Error sharing:', error));
}
//fallback call absolunia
else{
var closer = 'close this';
var button = '<i class=\"material-icons\" style=\"font-size: 18px;vertical-align:sub;\"> file_copy</i> Copy Link';
var buttonlink = '#cateuser';
var title = 'Copy item link';
var text = `Looks like your browser does not support web share. But you can still copy the link below. <br> <span id='copyab' style='color:#21d88c'>${sharedUrl}</span>`;
callabsolunia(title, text, button, buttonlink, closer);
document.getElementById('absolunia_button').onclick= function(){
//copy link
var link = document.getElementById('copyab');
var range = document.createRange();
range.selectNode(link);
window.getSelection().addRange(range);
try{
var successful = document.execCommand('copy');
document.getElementById('copyab').innerHTML='Link Copied';
} catch(err) {
document.getElementById('copyab').innerHTML='Error Copying. Please Reload Page';
}
window.getSelection().removeAllRanges();
}
}}
//tell user to sign up to sub to push notifs
function subtoabsolunia(){
var closer = "no thanks";
var button = "<i class='material-icons' style='font-size: 18px;vertical-align: bottom;'>person_add</i> Sign Up";
var buttonlink = "/index";
var title = "Want some Push?";
var text = "For us to send you notifications, we need to know your device. Why don't you sign up and explore other features at once. ";
callabsolunia(title, text, button, buttonlink, closer);
}
//ask for users permission push
function pushtoabsolunia(){
var closer = "no thanks";
var button = "<i class='material-icons' style='font-size: 18px;vertical-align: bottom;'>tune</i> Settings";
var buttonlink = "/account/settings#pushn";
var title = "We need your permission";
var text = "For us to send you push notifications, we need push permission from this device. Please activate that in settings and we are all set. ";
callabsolunia(title, text, button, buttonlink, closer);
}
//user does not have push in borwser
function nopushinbrowser(){
var closer = "no thanks";
var button = "<i class='material-icons' style='font-size: 18px;vertical-align: bottom;'>filter_list</i> Support List";
var buttonlink = "https://developer.mozilla.org/en-US/docs/Web/API/notification#Browser_compatibility";
var title = "Get the upgrade!";
var text = "Seems we don't have support for web push notifications here. Checkout the list for browsers with push notifications support";
callabsolunia(title, text, button, buttonlink, closer);
}
//checking what push should look like on eventbox
function chesubpush(){
var chesubpushbtn = document.getElementById("chesubpushbtn"); //only do this if the user is given
if (chesubpushbtn){
if (('PushManager' in window)) {
if (Notification.permission == "granted") { //subscriibe user to this event
document.getElementById('chesubpushbtn').onclick= function(){
var suborunsub = document.getElementById("suborunsub").value;
if (suborunsub == "subing"){
document.getElementById("suborunsub").value = 'unsubing';
var req = 'eventpushsubs'; var dbid = 'subing'; var eventcode = document.getElementById("requestingevent").value;
var requestinguser = document.getElementById("requestinguser").value; if ("vibrate" in navigator){window.navigator.vibrate(10); }
ajaxsubtoevt(req, eventcode, requestinguser, dbid);
}
else{
document.getElementById("suborunsub").value = 'subing';
var req = 'eventpushsubs'; var dbid = 'unsubing'; var eventcode = document.getElementById("requestingevent").value;
var requestinguser = document.getElementById("requestinguser").value; if ("vibrate" in navigator){window.navigator.vibrate(10); }
ajaxsubtoevt(req, eventcode, requestinguser, dbid);
}
}
}
else{//permission not granted ask for it
document.getElementById('chesubpushbtn').onclick= function(){
pushtoabsolunia();
}
} }
else{ //push is not here
document.getElementById('chesubpushbtn').onclick= function(){
nopushinbrowser();
}}
}
}
//clikced on desk poll, scroll to rsvp section
let deskChangePollCode = () =>{
document.getElementById("accessCode").style.backgroundColor="#92ffc0";
eventbox(fourth);//run show pef code
document.location = '#scrollAccessCode';
}
//list of contributors
window.addEventListener("load", function(){
if(document.getElementById("viewEditors")){
document.getElementById("viewEditors").addEventListener("click", function(){
//get code and
var req = "getContributors";
var refs = document.getElementById("contributorsListCode").value;
//send request if its first time getContributorsHype will be published by movers return #savedata
if(document.getElementById("getContributorsHype")){ }
else{//first code run, fetch users & images
mainsprocess("contributorsList",req, refs);
}
//hide menia for event pageXOffset
if(document.getElementById('menia')){
document.getElementById('menia').style.height='0';
}
//display section
document.getElementById("contributorsListSection").style.display="block";
document.getElementById("gtr").style.display="block";
document.getElementById("contributorsListSection").style.top='15%';
});
//close list
document.getElementById("closeEditors").addEventListener("click", function(){
document.getElementById("gtr").style.display="none";
document.getElementById("contributorsListSection").style.top='100%';
});
}
});