join-via-browser.js
2.45 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
/******/ (function() { // webpackBootstrap
var __webpack_exports__ = {};
jQuery(function ($) {
var video_conferencing_zoom_jbv = {
init: function () {
this.cacheVariables();
this.countDown();
},
cacheVariables: function () {
this.$timer = $('#dpn-zvc-timer');
},
countDown: function () {
var clock = this.$timer;
if (clock.length > 0) {
var valueDate = clock.data('date');
var mtgTimezone = clock.data('tz');
// var dateFormat = moment(valueDate).format('MMM D, YYYY HH:mm:ss');
var user_timezone = moment.tz.guess();
if (user_timezone === 'Asia/Katmandu') {
user_timezone = 'Asia/Kathmandu';
}
//Converting Timezones to locals
var source_timezone = moment.tz(valueDate, mtgTimezone).format();
var converted_timezone = moment.tz(source_timezone, user_timezone).format('MMM D, YYYY HH:mm:ss');
var convertedTimezonewithoutFormat = moment.tz(source_timezone, user_timezone).format();
//Check Time Difference for Validations
var currentTime = moment().unix();
var eventTime = moment(convertedTimezonewithoutFormat).unix();
var diffTime = eventTime - currentTime;
var lang = document.documentElement.lang;
$('.sidebar-start-time').html(moment.parseZone(convertedTimezonewithoutFormat).locale(lang).format('LLLL'));
var second = 1000,
minute = second * 60,
hour = minute * 60,
day = hour * 24;
// if time to countdown
if (diffTime > 0) {
var countDown = new Date(converted_timezone).getTime();
var x = setInterval(function () {
var now = new Date().getTime();
var distance = countDown - now;
document.getElementById('dpn-zvc-timer-days').innerText = Math.floor(distance / day);
document.getElementById('dpn-zvc-timer-hours').innerText = Math.floor(distance % day / hour);
document.getElementById('dpn-zvc-timer-minutes').innerText = Math.floor(distance % hour / minute);
document.getElementById('dpn-zvc-timer-seconds').innerText = Math.floor(distance % minute / second);
if (distance < 0) {
clearInterval(x);
location.reload();
}
}, second);
} else {
// location.reload();
$(clock).remove();
}
}
}
};
video_conferencing_zoom_jbv.init();
});
/******/ })()
;