!function(i,t){"use strict";var e=function(i){this.$e={container:t(i),imgList:null,imgsView:t("#imgsView"),imgsViewInner:null,btnPrev:null,btnNext:null},this._data={winW:0,winH:0,curIndex:-1},this._init()};e.prototype._init=function(){var e=this;this.$e.imgsViewInner=this.$e.imgsView.find("#imgsViewInner"),this.$e.btnPrev=this.$e.imgsView.find(".prev"),this.$e.btnNext=this.$e.imgsView.find(".next"),this._data.winW=t(i).width(),this._data.winH=t(i).height(),this.$e.container.on("click",function(i){"img"==i.target.tagName.toLowerCase()&&(e.$e.imgList=e.$e.container.find("img"),e._data.curIndex=e.$e.imgList.index(i.target),e.open())}),this.$e.imgsView.children(".imgsv-background").on("click",function(){e.close()}),this.$e.imgsView.find(".original").on("click",function(){e.resizeAs("org")}),this.$e.imgsView.find(".suit").on("click",function(){e.resizeAs("suit")}),this.$e.imgsView.find(".prev").on("click",function(){var i=t(this);i.hasClass("off")||e.playTo(e._data.curIndex-1)}),this.$e.imgsView.find(".next").on("click",function(){var i=t(this);i.hasClass("off")||e.playTo(e._data.curIndex+1)})},e.prototype.open=function(){var i=this;this.playTo(this._data.curIndex),this.$e.imgsView.fadeIn(80),setTimeout(function(){i.$e.imgsView.addClass("on")},50)},e.prototype.close=function(){var i=this;this.$e.imgsView.removeClass("on"),setTimeout(function(){i.$e.imgsView.fadeOut(50)},200),i.$e.imgList=null,i._data.curIndex=-1},e.prototype.playTo=function(i){0==i?this.$e.btnPrev.addClass("off"):this.$e.btnPrev.removeClass("off"),i==this.$e.imgList.length-1?this.$e.btnNext.addClass("off"):this.$e.btnNext.removeClass("off"),this.$e.imgCur=this.$e.imgList.eq(i).clone().removeAttr("align"),this.resizeAs("suit"),this.$e.imgsViewInner.html(this.$e.imgCur),this._data.curIndex=i},e.prototype.resizeAs=function(i){"suit"==i?(this.$e.imgCur.removeAttr("width").removeAttr("height"),this.$e.imgCur[0].naturalWidth>this._data.winW-60&&this.$e.imgCur.css("max-width",this._data.winW-60),this.$e.imgCur[0].naturalHeight>this._data.winH-60&&this.$e.imgCur.css("max-height",this._data.winH-60)):"org"==i&&(this.$e.imgCur.removeAttr("style"),this.$e.imgCur.attr({width:this.$e.imgCur[0].naturalWidth,height:this.$e.imgCur[0].naturalHeight}))},t.extend(t.fn,{imgsView:function(){return this.each(function(){return new e(this)})}})}(window,jQuery);