/*! * @name easyzoom * @author <> * @modified thursday, november 22nd, 2018 * @version 2.5.2 */ !function(t,e){"use strict";"function"==typeof define&&define.amd?define(["jquery"],function(t){e(t)}):"object"==typeof module&&module.exports?module.exports=t.easyzoom=e(require("jquery")):t.easyzoom=e(t.jquery)}(this,function(i){"use strict";var c,d,l,p,u,f,o={loadingnotice:"loading image",errornotice:"the image could not be loaded",errorduration:2500,linkattribute:"href",preventclicks:!0,beforeshow:i.noop,beforehide:i.noop,onshow:i.noop,onhide:i.noop,onmove:i.noop};function s(t,e){this.$target=i(t),this.opts=i.extend({},o,e,this.$target.data()),void 0===this.isopen&&this._init()}return s.prototype._init=function(){this.$link=this.$target.find("a"),this.$image=this.$target.find("img"),this.$flyout=i('
'),this.$notice=i('
'),this.$target.on({"mousemove.easyzoom touchmove.easyzoom":i.proxy(this._onmove,this),"mouseleave.easyzoom touchend.easyzoom":i.proxy(this._onleave,this),"mouseenter.easyzoom touchstart.easyzoom":i.proxy(this._onenter,this)}),this.opts.preventclicks&&this.$target.on("click.easyzoom",function(t){t.preventdefault()})},s.prototype.show=function(t,e){var o=this;if(!1!==this.opts.beforeshow.call(this)){if(!this.isready)return this._loadimage(this.$link.attr(this.opts.linkattribute),function(){!o.ismouseover&&e||o.show(t)});this.$target.append(this.$flyout);var i=this.$target.outerwidth(),s=this.$target.outerheight(),h=this.$flyout.width(),n=this.$flyout.height(),a=this.$zoom.width(),r=this.$zoom.height();(c=a-h)<0&&(c=0),(d=r-n)<0&&(d=0),l=c/i,p=d/s,this.isopen=!0,this.opts.onshow.call(this),t&&this._move(t)}},s.prototype._onenter=function(t){var e=t.originalevent.touches;this.ismouseover=!0,e&&1!=e.length||(t.preventdefault(),this.show(t,!0))},s.prototype._onmove=function(t){this.isopen&&(t.preventdefault(),this._move(t))},s.prototype._onleave=function(){this.ismouseover=!1,this.isopen&&this.hide()},s.prototype._onload=function(t){t.currenttarget.width&&(this.isready=!0,this.$notice.detach(),this.$flyout.html(this.$zoom),this.$target.removeclass("is-loading").addclass("is-ready"),t.data.call&&t.data())},s.prototype._onerror=function(){var t=this;this.$notice.text(this.opts.errornotice),this.$target.removeclass("is-loading").addclass("is-error"),this.detachnotice=settimeout(function(){t.$notice.detach(),t.detachnotice=null},this.opts.errorduration)},s.prototype._loadimage=function(t,e){var o=new image;this.$target.addclass("is-loading").append(this.$notice.text(this.opts.loadingnotice)),this.$zoom=i(o).on("error",i.proxy(this._onerror,this)).on("load",e,i.proxy(this._onload,this)),o.style.position="absolute",o.src=t},s.prototype._move=function(t){if(0===t.type.indexof("touch")){var e=t.touches||t.originalevent.touches;u=e[0].pagex,f=e[0].pagey}else u=t.pagex||u,f=t.pagey||f;var o=this.$target.offset(),i=f-o.top,s=u-o.left,h=math.ceil(i*p),n=math.ceil(s*l);if(n<0||h<0||c