public.min.js 3.39 KB
!function(){"use strict";jQuery((function(t){({init:function(){this.cacheVariables(),this.countDownTimerMoment(),this.evntLoaders()},cacheVariables:function(){this.$timer=t("#dpn-zvc-timer"),this.changeMeetingState=t(".vczapi-meeting-state-change")},evntLoaders:function(){t(document).ready(this.setTimezone.bind(this)),t(this.changeMeetingState).on("click",this.meetingStateChange.bind(this))},countDownTimerMoment:function(){var e=this.$timer;if(e.length>0){var a=e.data("date"),n=e.data("tz"),i=e.data("state"),o=moment.tz.guess();"Asia/Katmandu"===o&&(o="Asia/Kathmandu");var r=moment.tz(a,n).format(),d=moment.tz(r,o).format("MMM D, YYYY HH:mm:ss"),s=moment.tz(r,o).format(),m=moment().unix(),c=moment(s).unix()-m,g=document.documentElement.lang,v=""!==zvc_strings.date_format?zvc_strings.date_format:"LLLL";t(".sidebar-start-time").html(moment.parseZone(s).locale(g).format(v)),t(".vczapi-single-meeting-timezone").html(o);var u=36e5,l=24*u;if("ended"===i)t(e).html("<div class='dpn-zvc-meeting-ended'><h3>"+zvc_strings.meeting_ended+"</h3></div>");else if(c>0)var h=new Date(d).getTime(),_=setInterval((function(){var a=(new Date).getTime(),n=h-a;document.getElementById("dpn-zvc-timer-days").innerText=Math.floor(n/l),document.getElementById("dpn-zvc-timer-hours").innerText=Math.floor(n%l/u),document.getElementById("dpn-zvc-timer-minutes").innerText=Math.floor(n%u/6e4),document.getElementById("dpn-zvc-timer-seconds").innerText=Math.floor(n%6e4/1e3),n<0&&(clearInterval(_),t(e).html("<div class='dpn-zvc-meeting-ended'><h3>"+zvc_strings.meeting_starting+"</h3></div>"))}),1e3);else t(e).remove()}},setTimezone:function(){var e=moment.tz.guess();"Asia/Katmandu"===e&&(e="Asia/Kathmandu");try{if(void 0!==typeof mtg_data&&"single-meeting"===mtg_data.page){t(".dpn-zvc-sidebar-content").after('<div class="dpn-zvc-sidebar-box remove-sidebar-loder-text"><p>Loading..Please wait..</p></div>');var a={action:"set_timezone",user_timezone:e,post_id:mtg_data.post_id,mtg_timezone:mtg_data.timezone,start_date:mtg_data.start_date,meeting_type:mtg_data.meeting_type,type:"page"};t.post(mtg_data.ajaxurl,a).done((function(e){e.success?t(".dpn-zvc-sidebar-content").after(e.data):t(".dpn-zvc-sidebar-content").after('<div class="dpn-zvc-sidebar-box vczapi-no-longer-valid">'+e.data+"</div>"),t(".remove-sidebar-loder-text").remove()}))}if(void 0!==typeof mtg_data&&"shortcode"===mtg_data.type){var n={action:"set_timezone",user_timezone:e,mtg_timezone:mtg_data.timezone,join_uri:mtg_data.join_uri,browser_url:mtg_data.browser_url,start_date:mtg_data.start_date,type:"shortcode"};t(".zvc-table-shortcode-duration").after('<tr class="remove-shortcode-loder-text"><td colspan="2">Loading.. Please wait..</td></tr>'),t.post(mtg_data.ajaxurl,n).done((function(e){e.success?t(".zvc-table-shortcode-duration").after(e.data):t(".zvc-table-shortcode-duration").after('<tr><td colspan="2">'+e.data+"</td></tr>"),t(".remove-shortcode-loder-text").remove()}))}}catch(t){}},meetingStateChange:function(e){e.preventDefault();var a=t(e.currentTarget).data("state"),n=t(e.currentTarget).data("postid"),i={id:t(e.currentTarget).data("id"),state:a,type:t(e.currentTarget).data("type"),post_id:n||!1,action:"state_change",accss:vczapi_state.zvc_security};if("resume"===a)this.changeState(i);else if("end"===a){if(!confirm(vczapi_state.lang.confirm_end))return;this.changeState(i)}},changeState:function(e){t.post(vczapi_state.ajaxurl,e).done((function(t){location.reload()}))}}).init()}))}();