Merge branch 'hotfix/free-lessons-fix' into 'master'

окно реги при просмотре 3 минут бесплатного урока

See merge request lilschool/site!361
remotes/origin/hotfix/popup-fix
Danil 7 years ago
commit a041daddc2
  1. 2
      apps/school/templates/school/free_lessons.html
  2. 36
      web/src/js/modules/popup.js

@ -14,7 +14,7 @@
<div class="section section_video"> <div class="section section_video">
<div class="section__center center center_sm" style="text-align: center;"> <div class="section__center center center_sm" style="text-align: center;">
<img class="main-video-preview js-video-modal" data-video-url="{{ config.FREE_LESSONS_VIDEO_URL|safe }}" data-trial-lesson="1" <img class="main-video-preview js-video-modal" data-video-url="{{ config.FREE_LESSONS_VIDEO_URL|safe }}" data-free-lesson="1"
src="{% if config.FREE_LESSONS_VIDEO_PREVIEW_IMG %}{{ config.FREE_LESSONS_VIDEO_PREVIEW_IMG.url }}{% endif %}"/> src="{% if config.FREE_LESSONS_VIDEO_PREVIEW_IMG %}{{ config.FREE_LESSONS_VIDEO_PREVIEW_IMG.url }}{% endif %}"/>
<div style="margin-top: 15px;">Приглашай друзей и получай лилики. <div style="margin-top: 15px;">Приглашай друзей и получай лилики.
<a href="#" class="btn btn_stroke-black" <a href="#" class="btn btn_stroke-black"

@ -97,13 +97,15 @@ $(document).ready(function () {
}); });
$(".js-video-modal").on('player-created', e => { $(".js-video-modal").on('player-created', e => {
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; return;
} }
const channel = $(e.target).data('channel'); const channel = $(e.target).data('channel');
const player = e.detail.player; const player = e.detail.player;
let timeout = null; 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 = () => { const pauseVideo = () => {
timeout = setTimeout(() => { timeout = setTimeout(() => {
clearTimeout(timeout); clearTimeout(timeout);
@ -118,18 +120,24 @@ $(document).ready(function () {
player.pause(); player.pause();
} }
$modalVideo.css('opacity', 0); $modalVideo.css('opacity', 0);
captureEmail(true).then(() => { if(freeLesson){
$modalVideo.css('opacity', 1); popup = $('.js-popup-auth');
Cookies.set(EMAIL_CAPTURED_COOKIE, 1); showPopup();
if(channel == 'youtube'){ }
player.playVideo(); else{
} captureEmail(true).then(() => {
else if(channel == 'vimeo'){ $modalVideo.css('opacity', 1);
player.play(); Cookies.set(EMAIL_CAPTURED_COOKIE, 1);
} if(channel == 'youtube'){
}).catch(() => { player.playVideo();
$('.modal-video').remove(); }
}); else if(channel == 'vimeo'){
player.play();
}
}).catch(() => {
$('.modal-video').remove();
});
}
}, interval); }, interval);
} }
if(channel == 'youtube'){ if(channel == 'youtube'){

Loading…
Cancel
Save