/*! jQThumb v2.3.6 Copyright (c) 2013-2016 Released under the MIT license. Author : Pak Cheong Version : 2.3.6 Repo : git@github.com:pakcheong/jqthumb.git Demo : http://pakcheong.github.io/jqthumb/ Last Updated : Sunday, April 10th, 2016, 2:42:38 PM Requirements : jQuery >=v1.3.0 or Zepto (with zepto-data plugin) >=v1.0.0 */ !function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof exports?module.exports=a(require("jquery")):a(function(){return"undefined"!=typeof jQuery?jQuery:"undefined"!=typeof Zepto?Zepto:$}())}(function(a){function b(a,b){window.console&&"undefined"!=typeof a&&a&&"undefined"!=typeof b&&b&&(a=a.toLowerCase(),"error"==a?console.error(b):"log"==a?console.log(b):console.error('"'+a+'" is not supported as console type.'))}function c(b){return b=a.trim(b.toString()),"auto"===b.toLowerCase()?b:parseFloat(b)}function d(a,b){var c=a.toString().match(/(-*)+\d+/)[0];return"px"==e(a)?0>a?0:a>b?b:a:"%"==e(a)?0>c?"0%":c>100?"100%":a:void 0}function e(b){var c=b.toString().match(/\d+(.*)/i);if(c)switch(a.trim(c[1])){case"":return"px";case"px":return"px";case"%":return"%"}return""}function f(b,c){a.fn[i].defaults=a.extend({},y,a.fn[i].defaults),this.element=b,this.settings=a.extend({},a.fn[i].defaults,c),this.settings.onDemandEvent=this.settings.onDemandEvent.toLowerCase(),this.settings.threshold=this.settings.threshold.toString().replace(/px/gi,""),this.settings.width=this.settings.width.toString().replace(/px/gi,""),this.settings.height=this.settings.height.toString().replace(/px/gi,""),this.settings.width||(c.width=y.width,this.settings.width=y.width),this.settings.height||(c.height=y.height,this.settings.height=y.height),this.settings.position.y=d(this.settings.position.y,this.settings.width),this.settings.position.x=d(this.settings.position.x,this.settings.height),this.settings.zoom=this.settings.zoom<0?0:this.settings.zoom,"string"==typeof c?"kill"==c.toLowerCase()&&this.kill(this.element):(a(this.element).data(r,this.settings),this.init(this.element,this.settings))}var g=function(){var a=document.createElement("div"),b="Khtml Ms O Moz Webkit".split(" ");b.length;return function(c){if(c in a.style)return!0;c=c.replace(/^[a-z]/,function(a){return a.toUpperCase()});for(var d in b)if(b[d]+c in a.style)return!0;return!1}}();a.fn.outerHeight&&a.fn.outerWidth||("function"!=typeof Array.prototype.forEach&&(Array.prototype.forEach=function(a){for(var b=0;bf.right+d||g.bottomf.bottom+d)},i="jqthumb",j=a(window),k=function(){for(var a=["scroll","resize","scrolltop"],b={},c=0;c").css({width:c(h)+e(h),height:c(j)+e(j),display:"none",position:"relative",overflow:"hidden"}).addClass(f.classname).data(i,i),g=a("
").css({width:"100%",height:"100%","background-image":'url("'+q+'")',"background-repeat":"no-repeat","background-position":c(l)+e(l)+" "+c(m)+e(m),"background-size":"cover"}).appendTo(d),"after"===f.renderPosition.toLowerCase()?d.insertAfter(b.oriImg):d.insertBefore(b.oriImg),d.show(),g.css({width:parseFloat(100*k)+"%",height:parseFloat(100*k)+"%",position:"absolute"}).css({top:function(){var a=d.height(),b=g.height();return"%"==e(m)?"-"+parseFloat((b-a)/a*100/(100/c(m)))+"%":void 0}(),left:function(){var a=d.width(),b=g.width();return"%"==e(l)?"-"+parseFloat((b-a)/a*100/(100/c(l)))+"%":void 0}()}),d.hide(),"function"==typeof b.done&&b.done(d)}function l(b){function d(){var b=0;if(l>m?(h.css({width:"auto","max-height":99999999,"min-height":0,"max-width":99999999,"min-width":0,height:g.height()+"px"}),b=h.height()/h.width(),h.width()p){var d=a("
");d.css({width:parseFloat(c(n.toString())*p)+e(n.toString()),height:parseFloat(c(o.toString())*p)+e(o.toString()),position:"relative",overflow:"hidden"}).appendTo(h.parent()),h.appendTo(d)}h.css({position:"absolute",left:function(){var a=0;return"%"==e(q)?(a=parseFloat((h.width()-h.parent().width())/100*c(q)),0>=a?a+"px":"-"+a+"px"):"px"==e(q)||isNaN(q)===!1?c(q)+"px":void 0}(),top:function(){var a=0;return"%"==e(r)?(a=parseFloat((h.height()-h.parent().height())/100*c(r)),0>=a?a+"px":"-"+a+"px"):"px"==e(r)||isNaN(r)===!1?c(r)+"px":void 0}()})}var g,h,l=b.tmpImgDom.width,m=b.tmpImgDom.height,n="auto"===a.trim(f.width.toString().toLowerCase())?l.toString():f.width,o="auto"===a.trim(f.height.toString().toLowerCase())?m.toString():f.height,p=f.zoom,q=f.position.x,r=f.position.y,s=e(n),t=e(o),u=f.responsive;h=a(b.tmpImgDom),g=a("
"),"after"===f.renderPosition.toLowerCase()?g.insertAfter(b.oriImg):g.insertBefore(b.oriImg),g.append(h).css({position:"relative",overflow:"hidden",width:c(n)+(s?s:"px"),height:c(o)+(t?t:"px")}).data(i,i),d(),!isNaN(u)&&u>0&&(a(b.oriImage).data(v,function(){setTimeout(function(){d()},u)}),j.bind(k.resize,a(b.oriImage).data(v))),g.hide().addClass(f.classname),"function"==typeof b.done&&b.done(g)}f.before.apply(d,[d]);var m=this,n=a(d),q=n.attr(f.source),r=function(a){return"auto"==a?g("backgroundSize")===!1?l:h:"modern"==a?h:"native"==a?l:void b("error",'Invalid method. Only "auto", "modern" and "native" are allowed.')}(f.method.toString().toLowerCase());r?(n.data(p,n.attr("style")),n.data(o,f.renderPosition),n.hide(),f.onDemand===!0?m.demand(d,f,q,r):(n.data(w,new Image),m.lazyload(m,d,f,function(a){m.processImg(d,f,a,r),n.removeData(w)}))):(n.data(s,"error"),m.kill(n))},demand:function(b,d,f,g){var i=this,o=a(b);if("scroll"===d.onDemandEvent){o.wrap("
");var p=o.parent();p.css({width:d.width?c(d.width)+e(d.width):o.width()+"px",height:d.height?c(d.height)+e(d.height):o.height()+"px"}),o.data(u,function(){h(p,d.threshold)&&(j.unbind(l,o.data(u)),o.removeData(u),o.unwrap(),o.data(w,new Image),i.lazyload(i,b,d,function(a){i.processImg(b,d,a,g),o.removeData(w)}))}),j.bind(l,o.data(u)).triggerHandler(k.scroll)}else if("click"===d.onDemandEvent||"mouseenter"===d.onDemandEvent){var r=o.parent(),s="click"===d.onDemandEvent?m:n;o.data(t,function(){r.unbind(s,o.data(t)),o.removeData(t),o.data(w,new Image),i.lazyload(i,b,d,function(a){i.processImg(b,d,a,g),o.removeData(w)}),o.data(q,!0)}),r.bind(s,o.data(t))}},updateGlobal:function(b,c,d){b.global.outputElems.push(a(c)[0]),b.global.elemCounter++,x.outputElems.push(a(c)[0]),b.global.elemCounter==b.global.inputElems.length&&d.done.apply(b,[b.global.outputElems])}},a.fn[i]=function(c){var d={},e={elemCounter:0,outputElems:[],inputElems:function(b){for(var c=a(b),d=c.length,e=[],f=0;d>f;f++)e.push(c.get(f));return e}(a(this))};return d[i]=function(c){return"undefined"==typeof c?void b("error","Please specify an action like $."+i+'("killall")'):(c=c.toLowerCase(),void("killall"==c&&a.each(x.inputElems,function(){new f(this,"kill")})))},a.extend(a,d),this.each(function(){var b=a(this);this.global=e,x.inputElems.push(b),"string"==typeof c?new f(this,c):(b.data(w)&&b.data(w).complete===!1&&(b.data(w).src="",new f(this,"kill")),b.data(i)?b.data(r)&&b.data(r).reinit===!0&&(new f(this,"kill"),b.data(i,new f(this,c))):b.data(i,new f(this,c)))})},a.fn[i].defaults=y});