diff --git a/apps/school/templates/school/free_lessons.html b/apps/school/templates/school/free_lessons.html index e740d2b1..d67d0d15 100644 --- a/apps/school/templates/school/free_lessons.html +++ b/apps/school/templates/school/free_lessons.html @@ -14,7 +14,7 @@
-
Приглашай друзей и получай лилики. { - if(window.LIL_STORE.user.id || ! $(e.target).data('trialLesson') || Cookies.get(EMAIL_CAPTURED_COOKIE)){ + if(window.LIL_STORE.user.id || $(e.target).data('trialLesson') && Cookies.get(EMAIL_CAPTURED_COOKIE) + || ! $(e.target).data('freeLesson')){ return; } const channel = $(e.target).data('channel'); const player = e.detail.player; let timeout = null; - const interval = 1000 * 60; // 1 min + const freeLesson = $(e.target).data('freeLesson') + const interval = 1000 * (freeLesson ? 180 : 60); // 1 min const pauseVideo = () => { timeout = setTimeout(() => { clearTimeout(timeout); @@ -118,18 +120,24 @@ $(document).ready(function () { player.pause(); } $modalVideo.css('opacity', 0); - captureEmail(true).then(() => { - $modalVideo.css('opacity', 1); - Cookies.set(EMAIL_CAPTURED_COOKIE, 1); - if(channel == 'youtube'){ - player.playVideo(); - } - else if(channel == 'vimeo'){ - player.play(); - } - }).catch(() => { - $('.modal-video').remove(); - }); + if(freeLesson){ + popup = $('.js-popup-auth'); + showPopup(); + } + else{ + captureEmail(true).then(() => { + $modalVideo.css('opacity', 1); + Cookies.set(EMAIL_CAPTURED_COOKIE, 1); + if(channel == 'youtube'){ + player.playVideo(); + } + else if(channel == 'vimeo'){ + player.play(); + } + }).catch(() => { + $('.modal-video').remove(); + }); + } }, interval); } if(channel == 'youtube'){