origin33/app/html/js/akamai-viewer.js

4 lines
88 KiB
JavaScript
Raw Permalink Normal View History

2024-03-19 12:48:13 +00:00
/*! Copyright 2019, Akamai Technologies, Inc. All Rights Reserved. akamai-viewer-0.7.2 */
!function(a){var b=Date.now||function(){return+new Date},c={},d=1;a.core?core.effect||(core.effect={}):a.core={effect:{}},core.effect.Animate={requestAnimationFrame:function(){var b=a.requestAnimationFrame||a.webkitRequestAnimationFrame||a.mozRequestAnimationFrame||a.oRequestAnimationFrame,c=!!b;if(b&&!/requestAnimationFrame\(\)\s*\{\s*\[native code\]\s*\}/i.test(b.toString())&&(c=!1),c)return function(a,c){b(a,c)};var d={},e=0,f=1,g=null,h=+new Date;return function(a,b){var c=f++;return d[c]=a,e++,null===g&&(g=setInterval(function(){var a=+new Date,b=d;d={},e=0;for(var c in b)b.hasOwnProperty(c)&&(b[c](a),h=a);a-h>2500&&(clearInterval(g),g=null)},1e3/60)),c}}(),stop:function(a){var b=null!=c[a];return b&&(c[a]=null),b},isRunning:function(a){return null!=c[a]},start:function(a,e,f,g,h,i){var j=b(),k=j,l=0,m=0,n=d++;if(i||(i=document.body),n%20==0){var o={};for(var p in c)o[p]=!0;c=o}var q=function(d){var o=!0!==d,p=b();if(!c[n]||e&&!e(n))return c[n]=null,void(f&&f(60-m/((p-j)/1e3),n,!1));if(o)for(var r=Math.round((p-k)/(1e3/60))-1,s=0;s<Math.min(r,4);s++)q(!0),m++;g&&(l=(p-j)/g)>1&&(l=1);var t=h?h(l):l;!1!==a(t,p,o)&&1!==l||!o?o&&(k=p,core.effect.Animate.requestAnimationFrame(q,i)):(c[n]=null,f&&f(60-m/((p-j)/1e3),n,1===l||null==g))};return c[n]=!0,core.effect.Animate.requestAnimationFrame(q,i),n}}}(this);var Scroller;!function(){Scroller=function(a,b){this.__callback=a,this.options={scrollingX:!0,scrollingY:!0,animating:!0,animationDuration:250,bouncing:!0,locking:!0,paging:!1,snapping:!1,zooming:!1,minZoom:.5,maxZoom:3};for(var c in b)this.options[c]=b[c]};var a=function(a){return Math.pow(a-1,3)+1},b=function(a){return(a/=.5)<1?.5*Math.pow(a,3):.5*(Math.pow(a-2,3)+2)},c={__isSingleTouch:!1,__isTracking:!1,__isGesturing:!1,__isDragging:!1,__isDecelerating:!1,__isAnimating:!1,__clientLeft:0,__clientTop:0,__clientWidth:0,__clientHeight:0,__contentWidth:0,__contentHeight:0,__snapWidth:100,__snapHeight:100,__refreshHeight:null,__refreshActive:!1,__refreshActivate:null,__refreshDeactivate:null,__refreshStart:null,__zoomLevel:1,__scrollLeft:0,__scrollTop:0,__maxScrollLeft:0,__maxScrollTop:0,__scheduledLeft:0,__scheduledTop:0,__scheduledZoom:0,__lastTouchLeft:null,__lastTouchTop:null,__lastTouchMove:null,__positions:null,__minDecelerationScrollLeft:null,__minDecelerationScrollTop:null,__maxDecelerationScrollLeft:null,__maxDecelerationScrollTop:null,__decelerationVelocityX:null,__decelerationVelocityY:null,setDimensions:function(a,b,c,d){var e=this;a&&(e.__clientWidth=a),b&&(e.__clientHeight=b),c&&(e.__contentWidth=c),d&&(e.__contentHeight=d),e.__computeScrollMax(),e.scrollTo(e.__scrollLeft,e.__scrollTop,!0)},setPosition:function(a,b){var c=this;c.__clientLeft=a||0,c.__clientTop=b||0},setSnapSize:function(a,b){var c=this;c.__snapWidth=a,c.__snapHeight=b},activatePullToRefresh:function(a,b,c,d){var e=this;e.__refreshHeight=a,e.__refreshActivate=b,e.__refreshDeactivate=c,e.__refreshStart=d},finishPullToRefresh:function(){var a=this;a.__refreshActive=!1,a.__refreshDeactivate&&a.__refreshDeactivate(),a.scrollTo(a.__scrollLeft,a.__scrollTop,!0)},getValues:function(){var a=this;return{left:a.__scrollLeft,top:a.__scrollTop,zoom:a.__zoomLevel}},getScrollMax:function(){var a=this;return{left:a.__maxScrollLeft,top:a.__maxScrollTop}},zoomTo:function(a,b,c,d){var e=this;if(!e.options.zooming)throw new Error("Zooming is not enabled!");e.__isDecelerating&&(core.effect.Animate.stop(e.__isDecelerating),e.__isDecelerating=!1);var f=e.__zoomLevel;null==c&&(c=e.__clientWidth/2),null==d&&(d=e.__clientHeight/2),a=Math.max(Math.min(a,e.options.maxZoom),e.options.minZoom),e.__computeScrollMax(a);var g=(c+e.__scrollLeft)*a/f-c,h=(d+e.__scrollTop)*a/f-d;g>e.__maxScrollLeft?g=e.__maxScrollLeft:g<0&&(g=0),h>e.__maxScrollTop?h=e.__maxScrollTop:h<0&&(h=0),e.__publish(g,h,a,b)},zoomBy:function(a,b,c,d){var e=this;e.zoomTo(e.__zoomLevel*a,b,c,d)},scrollTo:function(a,b,c,d){var e=this;if(e.__isDecelerating&&(core.effect.Animate.stop(e.__isDecelerating),e.__isDecelerating=!1),null!=d&&d!==e.__zoomLevel){if(!e.options.zooming)throw new Error("Zooming is not e
this.$images.each(function(a,c){b(c).height()>0?this.imageLoaded(a,c):b(c).bind("load error",function(b){this.imageLoaded(a,b.target,b)}.bind(this))}.bind(this))},e.prototype.imageLoaded=function(a,b,c){var d=!1;this.markImageLoaded(b),this.$element.find("img")[0]!=b||c&&"error"===c.type||this.options.autoplay&&this.options.autoplay.enabled||(this.goto(0),this.$element.trigger("tau.init"),d=!0),++this.loadedCount>=this.frames-1&&(this.hideLoading(),d||(this.$element.trigger("tau.init"),this.initialized=!0))},e.prototype.markImageLoaded=function(a){a.tauImageLoaded=!0},e.prototype.bind=function(){this.$element.bind("mousedown touchstart",this.track.bind(this))},e.prototype.autoRotate=function(a){this.autoInterval||(this.$element.addClass("spinning"),this.change(a?-1:1),this.autoInterval=setInterval(function(){this.change(a?-1:1)}.bind(this),this.autoRotateDelay()*this.stepSize),this.$element.trigger("tau.auto-rotate-start"))},e.prototype.autoRotateDelay=function(){return(this.options.interval||e.autoRotateTraversalTime)/this.frames},e.prototype.stopAutoRotate=function(){clearInterval(this.autoInterval),clearInterval(this.autostartTimeout),this.$element.removeClass("spinning"),this.autoInterval=void 0,this.$element.trigger("tau.auto-rotate-stop")},e.prototype.track=function(a){var d;if(!b(a.target).closest(".tau-controls").length&&("mousedown"===a.type&&a.preventDefault(),"touchstart"===a.type?this.$element.trigger("tau.touch-tracking-start"):this.$element.trigger("tau.mouse-tracking-start"),!this.tracking)){c.one("mouseup",this.release.bind(this)),c.one("touchend",this.release.bind(this)),this.tracking=!0,this.path.reset(),this.cursorGrab();var e=this.$element[0].clientWidth/this.frames;this.rotateThreshold=e/(this.options.sensitivity||1),d=this.getPoint(a),this.downX=d.x,this.downY=d.y,this.downIndex=this.index,c.bind("mousemove",this.mouseMoveBinding),c.bind("touchmove",this.touchMoveBinding)}},e.prototype.slow=function(){if(!this.path.isSufficient())return void this.clearSlowInterval();this.rotate({x:this.path.last().x+this.velocity,y:this.path.last().y}),this.velocity>0?(this.velocity=this.velocity-this.decelVal(),this.velocity<=0&&this.clearSlowInterval()):(this.velocity=this.velocity+this.decelVal(),this.velocity>=0&&this.clearSlowInterval())},e.prototype.decelVal=function(){return this.decelTimeStep()/8},e.prototype.clearSlowInterval=function(){clearInterval(this.slowInterval),this.velocity=0,this.slowInterval=void 0},e.prototype.decel=function(){var a,b;this.path.isSufficient()&&(a=this.path.velocity(this.decelTimeStep()),b=a>0?1:a<0?-1:0,Math.abs(a)>e.maxVelocity&&(a=b*e.maxVelocity),this.velocity=a,this.slowInterval=setInterval(this.slow.bind(this),this.decelTimeStep()))},e.prototype.decelTimeStep=function(){return this.autoRotateDelay()/2},e.prototype.release=function(a){b(a.target).closest(".tau-controls").length||this.tracking&&("touchend"===a.type?this.$element.trigger("tau.touch-tracking-stop"):this.$element.trigger("tau.mouse-tracking-stop"),this.decel(),this.cursorRelease(),c.unbind("mousemove",this.mouseMoveBinding),c.unbind("touchmove",this.touchMoveBinding),this.tracking=!1)},e.prototype.cursorGrab=function(){c.addClass("grabbing")},e.prototype.cursorRelease=function(){c.removeClass("grabbing")},e.prototype.showLoading=function(){this.$loading.attr("style","display: block")},e.prototype.hideLoading=function(){this.$loading.attr("style","display: none")},e.prototype.getPoint=function(a){var b=a.touches||a.originalEvent&&a.originalEvent.touches;return b?{x:b[0].pageX,y:b[0].pageY}:{x:a.pageX||a.clientX,y:a.pageY||a.clientY}},e.prototype.rotateEvent=function(a){this.rotate(this.getPoint(a))&&a.preventDefault()},e.prototype.rotate=function(a){var b,c;if(b=a.x-this.downX,c=a.y-this.downY,Math.abs(c)/Math.abs(b)>=e.verticalScrollRatio)return!1;if(this.path.record(a),Math.abs(b)>=this.rotateThreshold){this.stopAutoRotate();var d;return d=this.options.reverse?this.downIndex+Math.round(b/this.rotateThreshold):this.downIndex-Math.round(b/this.rotateThreshold),this.goto(d),!0}}}(this,jQuery),function(a,b){var c=
;var c="undefined"==typeof exports?window:exports;c.Akamai=c.Akamai||{},c.Akamai.MagnifierImplScroller=b}(),function(a,b){var c=Akamai.Util.component("Magnifier",function(a,b){this._options.disabled=!this._options.enabled,this._options.mode===c.MODE_ANIMATED_ZOOM?this._impl=new Akamai.MagnifierImplScroller(a,b):this._impl=new Akamai.MagnifierImplEnlarge(a,b)});c.prototype._updateOptions=function(a){a||(this._options=this._originalOptions),this._options=Akamai.Util.extend(!0,this._options,a),this._options.disabled=!this._options.enabled,Akamai.Util.setDataAttrOptions(this._$el,c.defaultOptions,this._options,"Magnifier"),this._impl.updateOptions(this._options)},c._componentEventMapping={"enlarge.after-zoom-in":"in","enlarge.after-zoom-out":"out","scroller.after-zoom-in":"in","scroller.after-zoom-out":"out"},c.MODE_HOVER_ZOOM="hoverzoom",c.MODE_ANIMATED_ZOOM="animatedzoom",c.defaultOptions={mode:c.MODE_HOVER_ZOOM,button:!0,enabled:!0,magnification:3,image:Akamai.Image.defaultConfig,delay:300,buttonText:"Toggle Image Magnification",flyout:{width:200,height:200},hoverZoomWithoutClick:!0,placement:"inline",incrementalZoomFactor:3,animateZoom:!0,animationDuration:250,zoomInBtnText:"Zoom In",zoomOutBtnText:"Zoom Out"},Akamai.Sourceable.extendStatic(c),c.render=function(a,b){var d=Akamai.Util.options(c.defaultOptions,b),e=c._dataAttr,f=c._fallbackSrc(a.url,d.image),g=c._largestSrc(a.url,d.image),h=c._srcset(a.url,d.image),i=d.image.sizes;return(d.mode===c.MODE_ANIMATED_ZOOM?Akamai.MagnifierImplScroller:Akamai.MagnifierImplEnlarge).render(d,e,f,g,h,i)},c.prototype.in=function(){this._impl.zoomIn()},c.prototype.out=function(){this._impl.zoomOut()},c.prototype.isMagnified=function(){return this._impl.isMagnified()},c.prototype.toggle=function(){this._impl.toggleZoom()},a.Akamai=a.Akamai||{},a.Akamai.Magnifier=c}("undefined"==typeof exports?window:exports,this.jQuery),function(a,b){var c=Akamai.Util.component("VideoImpl",function(a,b){throw new Error("Not allowed to instantiate VideoImpl")});c.render=function(a,b){throw new Error("VideoImpl.render not implemented")},a.Akamai=a.Akamai||{},a.Akamai.VideoImpl=c}("undefined"==typeof exports?window:exports,this.jQuery),function(a,b){var c=Akamai.Util.component("VideoImplPristine",function(a,b){});c.prototype=Object.create(Akamai.VideoImpl.prototype),c.prototype.constructor=c,c.render=function(a,b){var c=Akamai.Util.options(Akamai.Video.defaultOptions,b),d=a.url,e=a.poster||"",f=a.mime?'type="'+a.mime+'"':"",g=[c.loop?"loop":"",c.autoplay?"autoplay":"",c.controls?"controls":"",c.muted?"muted":"","playsinline"];return Akamai.Util.trim("\n\t\t\t<div "+Akamai.Video._dataAttr+">\n\t\t\t\t<video "+g.join(" ")+' poster="'+e+'" preload="metadata">\n\t\t\t\t\t<source src="'+d+'" '+f+" />\n\t\t\t\t</video>\n\t\t\t</div>\n\t\t")},a.Akamai=a.Akamai||{},a.Akamai.VideoImplPristine=c}("undefined"==typeof exports?window:exports,this.jQuery),function(a,b){var c=Akamai.Util.component("VideoImplIm",function(a,b){var d=Akamai.Util.options(Akamai.Video.defaultOptions,b);c._validateOptions(d)});c.prototype=Object.create(Akamai.VideoImpl.prototype),c.prototype.constructor=c,c._validateOptions=function(a){if(!Array.isArray(a.sizes)||3!==a.sizes.length)throw new Error("Akamai.Video sizes must have three entries");if(a.sizes.some(function(a){return isNaN(a)}))throw new Error("Akamai.VideoImplIm all sizes must be numbers")},c.render=function(a,b){var d=Akamai.Util.options(Akamai.Video.defaultOptions,b);c._validateOptions(d);var e,f=a.url,g=a.poster||"",h=window.innerWidth;e=h<992?d.sizes[0]:h<1200?d.sizes[1]:d.sizes[2];var i=[d.loop?"loop":"",d.autoplay?"autoplay":"",d.controls?"controls":"",d.muted?"muted":"","playsinline"],j=-1===f.indexOf("?")?"?":"&";return Akamai.Util.trim("\n\t\t\t<div "+Akamai.Video._dataAttr+">\n\t\t\t\t<video "+i.join(" ")+' poster="'+g+'" preload="metadata">\n\t\t\t\t\t<source src="'+f+j+"imformat=vp9&imwidth="+e+'" type="video/webm" />\n\t\t\t\t\t<source src="'+f+j+"imformat=h265&imwidth="+e+'" type="video/mp4; codecs=hevc" />\n\t\t\t\t\t<source src="'+f+j+"imformat=h264&imwidth="+e+'"