diff --git a/vam.min.js b/vam.min.js index a37dfd3..6acd3ae 100644 --- a/vam.min.js +++ b/vam.min.js @@ -1 +1 @@ -var UserGestureSaver=function(){var A;return void 0===A?A=new function(){var A=1e3,e=100,t=[],i=[],n=function(){i.forEach(function(A){clearTimeout(A)});for(var n=1;n<=A/e;n++){var o=setTimeout(function(){t=t.filter(function(A){A()})},e*n);i.push(o)}};this.push=function(A){"function"==typeof A&&t.push(A)},window.addEventListener("touchend",n)}:A}(),VideoAdManager=function(A){var e,t,n=this,o={},a=!1;this.tid_=(""+Math.random()).split(".")[1],this.config_=A,this.states_={};this.createCreativeContainer_=function(){this.creativeContainer_=document.createElement("div"),this.creativeContainer_.className="VAMContainer creativeContainer "+this.config_.target.creative_type+"Container","SU"==this.config_.target.creative_type?("iFrameDispatcher"==this.config_.dispatcher_name&&(window.frameElement.style.maxHeight=this.config_.video_height+"px",window.frameElement.style.position="fixed",window.frameElement.style.bottom=0,window.frameElement.style.right=0,window.frameElement.style[this.config_.target.position]="0px!important",window.frameElement.style.transition="max-width 1s ease-out"),this.creativeContainer_.style.maxHeight=this.config_.video_height+"px","left"==this.config_.target.position&&this.creativeContainer_.classList.add("mwayss_left")):this.creativeContainer_.style.maxWidth=this.config_.video_width+"px","dynamic"==this.config_.target.creation_type?(this.targetContainer_=document.querySelector(this.config_.target.container),"IU"==this.config_.target.creative_type&&(this.config_.target.position="prepend"),this.targetContainer_.insertBefore(this.creativeContainer_,"prepend"==this.config_.target.position?this.targetContainer_.firstChild:null),this.createVideoPlayer_()):(this.videoPlayer_=document.querySelector(this.config_.target.container),this.targetContainer_=this.videoPlayer_.parentNode,this.targetContainer_.insertBefore(this.creativeContainer_,this.videoPlayer_.nextSibling),this.creativeContainer_.appendChild(this.videoPlayer_)),this.prepareVideoPlayer_()}.bind(this),this.createVideoPlayer_=function(){this.videoPlayer_=this.videoContainer_=document.createElement("video"),this.videoPlayer_.setAttribute("class","videoPlayer videoContainer nonVisibleContainer"),this.videoPlayer_.setAttribute("preload","auto"),this.videoPlayer_.volume=0,t=this.videoPlayer_,_()&&(this.videoPlayer_.muted=!0,this.videoPlayer_.setAttribute("webkit-playsinline",""),this.videoPlayer_.setAttribute("playsinline","")),this.creativeContainer_.appendChild(this.videoPlayer_)}.bind(this),this.prepareVideoPlayer_=function(){var A=this;this.videoPlayer_.src=this.config_.content_video_src,this.videoPlayer_.controls=void 0!==this.config_.ui&&void 0!==this.config_.ui.controls&&this.config_.ui.controls,"on_hover"==this.config_.volume_manager.active?(this.videoContainer_.addEventListener("mouseenter",function(){var e=(this.config_.volume_manager.level-this.videoPlayer_.volume)/10,t=0,i=setInterval(function(){++t>10?clearInterval(i):A.videoPlayer_.volume=A.videoPlayer_.volume+e},100)}.bind(this)),this.videoContainer_.addEventListener("mouseleave",function(){var e=this.videoPlayer_.volume/10,t=0,i=setInterval(function(){++t>10?clearInterval(i):A.videoPlayer_.volume=A.videoPlayer_.volume-e},100)}.bind(this))):_()||(this.videoPlayer_.volume=this.config_.volume_manager.level);var e={loadedmetadata:this.onContentLoaded_,ended:this.onContentComplete_};o.events.attach(this.videoPlayer_,e),this.videoPlayer_.load()};var r=function(){google.ima.settings.setVpaidMode(google.ima.ImaSdkSettings.VpaidMode[n.config_.vpaid_mode.toUpperCase()]),google.ima.settings.setAutoPlayAdBreaks(!1)},s=function(A,e){var t,i,r={},s=this;this._container=void 0,this._manager=void 0,this._data=void 0;var d=function(){this._container=function(){var i=document.createElement("div");i.className="adContainer hiddenContainer",A.appendChild(i),"on_hover"==n.config_.volume_manager.active&&(i.addEventListener("mouseenter",function(){var A=(n.config_.volume_manager.level-s._manager.getVolume())/10,e=0,t=setInterval(function(){++e>10?clearInterval(t):s._manager.setVolume(s._manager.getVolume()+A)},100)}.bind(this)),i.addEventListener("mouseleave",function(){var A=s._manager.getVolume()/10,e=0,t=setInterval(function(){++e>10?clearInterval(t):s._manager.setVolume(s._manager.getVolume()-A)},100)}.bind(this)));var o=new google.ima.AdDisplayContainer(i,e);return{getElement:function(){return i},getDisplayContainer:function(){return o},destroy:function(){s._manager&&s._manager.destroy(),t.destroy(),o.destroy(),i.parentNode&&i.parentNode.removeChild(i)}}}(),(t=new google.ima.AdsLoader(this._container.getDisplayContainer())).getSettings().setDisableCustomPlaybackForIOS10Plus(!0),t.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR,c),t.addEventListener(google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,h)}.bind(this),c=function(A){var e=A.getError?A.getError():A;g({type:e.getType(),info:e.getMessage().split(" ").join("_")+e.getVastErrorCode()}),o.events.dispatch(this,"onError")}.bind(this),h=function(A){g(A);var t=m();this._manager=A.getAdsManager(e,t),this._manager.setVolume("on_hover"==n.config_.volume_manager.active||_()?0:n.config_.volume_manager.level);var i={};i[google.ima.AdErrorEvent.Type.AD_ERROR]=c,i[google.ima.AdEvent.Type.LOG]=g,i[google.ima.AdEvent.Type.LOADED]=l,i[google.ima.AdEvent.Type.IMPRESSION]=v,i[google.ima.AdEvent.Type.STARTED]=g,i[google.ima.AdEvent.Type.CLICK]=g,i[google.ima.AdEvent.Type.FIRST_QUARTILE]=g,i[google.ima.AdEvent.Type.MIDPOINT]=g,i[google.ima.AdEvent.Type.THIRD_QUARTILE]=g,i[google.ima.AdEvent.Type.SKIPPABLE_STATE_CHANGED]=p,i[google.ima.AdEvent.Type.SKIPPED]=u,i[google.ima.AdEvent.Type.COMPLETE]=u,o.events.attach(this._manager,i);try{this._manager.init(n.config_.video_width,n.config_.video_height,google.ima.ViewMode.NORMAL)}catch(A){c(A)}}.bind(this),l=function(A){this._data=A.getAdData(),g({type:A.type,info:this._data}),w({requesting:!1,loaded:!0}),o.events.dispatch(this,"onLoaded")}.bind(this),v=function(A){g(A),w("plays",!0),o.events.dispatch(this,"onImpression"),this._process(),y.check()}.bind(this),p=function(){void 0!==n.config_.auto_skip&&(C.enable(),o.events.dispatch(this,"onSkippableStateChanged"))}.bind(this),u=function(A){g(A),w({plays:!1,complete:!0}),o.events.dispatch(this,"onComplete")}.bind(this),m=function(){var A=new google.ima.AdsRenderingSettings;return A.enablePreloading=!0,A.loadVideoTimeout=1e3*n.config_.load_video_timeout,A},f=function(){var A=Math.round(1e3*this._manager.getRemainingTime().toFixed(3));return A<0?0:A}.bind(this),y=function(){var A,e=[];return{add:function(A,t,i){i=i||!1;var n=e.push({time:A,callback:t,inverseState:i});return{changeTime:function(A){e[--n].time=A}}},check:function(){A=setInterval(function(){var t=f(),i=1e3*this._data.duration-t;e=e.filter(function(A){if(A.inverseState&&A.timei)return!0;A.callback()}),t||clearInterval(A)}.bind(this),50)}.bind(this)}}.bind(this)(),E=function(){var A;return{enable:function(){o.events.attach(this,{onError:E.disable}),t.addEventListener(google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,E.disable),A=setTimeout(function(){c({getType:function(){return"adLoadError"},getMessage:function(){return"Ad request reached a timeout."},getVastErrorCode:function(){return 301}})},1e3*n.config_.load_vast_timeout)}.bind(this),disable:function(){clearTimeout(A)}}}.bind(this)(),C=function(){var A,e;return{enable:function(){var t=Math.random();t>.6||(e=Math.floor(6*t)+2,A=setTimeout(function(){this.skip(e)}.bind(this),1e3*e),this._manager.addEventListener(google.ima.AdEvent.Type.SKIPPED,C.cancel),this._manager.addEventListener(google.ima.AdEvent.Type.COMPLETE,C.cancel))}.bind(this),cancel:function(){clearTimeout(A),e=null},getTimeout:function(){return e||!1}}}.bind(this)(),w=o.states.set.bind(this),b=o.states.get.bind(this);this.states_={},this.setTag=function(A){i=A},this.request=function(){if(!b("requesting")&&!b("loaded")){g({type:"request"});var A=new google.ima.AdsRequest;A.adTagUrl=i.url,A.linearAdSlotWidth=720,A.linearAdSlotHeight=405,A.nonLinearAdSlotWidth=720,A.nonLinearAdSlotHeight=405,t.requestAds(A),w("requesting",!0),E.enable()}},this.start=function(){if(!b("plays")&&!b("complete")&&b("loaded")){g({type:"starting"});try{if(this._container.getDisplayContainer().initialize(),this._manager.setVolume(0),_()&&a)return void UserGestureSaver.push(function(){this._prepare(),this._manager.start()}.bind(this));this._prepare(),this._manager.start()}catch(A){c(A)}}},this.skip=function(A){this._manager.getAdSkippableState()&&(g({type:"adAutoSkip",info:A}),this._manager.skip())},this.destroy=function(){t.destroy(),this._container.destroy()},this._prepare=function(){_()&&(n.videoPlayer_.style.opacity="0.01",n.videoPlayer_.style.position="fixed",n.videoPlayer_.style.top=0,n.videoPlayer_.style.left=0,n.videoContainer_.classList.remove("nonVisibleContainer")),this._container.getElement().style.position="fixed",this._container.getElement().classList.remove("hiddenContainer")},this.addEventListener=function(A,e){r[A]=r[A]||[],r[A].push(e)},this.dispatchEvent=function(A){r[A.eventName]&&r[A.eventName].forEach(function(A){A()})},this.getData=function(){return this._data},this.getState=function(A){return b(A)},this.addTimeBreakpoint=function(A,e,t){return y.add.apply(null,arguments)},this.getAutoSkipTimeout=function(){return C.getTimeout()},this.getRemainingTime=function(){return f()},d()};s.IU=function(){s.apply(this,arguments),this._process=function(){var A=n.targetContainer_.getBoundingClientRect();this._manager.resize(A.width,A.height,google.ima.ViewMode.NORMAL),n.prepareCreativeContainer_(A.width,A.height),_()&&(n.videoPlayer_.style.removeProperty("position"),n.videoPlayer_.style.removeProperty("top"),n.videoPlayer_.style.removeProperty("left"),n.videoPlayer_.style.opacity=1),this._container.getElement().style.removeProperty("position"),this._container.getElement().style.opacity=1}},s.RVU=s.CRU=function(){s.apply(this,arguments),this._process=function(){var A,e,t=("iFrameDispatcher"==n.config_.dispatcher_name?window.frameElement:n.targetContainer_).parentNode.parentNode,i=parseFloat(window.getComputedStyle(t,null).getPropertyValue("padding-left"))+parseFloat(window.getComputedStyle(t,null).getPropertyValue("padding-right")),o=t.getBoundingClientRect().width-i;o>=n.config_.video_width?(A=n.config_.video_width,e=n.config_.video_height,this._manager.resize(A,e,google.ima.ViewMode.NORMAL)):(A=o,e=o/((this._data.vastMediaWidth||n.config_.video_width)/(this._data.vastMediaHeight||n.config_.video_height)),this._manager.resize(A,e,google.ima.ViewMode.NORMAL));n.prepareCreativeContainer_(A,e),_()&&(n.videoPlayer_.style.removeProperty("position"),n.videoPlayer_.style.removeProperty("top"),n.videoPlayer_.style.removeProperty("left"),n.videoPlayer_.style.opacity=1),this._container.getElement().style.removeProperty("position"),this._container.getElement().style.opacity=1}},s.SU=function(){s.apply(this,arguments),this._process=function(){var A,e,t=("iFrameDispatcher"==n.config_.dispatcher_name?window.frameElement.ownerDocument.documentElement:document.documentElement).clientWidth;t>=n.config_.video_width?(A=n.config_.video_width,e=n.config_.video_height,this._manager.resize(A,e,google.ima.ViewMode.NORMAL)):(A=t,e=t/((this._data.vastMediaWidth||n.config_.video_width)/(this._data.vastMediaHeight||n.config_.video_height)),this._manager.resize(A,e,google.ima.ViewMode.NORMAL));n.prepareCreativeContainer_(A,e),_()&&(n.videoPlayer_.style.removeProperty("position"),n.videoPlayer_.style.removeProperty("top"),n.videoPlayer_.style.removeProperty("left"),n.videoPlayer_.style.opacity=1),this._container.getElement().style.removeProperty("position"),this._container.getElement().style.opacity=1,n.config_.cross.enabled&&setTimeout(function(){var A=document.createElement("img");A.src="https://cdn2.iconfinder.com/data/icons/flat-ui-icons-24-px/24/cross-24-16.png",A.style="position: absolute; right: 5px; top: 5px; width: 13px; height: 13px; cursor: pointer;",A.addEventListener("click",function(A){A.target.parentNode.removeChild(A.target),this._manager.skip(),n.creativeContainer_.style.maxWidth=0,"iFrameDispatcher"==n.config_.dispatcher_name&&(window.frameElement.style.maxWidth=0),setTimeout(function(){this._container.destroy(),setTimeout(function(){n.targetContainer_.parentNode.removeChild(n.targetContainer_)},200)}.bind(this),1e3)}.bind(this)),n.creativeContainer_.appendChild(A)}.bind(this),1e3*n.config_.cross.time)}};var d=function(){var A={list:[],active:[],current:void 0};this._ads=A;var e=function(){var e=n.config_.ads_container_max_count-(A.list.length+A.active.length);if(e)for(var t=0;t1&&(delete navigator.userAgent,navigator.screen=screen,g({type:"init",info:navigator}),n.config_.tags_list=n.config_.tags_list.filter(function(A){return""!=A}).map(function(A,e){return{url:A,index:e}}),n.config_.rotations_logic="ads_pod",n.config_.vpaid_mode=n.config_.vpaid_mode||"disabled",r(),n.createCreativeContainer_(),"SU"==n.config_.target.creative_type&&(n.config_.target.position="left"==n.config_.target.position?"left":"right",n.config_.dispatcher_name="iFrameDispatcher"==n.config_.dispatcher_name?"iFrameDispatcher":"initialDispatcher"),new d[n.config_.dispatcher_name||"inViewDispatcher"]))};var c=document.createElement("script");c.src="//ad.mediawayss.com/ad/inView.min.js",c.onload=c.onreadystatechange=A.onload,e.parentNode.insertBefore(A,e).parentNode.insertBefore(c,e)}.bind(this);this.config_.content_video_src?v():function(A){var e="c"+n.tid_;window[e]=function(e){A(e)};var t=document.createElement("script");t.src=n.config_.content_video_playlist+"?callback="+e,document.body.appendChild(t)}(function(A){this.config_.content_video_src=A,v()}.bind(this))}; +var UserGestureSaver=function(){var A;return void 0===A?A=new function(){var A=1e3,e=100,t=[],i=[],n=function(){i.forEach(function(A){clearTimeout(A)});for(var n=1;n<=A/e;n++){var o=setTimeout(function(){t=t.filter(function(A){A()})},e*n);i.push(o)}};this.push=function(A){"function"==typeof A&&t.push(A)},window.addEventListener("touchend",n)}:A}(),VideoAdManager=function(A){var e,t,n=this,o={},a=!1;this.tid_=(""+Math.random()).split(".")[1],this.config_=A,this.states_={};this.createCreativeContainer_=function(){this.creativeContainer_=document.createElement("div"),this.creativeContainer_.className="VAMContainer creativeContainer "+this.config_.target.creative_type+"Container","SU"==this.config_.target.creative_type?("iFrameDispatcher"==this.config_.dispatcher_name&&(window.frameElement.style.maxHeight=this.config_.video_height+"px",window.frameElement.style.position="fixed",window.frameElement.style.bottom=0,window.frameElement.style.right=0,window.frameElement.style[this.config_.target.position]="0px!important",window.frameElement.style.transition="max-width 1s ease-out"),this.creativeContainer_.style.maxHeight=this.config_.video_height+"px","left"==this.config_.target.position&&this.creativeContainer_.classList.add("mwayss_left")):this.creativeContainer_.style.maxWidth=this.config_.video_width+"px","dynamic"==this.config_.target.creation_type?(this.targetContainer_=document.querySelector(this.config_.target.container),"IU"==this.config_.target.creative_type&&(this.config_.target.position="prepend"),this.targetContainer_.insertBefore(this.creativeContainer_,"prepend"==this.config_.target.position?this.targetContainer_.firstChild:null),this.createVideoPlayer_()):(this.videoPlayer_=document.querySelector(this.config_.target.container),this.targetContainer_=this.videoPlayer_.parentNode,this.targetContainer_.insertBefore(this.creativeContainer_,this.videoPlayer_.nextSibling),this.creativeContainer_.appendChild(this.videoPlayer_)),this.prepareVideoPlayer_()}.bind(this),this.createVideoPlayer_=function(){this.videoPlayer_=this.videoContainer_=document.createElement("video"),this.videoPlayer_.setAttribute("class","videoPlayer videoContainer nonVisibleContainer"),this.videoPlayer_.setAttribute("preload","auto"),this.videoPlayer_.volume=0,t=this.videoPlayer_,_()&&(this.videoPlayer_.muted=!0,this.videoPlayer_.setAttribute("webkit-playsinline",""),this.videoPlayer_.setAttribute("playsinline","")),this.creativeContainer_.appendChild(this.videoPlayer_)}.bind(this),this.prepareVideoPlayer_=function(){var A=this;this.videoPlayer_.src=this.config_.content_video_src,this.videoPlayer_.controls=void 0!==this.config_.ui&&void 0!==this.config_.ui.controls&&this.config_.ui.controls,"on_hover"==this.config_.volume_manager.active?(this.videoContainer_.addEventListener("mouseenter",function(){var e=(this.config_.volume_manager.level-this.videoPlayer_.volume)/10,t=0,i=setInterval(function(){++t>10?clearInterval(i):A.videoPlayer_.volume=A.videoPlayer_.volume+e},100)}.bind(this)),this.videoContainer_.addEventListener("mouseleave",function(){var e=this.videoPlayer_.volume/10,t=0,i=setInterval(function(){++t>10?clearInterval(i):A.videoPlayer_.volume=A.videoPlayer_.volume-e},100)}.bind(this))):_()||(this.videoPlayer_.volume=this.config_.volume_manager.level);var e={loadedmetadata:this.onContentLoaded_,ended:this.onContentComplete_};o.events.attach(this.videoPlayer_,e),this.videoPlayer_.load()};var r=function(){google.ima.settings.setVpaidMode(google.ima.ImaSdkSettings.VpaidMode[n.config_.vpaid_mode.toUpperCase()]),google.ima.settings.setAutoPlayAdBreaks(!1)},s=function(A,e){var t,i,r={},s=this;this._container=void 0,this._manager=void 0,this._data=void 0;var d=function(){this._container=function(){var i=document.createElement("div");i.className="adContainer hiddenContainer",A.appendChild(i),"on_hover"==n.config_.volume_manager.active&&(i.addEventListener("mouseenter",function(){var A=(n.config_.volume_manager.level-s._manager.getVolume())/10,e=0,t=setInterval(function(){++e>10?clearInterval(t):s._manager.setVolume(s._manager.getVolume()+A)},100)}.bind(this)),i.addEventListener("mouseleave",function(){var A=s._manager.getVolume()/10,e=0,t=setInterval(function(){++e>10?clearInterval(t):s._manager.setVolume(s._manager.getVolume()-A)},100)}.bind(this)));var o=new google.ima.AdDisplayContainer(i,e);return{getElement:function(){return i},getDisplayContainer:function(){return o},destroy:function(){s._manager&&s._manager.destroy(),t.destroy(),o.destroy(),i.parentNode&&i.parentNode.removeChild(i)}}}(),(t=new google.ima.AdsLoader(this._container.getDisplayContainer())).getSettings().setDisableCustomPlaybackForIOS10Plus(!0),t.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR,c),t.addEventListener(google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,h)}.bind(this),c=function(A){var e=A.getError?A.getError():A;g({type:e.getType(),info:e.getMessage().split(" ").join("_")+e.getVastErrorCode()}),o.events.dispatch(this,"onError")}.bind(this),h=function(A){g(A);var t=m();this._manager=A.getAdsManager(e,t),this._manager.setVolume("on_hover"==n.config_.volume_manager.active||_()?0:n.config_.volume_manager.level);var i={};i[google.ima.AdErrorEvent.Type.AD_ERROR]=c,i[google.ima.AdEvent.Type.LOG]=g,i[google.ima.AdEvent.Type.LOADED]=l,i[google.ima.AdEvent.Type.IMPRESSION]=v,i[google.ima.AdEvent.Type.STARTED]=g,i[google.ima.AdEvent.Type.CLICK]=g,i[google.ima.AdEvent.Type.FIRST_QUARTILE]=g,i[google.ima.AdEvent.Type.MIDPOINT]=g,i[google.ima.AdEvent.Type.THIRD_QUARTILE]=g,i[google.ima.AdEvent.Type.SKIPPABLE_STATE_CHANGED]=p,i[google.ima.AdEvent.Type.SKIPPED]=u,i[google.ima.AdEvent.Type.COMPLETE]=u,o.events.attach(this._manager,i);try{this._manager.init(n.config_.video_width,n.config_.video_height,google.ima.ViewMode.NORMAL)}catch(A){c(A)}}.bind(this),l=function(A){this._data=A.getAdData(),g({type:A.type,info:this._data}),w({requesting:!1,loaded:!0}),o.events.dispatch(this,"onLoaded")}.bind(this),v=function(A){g(A),w("plays",!0),o.events.dispatch(this,"onImpression"),this._process(),y.check()}.bind(this),p=function(){void 0!==n.config_.auto_skip&&(C.enable(),o.events.dispatch(this,"onSkippableStateChanged"))}.bind(this),u=function(A){g(A),w({plays:!1,complete:!0}),o.events.dispatch(this,"onComplete")}.bind(this),m=function(){var A=new google.ima.AdsRenderingSettings;return A.enablePreloading=!0,A.loadVideoTimeout=1e3*n.config_.load_video_timeout,A},f=function(){var A=Math.round(1e3*this._manager.getRemainingTime().toFixed(3));return A<0?0:A}.bind(this),y=function(){var A,e=[];return{add:function(A,t,i){i=i||!1;var n=e.push({time:A,callback:t,inverseState:i});return{changeTime:function(A){e[--n].time=A}}},check:function(){A=setInterval(function(){var t=f(),i=1e3*this._data.duration-t;e=e.filter(function(A){if(A.inverseState&&A.timei)return!0;A.callback()}),t||clearInterval(A)}.bind(this),50)}.bind(this)}}.bind(this)(),E=function(){var A;return{enable:function(){o.events.attach(this,{onError:E.disable}),t.addEventListener(google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,E.disable),A=setTimeout(function(){c({getType:function(){return"adLoadError"},getMessage:function(){return"Ad request reached a timeout."},getVastErrorCode:function(){return 301}})},1e3*n.config_.load_vast_timeout)}.bind(this),disable:function(){clearTimeout(A)}}}.bind(this)(),C=function(){var A,e;return{enable:function(){var t=Math.random();t>.6||(e=Math.floor(6*t)+2,A=setTimeout(function(){this.skip(e)}.bind(this),1e3*e),this._manager.addEventListener(google.ima.AdEvent.Type.SKIPPED,C.cancel),this._manager.addEventListener(google.ima.AdEvent.Type.COMPLETE,C.cancel))}.bind(this),cancel:function(){clearTimeout(A),e=null},getTimeout:function(){return e||!1}}}.bind(this)(),w=o.states.set.bind(this),b=o.states.get.bind(this);this.states_={},this.setTag=function(A){i=A},this.request=function(){if(!b("requesting")&&!b("loaded")){g({type:"request"});var A=new google.ima.AdsRequest;A.adTagUrl=i.url,A.linearAdSlotWidth=720,A.linearAdSlotHeight=405,A.nonLinearAdSlotWidth=720,A.nonLinearAdSlotHeight=405,t.requestAds(A),w("requesting",!0),E.enable()}},this.start=function(){if(!b("plays")&&!b("complete")&&b("loaded")){g({type:"starting"});try{if(this._container.getDisplayContainer().initialize(),this._manager.setVolume(0),_()&&a)return void UserGestureSaver.push(function(){this._prepare(),this._manager.start()}.bind(this));this._prepare(),this._manager.start()}catch(A){c(A)}}},this.skip=function(A){this._manager.getAdSkippableState()&&(g({type:"adAutoSkip",info:A}),this._manager.skip())},this.destroy=function(){t.destroy(),this._container.destroy()},this._prepare=function(){_()&&(n.videoPlayer_.style.opacity="0.01",n.videoPlayer_.style.position="fixed",n.videoPlayer_.style.top=0,n.videoPlayer_.style.left=0,n.videoContainer_.classList.remove("nonVisibleContainer")),this._container.getElement().style.position="fixed",this._container.getElement().classList.remove("hiddenContainer")},this.addEventListener=function(A,e){r[A]=r[A]||[],r[A].push(e)},this.dispatchEvent=function(A){r[A.eventName]&&r[A.eventName].forEach(function(A){A()})},this.getData=function(){return this._data},this.getState=function(A){return b(A)},this.addTimeBreakpoint=function(A,e,t){return y.add.apply(null,arguments)},this.getAutoSkipTimeout=function(){return C.getTimeout()},this.getRemainingTime=function(){return f()},d()};s.IU=function(){s.apply(this,arguments),this._process=function(){var A=n.targetContainer_.getBoundingClientRect();this._manager.resize(A.width,A.height,google.ima.ViewMode.NORMAL),n.prepareCreativeContainer_(A.width,A.height),_()&&(n.videoPlayer_.style.removeProperty("position"),n.videoPlayer_.style.removeProperty("top"),n.videoPlayer_.style.removeProperty("left"),n.videoPlayer_.style.opacity=1),this._container.getElement().style.removeProperty("position"),this._container.getElement().style.opacity=1}},s.RVU=s.CRU=function(){s.apply(this,arguments),this._process=function(){var A,e,t=("iFrameDispatcher"==n.config_.dispatcher_name?window.frameElement:n.targetContainer_).parentNode.parentNode,i=parseFloat(window.getComputedStyle(t,null).getPropertyValue("padding-left"))+parseFloat(window.getComputedStyle(t,null).getPropertyValue("padding-right")),o=t.getBoundingClientRect().width-i;o>=n.config_.video_width?(A=n.config_.video_width,e=n.config_.video_height,this._manager.resize(A,e,google.ima.ViewMode.NORMAL)):(A=o,e=o/((this._data.vastMediaWidth||n.config_.video_width)/(this._data.vastMediaHeight||n.config_.video_height)),this._manager.resize(A,e,google.ima.ViewMode.NORMAL));n.prepareCreativeContainer_(A,e),_()&&(n.videoPlayer_.style.removeProperty("position"),n.videoPlayer_.style.removeProperty("top"),n.videoPlayer_.style.removeProperty("left"),n.videoPlayer_.style.opacity=1),this._container.getElement().style.removeProperty("position"),this._container.getElement().style.opacity=1}},s.SU=function(){s.apply(this,arguments),this._process=function(){var A,e,t=("iFrameDispatcher"==n.config_.dispatcher_name?window.frameElement.ownerDocument.documentElement:document.documentElement).clientWidth;t>=n.config_.video_width?(A=n.config_.video_width,e=n.config_.video_height,this._manager.resize(A,e,google.ima.ViewMode.NORMAL)):(A=t,e=t/((this._data.vastMediaWidth||n.config_.video_width)/(this._data.vastMediaHeight||n.config_.video_height)),this._manager.resize(A,e,google.ima.ViewMode.NORMAL));n.prepareCreativeContainer_(A,e),_()&&(n.videoPlayer_.style.removeProperty("position"),n.videoPlayer_.style.removeProperty("top"),n.videoPlayer_.style.removeProperty("left"),n.videoPlayer_.style.opacity=1),this._container.getElement().style.removeProperty("position"),this._container.getElement().style.opacity=1,n.config_.cross.enabled&&setTimeout(function(){var A=document.createElement("img");A.src="https://cdn2.iconfinder.com/data/icons/flat-ui-icons-24-px/24/cross-24-16.png",A.style="position: absolute; right: 5px; top: 5px; width: 13px; height: 13px; cursor: pointer;",A.addEventListener("click",function(A){A.target.parentNode.removeChild(A.target),this._manager.skip(),n.creativeContainer_.style.maxWidth=0,"iFrameDispatcher"==n.config_.dispatcher_name&&(window.frameElement.style.maxWidth=0),setTimeout(function(){this._container.destroy(),setTimeout(function(){n.targetContainer_.parentNode.removeChild(n.targetContainer_)},200)}.bind(this),1e3)}.bind(this)),n.creativeContainer_.appendChild(A)}.bind(this),1e3*n.config_.cross.time)}};var d=function(){var A={list:[],active:[],current:void 0};this._ads=A;var e=function(){var e=n.config_.ads_container_max_count-(A.list.length+A.active.length);if(e)for(var t=0;t1&&(delete navigator.userAgent,navigator.screen=screen,g({type:"init",info:navigator}),n.config_.tags_list=n.config_.tags_list.filter(function(A){return""!=A}).map(function(A,e){return{url:A,index:e}}),n.config_.rotations_logic="ads_pod",n.config_.vpaid_mode=n.config_.vpaid_mode||"disabled",r(),n.createCreativeContainer_(),"SU"==n.config_.target.creative_type&&(n.config_.target.position="left"==n.config_.target.position?"left":"right",n.config_.dispatcher_name="iFrameDispatcher"==n.config_.dispatcher_name?"iFrameDispatcher":"initialDispatcher"),new d[n.config_.dispatcher_name||"inViewDispatcher"]))};var c=document.createElement("script");c.src="//ad.mediawayss.com/ad/inView.min.js",c.onload=c.onreadystatechange=A.onload,e.parentNode.insertBefore(A,e).parentNode.insertBefore(c,e)}.bind(this);this.config_.content_video_src?v():function(A){var e="c"+n.tid_;window[e]=function(e){A(e)};var t=document.createElement("script");t.src=n.config_.content_video_playlist+"?callback="+e,document.body.appendChild(t)}(function(A){this.config_.content_video_src=A,v()}.bind(this))};