!function(t,i){"function"==typeof define&&define.amd?define(["jquery"],i):"object"==typeof exports?module.exports=i():t.Query=i(window.Zepto||window.jQuery||$)}(this,function(t){return{getQuery:function(t,e,s){new RegExp("(^|&|#)"+t+"=([^&]*)(&|$|#)","i");s=s||window;var a,n,r=s.location.href,l="";if(a="#"==e?r.split("#"):r.split("?"),""!=(n=1==a.length?"":a[1])){gg=n.split(/&|#/);var h=gg.length;for(str=arguments[0]+"=",i=0;i0){e=e.substr(1);for(var s=e.split("&"),a=0,n=s.length;a0&&(i[r[0]]=decodeURI(r[1])||"")}}return i}}}),function(t,i){"function"==typeof define&&define.amd?define(["jquery","query"],i):"object"==typeof exports?module.exports=i():t.Paging=i(window.Zepto||window.jQuery||$,Query)}(this,function(t,i){function e(){var t=Math.random().toString().replace(".","");this.id="Paging_"+t}return t.fn.Paging=function(i){var s=[];return t(this).each(function(){var a=t.extend({target:t(this)},i),n=new e;n.init(a),s.push(n)}),s},e.prototype={init:function(i){this.settings=t.extend({callback:null,pagesize:10,current:1,prevTpl:"上一页",nextTpl:"下一页",firstTpl:"首页",lastTpl:"末页",ellipseTpl:"...",toolbar:!1,hash:!1,pageSizeList:[5,10,15,20]},i),this.target=t(this.settings.target),this.container=t('
'),this.target.append(this.container),this.render(this.settings),this.format(),this.bindEvent()},render:function(t){void 0!==t.count?this.count=t.count:this.count=this.settings.count,void 0!==t.pagesize?this.pagesize=t.pagesize:this.pagesize=this.settings.pagesize,void 0!==t.current?this.current=t.current:this.current=this.settings.current,this.pagecount=Math.ceil(this.count/this.pagesize),this.format()},bindEvent:function(){var i=this;this.container.on("click","li.js-page-action,li.ui-pager",function(e){if(t(this).hasClass("ui-pager-disabled")||t(this).hasClass("focus"))return!1;t(this).hasClass("js-page-action")?(t(this).hasClass("js-page-first")&&(i.current=1),t(this).hasClass("js-page-prev")&&(i.current=Math.max(1,i.current-1)),t(this).hasClass("js-page-next")&&(i.current=Math.min(i.pagecount,i.current+1)),t(this).hasClass("js-page-last")&&(i.current=i.pagecount)):t(this).data("page")&&(i.current=parseInt(t(this).data("page"))),i.go()})},go:function(t){var e=this;this.current=t||this.current,this.current=Math.max(1,e.current),this.current=Math.min(this.current,e.pagecount),this.format(),this.settings.hash&&i.setHash({page:this.current}),this.settings.callback&&this.settings.callback(this.current,this.pagesize,this.pagecount)},changePagesize:function(t){this.render({pagesize:t}),this.settings.changePagesize&&this.settings.changePagesize.call(this,this.pagesize,this.current,this.pagecount)},format:function(){var i="
    ";if(i+='
  • '+this.settings.firstTpl+"
  • ",i+='
  • '+this.settings.prevTpl+"
  • ",this.pagecount>6){if(i+='
  • 1
  • ',this.current<=2)i+='
  • 2
  • ',i+='
  • 3
  • ',i+='
  • '+this.settings.ellipseTpl+"
  • ";else if(this.current>2&&this.current<=this.pagecount-2)this.current>3&&(i+="
  • "+this.settings.ellipseTpl+"
  • "),i+='
  • '+(this.current-1)+"
  • ",i+='
  • '+this.current+"
  • ",i+='
  • '+(this.current+1)+"
  • ",this.current'+this.settings.ellipseTpl+"");else{i+='
  • '+this.settings.ellipseTpl+"
  • ";for(var e=this.pagecount-2;e'+e+""}i+='
  • '+this.pagecount+"
  • "}else for(var e=1;e<=this.pagecount;e++)i+='
  • '+e+"
  • ";i+='
  • '+this.settings.nextTpl+"
  • ",i+='
  • '+this.settings.lastTpl+"
  • ",i+="
",this.container.html(i),1==this.current&&(t(".js-page-prev",this.container).addClass("ui-pager-disabled"),t(".js-page-first",this.container).addClass("ui-pager-disabled")),this.current==this.pagecount&&(t(".js-page-next",this.container).addClass("ui-pager-disabled"),t(".js-page-last",this.container).addClass("ui-pager-disabled")),this.container.find('li[data-page="'+this.current+'"]').addClass("focus").siblings().removeClass("focus"),this.settings.toolbar&&this.bindToolbar()},bindToolbar:function(){for(var i=this,e=t('
  • 跳转
  • '),s=t(".ui-select-pagesize",e),a="",n=0,r=this.settings.pageSizeList.length;n'+this.settings.pageSizeList[n]+"条/页";s.html(a),s.val(this.pagesize),t("input",e).val(this.current),t("input",e).click(function(){t(this).select()}).keydown(function(e){if(13==e.keyCode){var s=parseInt(t(this).val())||1;i.go(s)}}),t("a",e).click(function(){var e=parseInt(t(this).prev().val())||1;i.go(e)}),s.change(function(){i.changePagesize(t(this).val())}),this.container.children("ul").append(e)}},e});