function grayOut() { var ldiv = document.getElementById('LoadingDiv'); ldiv.style.display = 'block'; } var time = 1878000; window._wq = window._wq || []; _wq.push({ id: "ascmot2vl4", onReady: function(video) { console.log("I got a handle to the video!", video); var playBtn = document.getElementById('playscreen'); var videoBlock = document.getElementById('video'); var videoContainer = document.querySelector('.video-container'); var mainTitle = document.querySelector(".main-title"); var firstPlay = true; video.bind("pause", function() { playBtn.classList.remove("video-play"); videoBlock.classList.remove("video-play"); videoContainer.classList.remove("video-play"); videoBlock.removeAttribute("style") }); playBtn.addEventListener("click", function() { playBtn.classList.add("video-play"); videoBlock.classList.add("video-play"); videoContainer.classList.add("video-play"); scrollAnimation($('.video-container'), 600); video.play(); }) video.bind("crosstime", time / 1000, function() { show(); }); }, onEmbedded: function(video) { $("#playscreen").on("click", function() { $("#playscreen").addClass("video-play"); $('#video').addClass("video-play"); $('.video-container').addClass("video-play"); scrollAnimation($('.video-container'), 600); video.play(); }); } }); function Timer(minutes, minutesElement, secondsElement) { this.minutes = minutes; this.minutesElement = minutesElement; this.secondsElement = secondsElement; } Timer.prototype = { startTimer: function () { var that = this; var remainingTimeInSeconds = that.minutes * 60; that.parseTimeAndShow(remainingTimeInSeconds); that.timer = setInterval(function () { if (remainingTimeInSeconds === 0) { that.killTimer(); } that.parseTimeAndShow(remainingTimeInSeconds); remainingTimeInSeconds--; }, 1000); }, parseTimeAndShow: function (remainingTime) { var minutes = Math.floor(remainingTime / 60); var seconds = remainingTime - minutes * 60; this.minutesElement.text(this.validateTime(minutes)); this.secondsElement.text(this.validateTime(seconds)); }, validateTime: function (remainingTime) { return remainingTime >= 10 ? remainingTime : "0" + remainingTime; }, killTimer: function () { clearInterval(this.timer); } } function show() { $(".reveal-button").parent().hide(); $(".reveal-button").parent().next("li").hide(); $('.doctor').hide(); $('.as-seen-on').hide(); $(".main_content").show(); setTimeout(function () { scrollAnimation($("#offers"), 2000); }, 50); init(); } function toggleFaqs() { $(".faq__item").finish().on("click", function () { scrollAnimation($(this), 600); $(this).toggleClass("active").find(".faq__item_text").slideToggle(300); }) } function scrollAnimation(target, duration) { var top = target.offset().top; $("body,html").animate({ scrollTop: top - 15 }, duration); } $(document).on("click", "#getstarted", function (e) { e.preventDefault(); show(); }) function restrictInspector() { document.addEventListener('contextmenu', function (e) { e.preventDefault(); }); } function init() { if ($(".main_content").is(":visible")) { $(".video-container").removeClass("fullscreen"); var pageTimer = new Timer(15, $(".js-mins"), $(".js-secs")); pageTimer.startTimer(); proof.initiateProof(); } } function handleBottomCtaBtn() { $(".cta__btn").on("click", function(e){ e.preventDefault(); var target = $("body"); scrollAnimation(target, 1000); }) } function handleRating(){ console.log('run') $(".dislike").one("click", function(e) { $(this).find("span").text(+$(this).find("span").text() + 1) $($(this).parent().find(".like")).off() }) $(".like").one("click", function(e) { $(this).find("span").text(+$(this).find("span").text() + 1) $($(this).parent().find(".dislike")).off() }) } $(document).ready(function () { toggleFaqs(); init(); handleBottomCtaBtn(); handleRating() });