!function(t){function i(i,e){this.$container=i,this.options=t.extend({startslide:0,item:".hislider-item",isfullscreen:!1,isflexible:!1,issupporttouch:"__proto__"in{},isshowpage:!0,isshowtitle:!0,titleattr:"data-title",isshowcontrols:!0,isauto:!0,intervaltime:5000,affecttime:600,mode:"move",direction:"left",onswipestart:t.noop,onswipemove:t.noop,minswipelength:30,onswipecancel:t.noop,onswipeend:t.noop,onswipeleft:t.noop,onswiperight:t.noop,onswipetop:t.noop,onswipebottom:t.noop,oninited:t.noop,onmovebefore:t.noop,onmoveafter:t.noop,onselected:t.noop},e),this.init()}i.prototype={init:function(){this.$item=this.$container.find(this.options.item),this.size=this.$item.size(),this.curindex=this.options.startslide,this.setlayout(),this.playtimer=null,this.options.isauto&&this.autoplay(),this.options.isflexible&&t(window).on("resize.hislider",t.proxy(this,"resize")),this.options.issupporttouch&&this.touch()},touch:function(){var t=this,i={},e=this.options,o=e.minswipelength;this.$container.on("touchstart",function(t){var o=t.originalevent.touches[0];i.x1=o.pagex,i.y1=o.pagey,e.onswipestart.call(this,i)}).on("touchmove",function(t){var o=t.originalevent.touches[0];i.x2=o.pagex,i.y2=o.pagey,e.onswipemove.call(this,i)}).on("touchend",function(){if(i.x2&&math.abs(i.x1-i.x2)>o||i.y2&&math.abs(i.y1-i.y2)>o){var n=t.swipedirection(i.x1,i.x2,i.y1,i.y2);e["onswipe"+n].call(this,i),t.moveto(n),e.onswipeend.call(this,i)}else e.onswipecancel.call(this,i);i={}})},moveto:function(t){var i=this,e=i.options.direction;"top"==e?"bottom"==t?i[i.options.mode+"prev"]():"top"==t&&i[i.options.mode]():"left"==e&&("right"==t?i[i.options.mode+"prev"]():"left"==t&&i[i.options.mode]())},swipedirection:function(t,i,e,o){var n=math.abs(t-i),s=math.abs(e-o);return n>=s?t-i>0?"left":"right":e-o>0?"top":"bottom"},move:function(){var t,i=this;i.options.isauto&&i.autoplay(),++i.curindex==i.size&&(i.curindex=0,i.$container.css(i.getmove()),i.curindex++),i.settitle(),i.setpages(),t=i.curindex==i.size-1?0:i.curindex,i.options.onmovebefore.call(i.$container,i.$item,t),i.$container.stop(!1,!0).animate(i.getmove(),i.options.affecttime,function(){i.options.onmoveafter.call(this,i.$item,t)})},moveprev:function(t){var i=this;1!=t&&("move"==i.options.mode?0==i.curindex&&(i.curindex=i.size-1,i.$container.css(i.getmove())):0==i.curindex&&(i.curindex=i.size),i.curindex--),i.options.isauto&&i.autoplay(),i.settitle(),i.setpages(),i.options.onmovebefore.call(i.$container,i.$item,i.curindex),i.$container.stop(!1,!0).animate(i.getmove(),i.options.affecttime,function(){i.options.onmoveafter.call(this,i.$item,i.curindex)})},getmove:function(t){var i={},e=this.getsize(),o=this.options.direction;return"top"==o?(i.top=-this.curindex*e.height,t&&(i.width=e.width)):(i.left=-this.curindex*e.width,t&&(i.height=e.height)),i},fade:function(){var t=this;t.options.isauto&&t.autoplay(),t.curindex++,t.curindex>t.size-1&&(t.curindex=0),t.settitle(),t.setpages(),t.options.onmovebefore.call(t.$container,t.$item,t.curindex),t.$item.fadeout(t.options.affecttime).eq(t.curindex).fadein(t.options.affecttime,function(){t.options.onmoveafter.call(this,t.$item,t.curindex)})},fadeprev:function(t){var i=this;1!=t&&("move"==i.options.mode?0==i.curindex&&(i.curindex=i.size-1,i.$container.css(i.getmove())):0==i.curindex&&(i.curindex=i.size),i.curindex--),i.options.isauto&&i.autoplay(),i.settitle(),i.setpages(),i.options.onmovebefore.call(i.$container,i.$item,i.curindex),i.$item.fadeout(i.options.affecttime).eq(i.curindex).fadein(i.options.affecttime,function(){i.options.onmoveafter.call(this,i.$item,i.curindex)})},setpages:function(){if(this.options.isshowpage&&this.$pages){var i=this.curindex;i==this.size-1&&"move"==this.options.mode&&(i=0),t("a",this.$pages).eq(i).addclass("active").siblings().removeclass("active")}},settitle:function(){if(this.options.isshowtitle&&this.$title){var i=this.$item.eq(this.curindex);this.$title.html(t.isfunction(this.options.titleattr)?this.options.titleattr.call(i,this.curindex):i.attr(this.options.titleattr))}},setlayout:function(){var i=(this.options,this.getsetcss());this.$item.css(i.item),this.$container.css(i.container).wrap('
'),this.$wrap=this.$container.parent(),this.$wrap.css(i.wrap),this.options.isshowtitle&&(this.$title=t('').insertafter(this.$container),this.settitle()),this.options.isshowpage&&(this.$pages=t(' ").insertafter(this.$container),this.pagesswitch()),this.options.isshowcontrols&&(this.$prev=t('prev'),this.$next=t('next'),this.$container.after(this.$prev.add(this.$next)),this.controlsswitch()),"move"==this.options.mode?(this.$container.append(this.$item.eq(0).clone().addclass("item-clone")),this.$item=this.$container.find(this.options.item),this.size=this.$item.size()):this.setfade(),this.options.oninited.call(this.$container,this.$item,this.options.startslide)},resize:function(){var t,i=this;cleartimeout(t),t=settimeout(function(){i.$wrap.add(i.$item).css(i.getsize(i.options.direction)),i.$container.css(i.getmove(!0))},3000)},setfade:function(){this.$item.hide().eq(this.curindex).show()},getsetcss:function(){var t=this.getsize(),i={},e=math.min(this.options.startslide,this.size);return"fade"==this.options.mode?(t.position="absolute",i.height=t.height,i.width=t.width):("top"==this.options.direction?(i.height=100*(this.size+1)+"%",i.width=t.width,i.top=-(e*t.height)):(i.height=t.height,i.width=100*(this.size+1)+"%",i.left=-(e*t.width),t.float="left"),i.position="relative"),{item:t,container:i,wrap:{overflow:"hidden",position:"relative",width:t.width,height:t.height}}},autoplay:function(){var i=this;cleartimeout(i.playtimer),i.playtimer=settimeout(t.proxy(i,i.options.mode),i.options.intervaltime)},controlsswitch:function(){var i=this;this.$next.on("click",t.proxy(i,i.options.mode)),this.$prev.on("click",t.proxy(i,i.options.mode+"prev"))},pagesswitch:function(){if(this.options.isshowpage&&this.$pages){var i=this;t("a",this.$pages).on("click",function(){i.curindex=t(this).index(),i.options.onselected.call(this,i.curindex),i[i.options.mode+"prev"](!0)})}},getpages:function(){var i=[],e=this.curindex;return t(this.$item).each(function(t){var o=t==e?'class="active"':"";i.push('"+(t+1)+"")}),i.join("")},getsize:function(){var i,e=this.$item.eq(0);if(this.options.isfullscreen)i={width:t(window).width(),height:t(window).height()};else if(this.options.isflexible){var e=this.$wrap?this.$wrap.parent():this.$container.parent();i="top"==this.options.direction?{height:e.height()}:{width:e.width()}}return i||{width:e.width(),height:e.height()}}},t.fn.hislider=function(e){return this.each(function(){t(this).data("mr.slider",new i(t(this),e))}),this}}(window.jquery);