Your IP : 18.119.19.181


Current Path : /var/www/www-root/data/www/monolith-realty.ru/local/templates/monolitsochi/js/
Upload File :
Current File : /var/www/www-root/data/www/monolith-realty.ru/local/templates/monolitsochi/js/video_banner.min.js

var players={};function pauseMainBanner(){$(".banners-big .main-slider").data("swiper").autoplay.stop()}function playMainBanner(){$(".banners-big .main-slider").data("swiper").params.autoplay.enabled&&$(".banners-big .main-slider").data("swiper").autoplay.start()}function startMainBannerSlideVideo($slide){var slideActiveIndex=$slide.attr("data-slide_index"),$slides=$slide.closest(".main-slider").find('.main-slider__item[data-slide_index="'+slideActiveIndex+'"]'),videoSource;if($slide.attr("data-video_source")){$slides.addClass("loading"),pauseMainBanner();var $slider=$slide.closest(".main-slider"),slidesIndexesWithVideo=$slider.data("slidesIndexesWithVideo");void 0===slidesIndexesWithVideo&&(slidesIndexesWithVideo=[]),slidesIndexesWithVideo.push(slideActiveIndex),$slider.data("slidesIndexesWithVideo",slidesIndexesWithVideo);var videoPlayerSrc=$slide.attr("data-video_src"),videoSoundDisabled,bVideoSoundDisabled=1==$slide.attr("data-video_disable_sound"),videoLoop,bVideoLoop=1==$slide.attr("data-video_loop"),bVideoAutoPlay=1==$slide.attr("data-video_autoplay"),videoCover,bVideoCover=1==$slide.attr("data-video_cover"),videoUnderText,bVideoUnderText=1==$slide.attr("data-video_under_text"),videoPlayer=$slide.attr("data-video_player"),bVideoPlayerYoutube="YOUTUBE"===videoPlayer,bVideoPlayerVimeo="VIMEO"===videoPlayer,bVideoPlayerRutube="RUTUBE"===videoPlayer,bVideoPlayerHtml5="HTML5"===videoPlayer,videoWidth=!bVideoPlayerHtml5&&$slide.attr("data-video_width"),videoHeight=!bVideoPlayerHtml5&&$slide.attr("data-video_height");if(videoPlayerSrc&&!$slide.find(".video").length){var InitPlayer=function(){for(var videoIDs=[],i=0;i<$slides.length;++i){var videoID=getRandomInt(100,1e3);videoIDs.push(videoID)}$slides.each((function(i,node){var $_slide=$(node),videoID=videoIDs[i],videoClass=$_slide.attr("id")+" player_"+videoID+(bVideoCover?" cover":"");$_slide.find(".video."+videoClass).length||(bVideoPlayerYoutube?$_slide.prepend('<div class="wrapper_video"><iframe id="player_'+videoID+'" class="video '+videoClass+'" src="'+videoPlayerSrc+'" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen allow="accelerometer; encrypted-media; gyroscope; fullscreen;"'+(videoWidth&&videoHeight?' data-video_proportion="'+videoWidth/videoHeight+'"':"")+"></iframe></div>"):bVideoPlayerVimeo?$_slide.prepend('<div class="wrapper_video"><iframe id="player_'+videoID+'" class="video '+videoClass+'" src="'+videoPlayerSrc+'" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen allow="accelerometer; encrypted-media; gyroscope; fullscreen;"'+(videoWidth&&videoHeight?' data-video_proportion="'+videoWidth/videoHeight+'"':"")+"></iframe></div>"):bVideoPlayerRutube?(videoPlayerSrc=videoPlayerSrc+"&playerid="+videoID,$_slide.prepend('<div class="wrapper_video"><iframe id="player_'+videoID+'" class="video '+videoClass+'" src="'+videoPlayerSrc+'" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen allow="encrypted-media; gyroscope; fullscreen;"'+(videoWidth&&videoHeight?' data-video_proportion="'+videoWidth/videoHeight+'"':"")+"></iframe></div>")):bVideoPlayerHtml5&&$_slide.prepend('<div class="wrapper_video"><video '+(bVideoAutoPlay?"autoplay ":"")+'autobuffer playsinline webkit-playsinline id="player_'+videoID+'" class="video '+videoClass+'"'+(bVideoLoop?" loop ":"")+(bVideoSoundDisabled?" muted ":"")+'><source src="'+videoPlayerSrc+'" type=\'video/mp4; codecs="avc1.42E01E, mp4a.40.2"\' /><p class="vjs-no-js">To view this video please enable JavaScript, and consider upgrading to a web browser that supports HTML5 video</p></iframe></div>')),void 0!==players&&players&&(players[videoID]={id:"player_"+videoID,mute:bVideoSoundDisabled,loop:bVideoLoop,cover:bVideoCover,videoPlayer:videoPlayer,slideIndex:slideActiveIndex,playing:!1,clones:videoIDs,videoWidth:videoWidth,videoHeight:videoHeight,videoProportion:!(!videoWidth||!videoHeight)&&videoWidth/videoHeight,src:videoPlayerSrc},bVideoPlayerYoutube?window[players[videoID].id]=new YT.Player(players[videoID].id,{events:{onReady:function(e){if(videoID){var mute=players[videoID].mute,cover=players[videoID].cover,$slide=$("#player_"+videoID).closest(".main-slider__item"),hidden=!$("#player_"+videoID).closest(".swiper-slide-active").length;if((mute||hidden)&&window[players[videoID].id].mute(),cover){if(!players[videoID].videoProportion){var embedHtml=e.target.getVideoEmbedCode();if(embedHtml.length){var match=embedHtml.match(/width="(\d*)"[^>]*height="(\d*)"/);if(null!==match){var videoWidth=match[1],videoHeight=match[2];players[videoID].videoWidth=videoWidth,players[videoID].videoHeight=videoHeight,players[videoID].videoProportion=videoWidth/videoHeight,$slide.find(".video").attr("data-video_proportion",players[videoID].videoProportion)}}}CoverPlayer()}hidden?setTimeout((function(){e.target.pauseVideo()}),100):(pauseMainBanner(),window[players[videoID].id].seekTo(0,!0)),$slide.addClass("started")}},onStateChange:function(e){if(videoID){var loop=players[videoID].loop,$slide=$("#player_"+videoID).closest(".main-slider__item"),hidden;if(!$("#player_"+videoID).closest(".swiper-slide-active").length)players[videoID].playing=!1,$("#player_"+videoID).closest(".main-slider__item").removeClass("loading"),$("#player_"+videoID).closest(".main-slider__item").find(".banners-big__inner .btn-video").removeClass("loading");else if(e.data===YT.PlayerState.PLAYING){players[videoID].playing=!0,$("#player_"+videoID).closest(".main-slider__item").addClass("loading"),$("#player_"+videoID).closest(".main-slider__item").find(".banners-big__inner .btn-video").addClass("loading"),pauseMainBanner();var videoClones=players[videoID].clones;for(var j in videoClones)videoClones[j]!=videoID&&players[videoClones[j]].playing&&window[players[videoClones[j]].id].pauseVideo()}else if(e.data===YT.PlayerState.PAUSED){players[videoID].playing=!1;var time=Math.floor(10*window[players[videoID].id].getCurrentTime())/10;$("#player_"+videoID).closest(".main-slider__item").removeClass("loading"),$("#player_"+videoID).closest(".main-slider__item").find(".banners-big__inner .btn-video").removeClass("loading"),window[players[videoID].id].seekTo(time,!0);var videoClones=players[videoID].clones;for(var j in videoClones)videoClones[j]!=videoID&&(players[videoClones[j]].playing&&window[players[videoClones[j]].id].pauseVideo(),"getCurrentTime"in window[players[videoClones[j]].id]&&window[players[videoClones[j]].id].seekTo(time,!0));playMainBanner()}else e.data===YT.PlayerState.ENDED?(players[videoID].playing=!1,loop?e.target.playVideo():playMainBanner()):e.data===YT.PlayerState.UNSTARTED&&(players[videoID].playing=!1,$("#player_"+videoID).closest(".main-slider__item").find(".banners-big__inner .btn-video").removeClass("loading"),e.target.playVideo())}}}}):bVideoPlayerVimeo?(window[players[videoID].id]=new Vimeo.Player(document.getElementById(players[videoID].id),{autopause:!1,byline:!1,loop:!1,title:!1}),window[players[videoID].id].on("loaded",onVimeoPlayerReady),window[players[videoID].id].on("play",onVimeoPlayerStateChange),window[players[videoID].id].on("pause",onVimeoPlayerStateChange),window[players[videoID].id].on("ended",onVimeoPlayerStateChange)):bVideoPlayerRutube?document.getElementById(players[videoID].id).onload=function(e){var videoID=this.id.replace("player_","");players[videoID].contentWindow=this.contentWindow,onRutubePlayerReady(videoID)}:bVideoPlayerHtml5&&(document.getElementById(players[videoID].id).addEventListener("loadeddata",onHtml5PlayerReady),document.getElementById(players[videoID].id).addEventListener("play",onHtml5PlayerStateChange),document.getElementById(players[videoID].id).addEventListener("pause",onHtml5PlayerStateChange),document.getElementById(players[videoID].id).addEventListener("ended",onHtml5PlayerStateChange)))}))};if(bVideoPlayerHtml5)InitPlayer();else{var obPlayerVariable="",fnPlayerVariable="";if(void 0===window.YoutubePlayerScriptLoaded&&(window.YoutubePlayerScriptLoaded=!1),void 0===window.VimeoPlayerScriptLoaded&&(window.VimeoPlayerScriptLoaded=!1),void 0===window.RutubePlayerListnersAdded&&(window.RutubePlayerListnersAdded=!1),bVideoPlayerYoutube){if(obPlayerVariable="YT",fnPlayerVariable="Player",!window.YoutubePlayerScriptLoaded){var script;(script=document.createElement("script")).src="https://www.youtube.com/iframe_api";var firstScriptTag=document.getElementsByTagName("script")[0];firstScriptTag.parentNode.insertBefore(script,firstScriptTag),window.YoutubePlayerScriptLoaded=!0}}else if(bVideoPlayerVimeo){var script;if(obPlayerVariable="Vimeo",!window.VimeoPlayerScriptLoaded)(script=document.createElement("script")).src="https://player.vimeo.com/api/player.js",(document.head||document.documentElement).appendChild(script),window.VimeoPlayerScriptLoaded=!0}else bVideoPlayerRutube&&(window.RutubePlayerListnersAdded||window.addEventListener("message",(function(e){if(-1!==e.origin.indexOf("rutube.ru")){var message=JSON.parse(e.data);if("object"==typeof message&&message&&void 0!==message.type&&message.type){var videoID=!1;for(var j in players)if(void 0!==players[j].contentWindow&&players[j].contentWindow==e.source){videoID=j;break}if(videoID)switch(message.type){case"player:changeState":onRutubePlayerStateChange(videoID,message.data.state);break;case"player:currentTime":onRutubePlayerCurrentTime(videoID,message.data.time)}}}})));if(obPlayerVariable.length)if("object"==typeof window[obPlayerVariable])(!fnPlayerVariable.length||fnPlayerVariable.length&&"function"==typeof window[obPlayerVariable][fnPlayerVariable])&&InitPlayer();else var waitPlayerInterval=setInterval((function(){"object"==typeof window[obPlayerVariable]&&(!fnPlayerVariable.length||fnPlayerVariable.length&&"function"==typeof window[obPlayerVariable][fnPlayerVariable])&&(clearInterval(waitPlayerInterval),InitPlayer())}),50);else InitPlayer()}}else if(void 0!==players&&players)for(var j in players)"object"==typeof window[players[j].id]&&(players[j].playing?"YOUTUBE"===players[j].videoPlayer?window[players[j].id].pauseVideo():"VIMEO"===players[j].videoPlayer?window[players[j].id].pause():"RUTUBE"===players[j].videoPlayer?document.getElementById(players[j].id).contentWindow.postMessage(JSON.stringify({type:"player:pause",data:{}}),"*"):"HTML5"===players[j].videoPlayer&&document.getElementById(players[j].id).pause():players[j].slideIndex==slideActiveIndex&&("YOUTUBE"===players[j].videoPlayer?"function"==typeof window[players[j].id].playVideo&&window[players[j].id].playVideo():"VIMEO"===players[j].videoPlayer?window[players[j].id].play():"RUTUBE"===players[j].videoPlayer?document.getElementById(players[j].id).contentWindow.postMessage(JSON.stringify({type:"player:play",data:{}}),"*"):"HTML5"===players[j].videoPlayer&&document.getElementById(players[j].id).play()))}}var CoverPlayer=function(){$(".banners-big .video.cover:visible").each((function(){var $slide=$(this).closest(".main-slider__item"),slideHeight=$slide[0].getBoundingClientRect().height,slideWidth=$slide[0].getBoundingClientRect().width,videoProportion=$(this).attr("data-video_proportion");void 0===videoProportion&&(videoProportion=16/9);var videoWidth=slideWidth,videoHeight=slideWidth/videoProportion;videoHeight<slideHeight&&(videoWidth=slideHeight*videoProportion,videoHeight=slideHeight),$(this).width(videoWidth).height(videoHeight)}))};function onVimeoPlayerReady(e){var videoID=this.element.id.replace("player_","");if(videoID){var mute=players[videoID].mute,cover=players[videoID].cover,$slide=$("#player_"+videoID).closest(".main-slider__item"),clone=$("#player_"+videoID).closest(".main-slider__item:not(.swiper-slide-active)").length;if((mute||clone)&&window[players[videoID].id].setVolume(0),cover&&!players[videoID].videoProportion){var widthPromise=window[players[videoID].id].getVideoWidth(),heightPromise=window[players[videoID].id].getVideoHeight();widthPromise.then((function(value){var videoWidth=value;heightPromise.then((function(value){var videoHeight=value;players[videoID].videoWidth=videoWidth,players[videoID].videoHeight=videoHeight,players[videoID].videoProportion=videoWidth/videoHeight,$slide.find(".video").attr("data-video_proportion",players[videoID].videoProportion),CoverPlayer()}))}))}if(clone)setTimeout((function(){window[players[videoID].id].pause()}),100);else{pauseMainBanner();var promise=window[players[videoID].id].play();void 0!==promise&&promise.catch((function(){setTimeout((function(){window[players[videoID].id].setVolume(0),window[players[videoID].id].play()}),100)}))}$slide.addClass("started")}}function onVimeoPlayerStateChange(e){var videoID=this.element.id.replace("player_","");if(videoID){var cover=players[videoID].cover,loop=players[videoID].loop,slideIndex=players[videoID].slideIndex,clone=$("#player_"+videoID).closest(".main-slider__item:not(.swiper-slide-active)").length;window[players[videoID].id].getPaused().then((function(paused){paused?(players[videoID].playing=!1,$("#player_"+videoID).closest(".main-slider__item").removeClass("loading"),$("#player_"+videoID).closest(".main-slider__item").find(".banners-big__inner .btn-video").removeClass("loading"),window[players[videoID].id].getCurrentTime().then((function(seconds){var time=Math.floor(10*seconds)/10;window[players[videoID].id].setCurrentTime(time).then((function(seconds){for(var j in players)players[j].slideIndex==slideIndex&&(j!=videoID||clone&&j==videoID)&&window[players[j].id]&&(window[players[j].id].pause(),window[players[j].id].setCurrentTime(time).then((function(seconds){})))}))}))):($("#player_"+videoID).closest(".main-slider__item").addClass("loading"),$("#player_"+videoID).closest(".main-slider__item").find(".banners-big__inner .btn-video").addClass("loading"),window[players[videoID].id].getEnded().then((function(ended){ended?(players[videoID].playing=!1,loop?window[players[videoID].id].play():playMainBanner()):(players[videoID].playing=!0,pauseMainBanner())})))}))}}function onRutubePlayerReady(videoID){if(videoID){var mute=players[videoID].mute,cover=players[videoID].cover,player=document.getElementById(players[videoID].id),$slide=$("#player_"+videoID).closest(".main-slider__item"),clone=$(player).closest(".main-slider__item:not(.swiper-slide-active)").length;(mute||clone)&&player.contentWindow.postMessage(JSON.stringify({type:"player:mute",data:{}}),"*"),cover&&CoverPlayer(),clone?setTimeout((function(){player.contentWindow.postMessage(JSON.stringify({type:"player:pause",data:{}}),"*")}),100):(pauseMainBanner(),player.contentWindow.postMessage(JSON.stringify({type:"player:play",data:{}}),"*")),$slide.addClass("started")}}function onRutubePlayerCurrentTime(videoID,time){videoID&&(players[videoID].time=time)}function onRutubePlayerStateChange(videoID,state){if(videoID){var loop=players[videoID].loop,slideIndex=players[videoID].slideIndex,player=document.getElementById(players[videoID].id),clone=$(player).closest(".main-slider__item:not(.swiper-slide-active)").length;if("playing"===state)$("#"+videoID).closest(".main-slider__item").addClass("loading"),$("#"+videoID).closest(".main-slider__item").find(".banners-big__inner .btn-video").addClass("loading"),players[videoID].playing=!0,pauseMainBanner();else if("paused"===state){$("#"+videoID).closest(".main-slider__item").removeClass("loading"),$("#"+videoID).closest(".main-slider__item").find(".banners-big__inner .btn-video").removeClass("loading"),players[videoID].playing=!1;var time=Math.floor(10*players[videoID].time)/10;for(var j in player.contentWindow.postMessage(JSON.stringify({type:"player:setCurrentTime",data:{time:time}}),"*"),players)players[j].slideIndex==slideIndex&&(j!=videoID||clone&&j==videoID)&&document.getElementById(players[j].id)&&(document.getElementById(players[j].id).contentWindow.postMessage(JSON.stringify({type:"player:pause",data:{}}),"*"),document.getElementById(players[j].id).contentWindow.postMessage(JSON.stringify({type:"player:setCurrentTime",data:{time:time}}),"*"))}else"stopped"===state&&($("#"+videoID).closest(".main-slider__item").removeClass("loading"),$("#"+videoID).closest(".main-slider__item").find(".banners-big__inner .btn-video").removeClass("loading"),players[videoID].playing=!1,loop?player.contentWindow.postMessage(JSON.stringify({type:"player:play",data:{}}),"*"):playMainBanner())}}function onHtml5PlayerReady(e){var videoID=e.target.id.replace("player_","");if(videoID){var mute=players[videoID].mute,cover=players[videoID].cover,clone=$(e.target).closest(".main-slider__item:not(.swiper-slide-active)").length,$slide=$("#player_"+videoID).closest(".main-slider__item");if((mute||clone)&&$("#"+players[videoID].id).prop("muted",!0),cover){if(!players[videoID].videoProportion){var videoWidth=$slide.find(".video")[0].videoWidth,videoHeight=$slide.find(".video")[0].videoHeight;players[videoID].videoWidth=videoWidth,players[videoID].videoHeight=videoHeight,players[videoID].videoProportion=videoWidth/videoHeight,$slide.find(".video").attr("data-video_proportion",players[videoID].videoProportion)}CoverPlayer()}if(clone)e.target.pause();else{pauseMainBanner();var promise=e.target.play();void 0!==promise&&promise.catch((function(){setTimeout((function(){$("#"+players[videoID].id).prop("muted",!0),e.target.play()}),100)}))}$slide.addClass("started")}}function onHtml5PlayerStateChange(e){var videoID=e.target.id.replace("player_","");if(videoID){var cover=players[videoID].cover,clone=$(e.target).closest(".main-slider__item:not(.swiper-slide-active)").length,loop=players[videoID].loop,slideIndex=players[videoID].slideIndex;if(e.target.paused&&!e.target.ended){players[videoID].playing=!1,$("#player_"+videoID).closest(".main-slider__item").removeClass("loading"),$("#player_"+videoID).closest(".main-slider__item").find(".banners-big__inner .btn-video").removeClass("loading");var time=Math.floor(10*e.target.currentTime)/10;for(var j in e.target.currentTime=time,players)players[j].slideIndex==slideIndex&&(j!=videoID||clone&&j==videoID)&&document.getElementById(players[j].id)&&(document.getElementById(players[j].id).pause(),document.getElementById(players[j].id).currentTime=time);pauseMainBanner(),playMainBanner()}else e.target.ended?(players[videoID].playing=!1,loop?($("#player_"+videoID).closest(".main-slider__item").addClass("loading"),$("#player_"+videoID).closest(".main-slider__item").find(".banners-big__inner .btn-video").addClass("loading"),e.target.play()):(pauseMainBanner(),playMainBanner())):(players[videoID].playing=!0,$("#player_"+videoID).closest(".main-slider__item").addClass("loading"),$("#player_"+videoID).closest(".main-slider__item").find(".banners-big__inner .btn-video").addClass("loading"),pauseMainBanner())}}waitYTPlayer=function(delay,callback){"undefined"!=typeof YT&&YT&&YT.Player?"function"==typeof callback&&callback():setTimeout((function(){waitYTPlayer(delay,callback)}),delay)},$(document).on("click","video.video",(function(e){var videoID=e.target.id.replace("player_","");videoID&&(players[videoID].playing?e.target.pause():e.target.play())})),$(document).on("click",".banners-big .btn-video",(function(e){e.stopPropagation(),startMainBannerSlideVideo($(this).closest(".main-slider__item"))})),$(document).on("click",".banners-big .banners-big__item",(function(e){var $item=$(this),vvideo=$item.hasClass("vvideo"),wurl=$item.hasClass("wurl");if(!$(e.target).hasClass("btn"))if(wurl){var href=$item.find(".target").attr("href");if(href.length){var target=$item.find(".target").attr("target");void 0===target||"_self"===target?location.href=href:window.open(href)}}else vvideo&&(e.stopPropagation(),$(this).find(".btn-video").trigger("click"))})),getRandomInt=function(min,max){return Math.floor(Math.random()*(max-min))+min};var ignoreResize=[];BX.addCustomEvent("onWindowResize",(function(eventdata){try{CoverPlayer()}catch(e){}finally{ignoreResize.pop()}})),BX.addCustomEvent("onSlideEnd",(function(eventdata){try{var slider;if(ignoreResize.push(!0),eventdata)eventdata.slider&&setTimeout((function(){$(".banners-big.front .btn-video, .banners-big.front .banners-big__item").removeClass("loading")}),300)}catch(e){}finally{ignoreResize.pop()}})),BX.addCustomEvent("onSlide",(function(eventdata){try{if(ignoreResize.push(!0),eventdata){var slider=eventdata.slider;if(slider){if(slider.data("swiper"))var curSlideIndex=slider.data("swiper").realIndex,curSlide=slider.find(".main-slider__item").eq(curSlideIndex+1);else if(slider.find(".swiper-slide-active").length)var curSlide=slider.find(".swiper-slide-active").first();else var curSlide=slider.find(".main-slider__item:not(.swiper-slide-duplicate)").eq(0);var curSlide,dataSlideIndex=(curSlide=slider.find(".box.swiper-slide-active")).attr("data-slide_index");if(void 0!==curSlide&&curSlide.length){var slidesIndexesWithVideo=slider.data("slidesIndexesWithVideo"),bVideoVisible,bVideoAutoPlay;if(void 0===slidesIndexesWithVideo&&(slidesIndexesWithVideo=[]),-1!=slidesIndexesWithVideo.indexOf(dataSlideIndex)?slider.addClass("video_visible"):slider.removeClass("video_visible"),setTimeout((function(){CoverPlayer()}),200),void 0!==players&&players)for(var j in players)players[j].playing&&players[j].slideIndex!=dataSlideIndex&&"object"==typeof window[players[j].id]&&("YOUTUBE"===players[j].videoPlayer?window[players[j].id].pauseVideo():"VIMEO"===players[j].videoPlayer?window[players[j].id].pause():"RUTUBE"===players[j].videoPlayer?document.getElementById(players[j].id).contentWindow.postMessage(JSON.stringify({type:"player:pause",data:{}}),"*"):"HTML5"===players[j].videoPlayer&&document.getElementById(players[j].id).pause());1==curSlide.attr("data-video_autoplay")&&startMainBannerSlideVideo(curSlide)}if(curSlide.find("video").length&&!curSlide.find(".btn-video").length){var videoID=curSlide.find("video").attr("id");document.getElementById(videoID).play()}}}}catch(e){}finally{ignoreResize.pop()}}));
//# sourceMappingURL=video_banner.min.js.map