|
|
|
|
@ -36,7 +36,7 @@ self[keydownAction]();}}},_onGlobalClick=function(e){if(!e){return;}
|
|
|
|
|
if(_moved||_zoomStarted||_mainScrollAnimating||_verticalDragInitiated){e.preventDefault();e.stopPropagation();}},_updatePageScrollOffset=function(){self.setScrollOffset(0,framework.getScrollY());},_unbindAllSwipeAreaPlayPause=function(){for(var i=0;i<NUM_HOLDERS;i++){_unbindSwipeAreaPlayPause(_itemHolders[i].el);}},_unbindSwipeAreaPlayPause=function(containerElement){var childrenVideoElements=containerElement.getElementsByTagName("video");var childrenSwipeAreaElements=containerElement.getElementsByClassName("video__swipearea");if(childrenVideoElements.length!=1||childrenSwipeAreaElements.length!=1){return} |
|
|
|
|
var videoElement=childrenVideoElements[0];var swipeAreaElement=childrenSwipeAreaElements[0];if(swipeAreaElement.play_pause!=undefined){framework.unbind(swipeAreaElement,'click',swipeAreaElement.play_pause);} |
|
|
|
|
if(swipeAreaElement.resize!=undefined){framework.unbind(videoElement,"loadeddata",swipeAreaElement.resize);framework.unbind(videoElement,"canplay",swipeAreaElement.resize);framework.unbind(window,'resize',swipeAreaElement.resize);}},_bindSwipeAreaPlayPause=function(containerElement){var childrenVideoElements=containerElement.getElementsByTagName("video");var childrenSwipeAreaElements=containerElement.getElementsByClassName("video__swipearea");if(childrenVideoElements.length!=1||childrenSwipeAreaElements.length!=1){return;} |
|
|
|
|
var videoElement=childrenVideoElements[0];var swipeAreaElement=childrenSwipeAreaElements[0];swipeAreaElement.play_pause=function(e){if(videoElement.paused){videoElement.play();}else{videoElement.pause();}};swipeAreaElement.resize=function(){if(videoElement.scrollHeight>400){swipeAreaElement.style.height=(videoElement.scrollHeight*0.7)+"px";swipeAreaElement.style.top="calc(35% + 25px)";}else if(videoElement.scrollHeight>150){swipeAreaElement.style.height=videoElement.scrollHeight-70+"px";swipeAreaElement.style.top="calc(50% - 25px)";}else{swipeAreaElement.style.height=0;} |
|
|
|
|
var videoElement=childrenVideoElements[0];var swipeAreaElement=childrenSwipeAreaElements[0];swipeAreaElement.play_pause=function(e){if(videoElement.paused){videoElement.play();}else{videoElement.pause();}};swipeAreaElement.resize=function(){if(videoElement.scrollHeight>400){swipeAreaElement.style.height=(videoElement.scrollHeight*0.7)+"px";}else if(videoElement.scrollHeight>150){swipeAreaElement.style.height=videoElement.scrollHeight-80+"px";}else{swipeAreaElement.style.height=0;} |
|
|
|
|
if(videoElement.scrollWidth>300){swipeAreaElement.style.width=videoElement.scrollWidth-50+"px";}else if(videoElement.scrollWidth>100){swipeAreaElement.style.width=videoElement.scrollWidth-20+"px";}else{swipeAreaElement.style.width=0;}};framework.bind(swipeAreaElement,'click',swipeAreaElement.play_pause);framework.bind(videoElement,'loadeddata',swipeAreaElement.resize);framework.bind(videoElement,'canplay',swipeAreaElement.resize);framework.bind(window,'resize',swipeAreaElement.resize);swipeAreaElement.resize();};var _animations={},_numAnimations=0,_stopAnimation=function(name){if(_animations[name]){if(_animations[name].raf){_cancelAF(_animations[name].raf);} |
|
|
|
|
_numAnimations--;delete _animations[name];}},_registerStartAnimation=function(name){if(_animations[name]){_stopAnimation(name);} |
|
|
|
|
if(!_animations[name]){_numAnimations++;_animations[name]={};}},_stopAllAnimations=function(){for(var prop in _animations){if(_animations.hasOwnProperty(prop)){_stopAnimation(prop);}}},_animateProp=function(name,b,endProp,d,easingFn,onUpdate,onComplete){var startAnimTime=_getCurrentTime(),t;_registerStartAnimation(name);var animloop=function(){if(_animations[name]){t=_getCurrentTime()-startAnimTime;if(t>=d){_stopAnimation(name);onUpdate(endProp);if(onComplete){onComplete();} |
|
|
|
|
|