text: "use strict";var MVPlayer=window.MVPlayer=window.MVPlayer||{};MVPlayer.Util=function(){var a={};return a.getFromDataSet=function(a,b){return a.getAttribute("data-"+b)},a.getElementsByClassName=function(a,b){if(document.getElementsByClassName)return a.getElementsByClassName(b);if(document.querySelectorAll)return a.querySelectorAll("."+b);for(var c=[],d=a.getElementsByTagName("*"),e=new RegExp("(^|\\s)"+b+"(\\s|$)"),f=0;f<d.length;f++)e.test(d[f].className)&&c.push(d[f]);return c},a.addEventListener=function(a,b,c,d){return window.addEventListener?void a.addEventListener(b,c,d):void a.attachEvent("on"+b,function(b){b=b||window.event,b.preventDefault=b.preventDefault||function(){b.returnValue=!1},b.stopPropagation=b.stopPropagation||function(){b.cancelBubble=!0},c.call(a,b)})},a.innerHeight=function(){return window.innerHeight||document.documentElement.clientHeight||0},a}();var MVPlayer=window.MVPlayer=window.MVPlayer||{};MVPlayer.Strip=function(){function a(a,b,d){this.width=a,this.height=b,this.image_url=c.getFromDataSet(d,"url"),this.element=d,this._initStyles(),this._initStripImages()}function b(a,b,d){if("naturalHeight"in new Image)return void d(a.naturalHeight);var e=new Image;c.addEventListener(e,"load",function(){d(e.height)}),e.src=b}var c=MVPlayer.Util;return a.prototype._initStyles=function(){this.element.style.position="absolute"},a.prototype._initStripImages=function(){this.image_element=this.element.getElementsByTagName("img")[0],this.image_element.style.width=this.width+"px"},a.prototype._initFrames=function(){this.frames=[];for(var a=0;a<this.frame_count;a++){var b={top:this.height*a};this.frames.push(b)}this.frame_index=0},a.prototype.activate=function(){this.element.style.display=""},a.prototype.deactivate=function(){this.element.style.display="none",this.reset()},a.prototype.isFinished=function(){return this.frame_index===this.frame_count-1},a.prototype.load=function(a){var d=this;c.addEventListener(this.image_element,"load",function(){b(this,d.image_url,function(b){d.image_element.style.height=b+"px",d.frame_count=b/d.height,d._initFrames(),a()})},!1),this.image_element.src=this.image_url},a.prototype.move=function(){this.frame_index++},a.prototype.show=function(){var a=this.frames[this.frame_index];this.element.style.top=-1*a.top+"px"},a.prototype.reset=function(){return this.frame_index=0,this.show()},a}();var MVPlayer=window.MVPlayer=window.MVPlayer||{};MVPlayer.MultiStrip=function(){function a(a,b,c){this.strips=[];for(var d=0;d<c.length;d++){var e=new MVPlayer.Strip(a,b,c[d]);this.strips.push(e)}this.strip_index=0,this.strip_loaded_count=0,this.strip_already_loading=!1}return a.prototype.getCurrentFrameIndex=function(){for(var a=0,b=0;b<this.strips.length&&!(this.strip_index<b);b++){var c=this.strips[b];a+=this.strip_index===b?c.frame_index+1:c.frame_count}return a},a.prototype.getTotalFrameCount=function(){for(var a=0,b=0;b<this.strips.length;b++)a+=this.strips[b].frame_count;return a},a.prototype.isInit=function(){return 1===this.getCurrentFrameIndex()},a.prototype.isFinished=function(){return this.getCurrentFrameIndex()===this.getTotalFrameCount()},a.prototype.load=function(a){if(this.strip_loaded_count===this.strips.length)return void a(null);if(this.strip_already_loading)return void a("already");this.strip_already_loading=!0;for(var b=this,c=function(){b.strip_loaded_count++,b.strip_loaded_count===b.strips.length&&a(null)},d=0;d<this.strips.length;d++)this.strips[d].load(c)},a.prototype.move=function(){var a=this.strips[this.strip_index];if(a.isFinished()){if(a.deactivate(),this.strip_index===this.strips.length-1)return;return a=this.strips[++this.strip_index],void a.activate()}a.move()},a.prototype.show=function(){var a=this.strips[this.strip_index];a.show()},a.prototype.reset=function(){var a=this.strips[this.strip_index];a.deactivate(),this.strip_index=0;var b=this.strips[this.strip_index];b.activate()},a}();var MVPlayer=window.MVPlayer=window.MVPlayer||{};MVPlayer.Player=function(){function a(a,c){var d=function(c){return b.getFromDataSet(a,c)},e=parseInt(d("frame-width"),10),f=parseInt(d("frame-height"),10);this.movie=new MVPlayer.MultiStrip(e,f,b.getElementsByClassName(a,"strip")),this.dispatcher=new MVPlayer.PlayerEventDispatcher(c,d("did-start-url"),d("did-resume-url"),d("did-complete-url"),d("first-quartile-url"),d("midpoint-url"),d("third-quartile-url"),d("did-pause-url")),this.fps=parseInt(d("fps"),10),this.element=a,this.element.style.width=e+"px",this.element.style.height=f+"px",this.element.style.position="relative",this.element.style.overflow="hidden"}var b=MVPlayer.Util;return a.prototype.load=function(a){this.movie.load(function(b){a(b)})},a.prototype.play=function(){this.timerId||(this.movie.isInit()?this.dispatcher.didStart():this.dispatcher.didResume(),this.timerId=setInterval(function(a){return function(){if(a.movie.isFinished())a.pause(),a.movie.reset(),a.dispatcher.didComplete();else{a.movie.show(),a.movie.move();var b=a.movie.getCurrentFrameIndex(),c=a.movie.getTotalFrameCount();b===Math.floor(c/4)&&a.dispatcher.firstQuartile(),b===Math.floor(c/2)&&a.dispatcher.midpoint(),b===Math.floor(c/4*3)&&a.dispatcher.thirdQuartile()}}}(this),1e3/this.fps))},a.prototype.pause=function(){this.timerId&&(this.movie.isFinished()||this.dispatcher.didPause(),clearInterval(this.timerId),this.timerId=void 0)},a}();var MVPlayer=window.MVPlayer=window.MVPlayer||{};MVPlayer.AppearanceDetector=function(){function a(a,b,c,d,e){this.element=a,this.top_margin=b,this.bottom_margin=c,this.didAppear=d,this.didDisappear=e,this.wasVisible=!1,this.detect()}var b=MVPlayer.Util;return a.prototype._topVisible=function(){var a=this.element.getBoundingClientRect().top;return a+this.top_margin>0},a.prototype._bottomVisible=function(){var a=this.element.getBoundingClientRect().bottom,c=b.innerHeight();return a-this.bottom_margin<c},a.prototype._isVisible=function(){return this._topVisible()&&this._bottomVisible()},a.prototype.detect=function(){var a=this._isVisible();a!==this.wasVisible&&(a&&!this.wasVisible?this.didAppear():this.didDisappear(),this.wasVisible=a)},a}();var MVPlayer=window.MVPlayer=window.MVPlayer||{};MVPlayer.PlayerEventDispatcher=function(){function a(a,b,c,d,e,f,g,h){this.is_debug=a,this.did_start_url=b,this.did_resume_url=c,this.did_complete_url=d,this.first_quartile_url=e,this.midpoint_url=f,this.third_quartile_url=g,this.did_pause_url=h}function b(a){a&&((new Image).src=a)}return a.prototype.log=function(a){this.is_debug&&window.console&&"function"==typeof window.console.log&&console.log(a)},a.prototype.didStart=function(){this.log("didStart"),b(this.did_start_url)},a.prototype.didResume=function(){this.log("didResume"),b(this.did_resume_url)},a.prototype.didComplete=function(){this.log("didComplete"),b(this.did_complete_url)},a.prototype.firstQuartile=function(){this.log("firstQuartile"),b(this.first_quartile_url)},a.prototype.midpoint=function(){this.log("midpoint"),b(this.midpoint_url)},a.prototype.thirdQuartile=function(){this.log("thirdQuartile"),b(this.third_quartile_url)},a.prototype.didPause=function(){this.log("didPause"),b(this.did_pause_url)},a}();var MVPlayer=window.MVPlayer=window.MVPlayer||{};MVPlayer.Controller=function(){function a(a,b){a.load(function(c){g&&!c&&(b&&(b.style.display="none"),a.element.style.display="",a.play())})}function b(b,c){g=!0,a(b,c)}function c(a){g=!1,a.pause()}function d(d,e,g,h,i){!function(a){e.dispatcher.didComplete=function(){return a.call(e.dispatcher),h||i?(e.element.style.display="none",h&&(h.style.display=""),void(i&&(i.style.display=""))):void e.play()}}(e.dispatcher.didComplete),h&&f.addEventListener(h,"click",function(){e.element.style.display="",h&&(h.style.display="none"),i&&(i.style.display="none"),e.play()},!1);var j=new MVPlayer.AppearanceDetector(d,90,90,function(){b(e,g)},function(){c(e)});f.addEventListener(window,"scroll",function(){j.detect()}),a(e,g)}var e={},f=MVPlayer.Util,g=!1,h=!1;return e.run=function(a,b){h=b;var c=f.getElementsByClassName(a,"play-scene")[0];if(c){var e=new MVPlayer.Player(c,h),g=f.getElementsByClassName(a,"load-scene")[0],i=f.getElementsByClassName(a,"replay-scene")[0],j=f.getElementsByClassName(a,"done-scene")[0];d(a,e,g,i,j)}},e}();