From 2481d6502a323973485352dc0a572bec69d87aa2 Mon Sep 17 00:00:00 2001 From: superRaytin Date: Thu, 15 Jan 2015 21:50:38 +0800 Subject: [PATCH] =?UTF-8?q?Changes:=20Fixes=20for=20'show'=E3=80=81'hide'?= =?UTF-8?q?=20method.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dist/pagination.js | 12 ++++++++---- dist/pagination.min.js | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/dist/pagination.js b/dist/pagination.js index 311732e..95c82f6 100644 --- a/dist/pagination.js +++ b/dist/pagination.js @@ -510,15 +510,19 @@ }, show: function(){ - if(container.is(':visible')) return; + var self = this; + + if(self.model.el.is(':visible')) return; - container.show(); + self.model.el.show(); }, hide: function(){ - if(!container.is(':visible')) return; + var self = this; + + if(!self.model.el.is(':visible')) return; - container.hide(); + self.model.el.hide(); }, // Replace the variables of template diff --git a/dist/pagination.min.js b/dist/pagination.min.js index af278cd..a2a35ec 100644 --- a/dist/pagination.min.js +++ b/dist/pagination.min.js @@ -6,4 +6,4 @@ * Copyright 2014, superRaytin * Released under the MIT license. */ -!function(a,b){function c(a){throw new Error("Pagination: "+a)}function d(a){a.dataSource||c('"dataSource" is required.'),"string"==typeof a.dataSource?"undefined"==typeof a.totalNumber?c('"totalNumber" is required.'):b.isNumeric(a.totalNumber)||c('"totalNumber" is incorrect. (Number)'):b.isObject(a.dataSource)&&("undefined"==typeof a.locator?c('"dataSource" is a Object, please specify "locator".'):"string"==typeof a.locator||b.isFunction(a.locator)||c(""+a.locator+" is incorrect. (String | Function)"))}function e(){var a=b("#paginationjs-style");if(!a.length){var c='.paginationjs:not(.custom-paginationjs){line-height: 1.6; font-family: "Marmelad", "Lucida Grande", "Hiragino Sans GB", Georgia, sans-serif; font-size: 14px; box-sizing: initial;}.paginationjs:not(.custom-paginationjs):after{display: table; content: " "; clear: both;}.paginationjs:not(.custom-paginationjs) .paginationjs-pages{float: left;}.paginationjs:not(.custom-paginationjs) .paginationjs-pages ul{float: left; margin: 0; padding: 0;}.paginationjs:not(.custom-paginationjs) .paginationjs-pages li{float: left; border: 1px solid #aaaaaa; border-right: none; list-style: none;}.paginationjs:not(.custom-paginationjs) .paginationjs-pages li > a{min-width: 30px; height: 28px; line-height: 28px; display: block; background: #fff; font-size: 14px; color: #333; text-decoration: none; text-align: center;}.paginationjs:not(.custom-paginationjs) .paginationjs-pages li > a:hover{background: #eee;}.paginationjs:not(.custom-paginationjs) .paginationjs-pages li.active{border: none;}.paginationjs:not(.custom-paginationjs) .paginationjs-pages li.active > a{height: 30px; line-height: 30px; background: #aaaaaa; color: #fff;}.paginationjs:not(.custom-paginationjs) .paginationjs-pages li.disabled > a{opacity: .3;}.paginationjs:not(.custom-paginationjs) .paginationjs-pages li.disabled > a:hover{background: none;}.paginationjs:not(.custom-paginationjs) .paginationjs-pages li:first-child{border-radius: 3px 0 0 3px;}.paginationjs:not(.custom-paginationjs) .paginationjs-pages li:first-child > a{border-radius: 3px 0 0 3px;}.paginationjs:not(.custom-paginationjs) .paginationjs-pages li:last-child{border-right: 1px solid #aaaaaa; border-radius: 0 3px 3px 0;}.paginationjs:not(.custom-paginationjs) .paginationjs-pages li:last-child > a{border-radius: 0 3px 3px 0;}.paginationjs:not(.custom-paginationjs) .paginationjs-go-input{float: left; margin-left: 10px; font-size: 14px;}.paginationjs:not(.custom-paginationjs) .paginationjs-go-input > input[type="text"]{width: 30px; height: 28px; background: #fff; border-radius: 3px; border: 1px solid #aaaaaa; padding: 0; font-size: 14px; text-align: center; vertical-align: baseline; outline: none; box-shadow: none; box-sizing: initial;}.paginationjs:not(.custom-paginationjs) .paginationjs-go-button{float: left; margin-left: 10px; font-size: 14px;}.paginationjs:not(.custom-paginationjs) .paginationjs-go-button > input[type="button"]{min-width: 40px; height: 30px; line-height: 28px; background: #fff; border-radius: 3px; border: 1px solid #aaaaaa; text-align: center; padding: 0 8px; font-size: 14px; vertical-align: baseline; outline: none; box-shadow: none; color: #333; cursor: pointer;}.paginationjs:not(.custom-paginationjs) .paginationjs-go-button > input[type="button"]:hover{background-color: #f8f8f8;}.paginationjs:not(.custom-paginationjs) .paginationjs-nav{float: left; height: 30px; line-height: 30px; margin-left: 10px; font-size: 14px;}.paginationjs:not(.custom-paginationjs).paginationjs-small{font-size: 12px;}.paginationjs:not(.custom-paginationjs).paginationjs-small li > a{min-width: 26px; height: 24px; line-height: 24px; font-size: 12px;}.paginationjs:not(.custom-paginationjs).paginationjs-small li.active > a{height: 26px; line-height: 26px;}.paginationjs:not(.custom-paginationjs).paginationjs-small .paginationjs-go-input{font-size: 12px;}.paginationjs:not(.custom-paginationjs).paginationjs-small .paginationjs-go-input > input[type="text"]{width: 26px; height: 24px; font-size: 12px;}.paginationjs:not(.custom-paginationjs).paginationjs-small .paginationjs-go-button{font-size: 12px;}.paginationjs:not(.custom-paginationjs).paginationjs-small .paginationjs-go-button > input[type="button"]{min-width: 30px; height: 26px; line-height: 24px; padding: 0 6px; font-size: 12px;}.paginationjs:not(.custom-paginationjs).paginationjs-small .paginationjs-nav{height: 26px; line-height: 26px; font-size: 12px;}.paginationjs:not(.custom-paginationjs).paginationjs-big{font-size: 16px;}.paginationjs:not(.custom-paginationjs).paginationjs-big li > a{min-width: 36px; height: 34px; line-height: 34px; font-size: 16px;}.paginationjs:not(.custom-paginationjs).paginationjs-big li.active > a{height: 36px; line-height: 36px;}.paginationjs:not(.custom-paginationjs).paginationjs-big .paginationjs-go-input{font-size: 16px;}.paginationjs:not(.custom-paginationjs).paginationjs-big .paginationjs-go-input > input[type="text"]{width: 36px; height: 34px; font-size: 16px;}.paginationjs:not(.custom-paginationjs).paginationjs-big .paginationjs-go-button{font-size: 16px;}.paginationjs:not(.custom-paginationjs).paginationjs-big .paginationjs-go-button > input[type="button"]{min-width: 50px; height: 36px; line-height: 34px; padding: 0 12px; font-size: 16px;}.paginationjs:not(.custom-paginationjs).paginationjs-big .paginationjs-nav{height: 36px; line-height: 36px; font-size: 16px;}.paginationjs:not(.custom-paginationjs).paginationjs-theme-blue .paginationjs-pages li{border-color: #289de9;}.paginationjs:not(.custom-paginationjs).paginationjs-theme-blue .paginationjs-pages li > a{color: #289de9;}.paginationjs:not(.custom-paginationjs).paginationjs-theme-blue .paginationjs-pages li > a:hover{background: #e9f4fc;}.paginationjs:not(.custom-paginationjs).paginationjs-theme-blue .paginationjs-pages li.active > a{background: #289de9; color: #fff;}.paginationjs:not(.custom-paginationjs).paginationjs-theme-blue .paginationjs-pages li.disabled > a:hover{background: none;}.paginationjs:not(.custom-paginationjs).paginationjs-theme-blue .paginationjs-go-input > input[type="text"]{border-color: #289de9;}.paginationjs:not(.custom-paginationjs).paginationjs-theme-blue .paginationjs-go-button > input[type="button"]{background: #289de9; border-color: #289de9; color: #fff;}.paginationjs:not(.custom-paginationjs).paginationjs-theme-blue .paginationjs-go-button > input[type="button"]:hover{background-color: #3ca5ea;}.paginationjs:not(.custom-paginationjs).paginationjs-theme-green .paginationjs-pages li{border-color: #449d44;}.paginationjs:not(.custom-paginationjs).paginationjs-theme-green .paginationjs-pages li > a{color: #449d44;}.paginationjs:not(.custom-paginationjs).paginationjs-theme-green .paginationjs-pages li > a:hover{background: #ebf4eb;}.paginationjs:not(.custom-paginationjs).paginationjs-theme-green .paginationjs-pages li.active > a{background: #449d44; color: #fff;}.paginationjs:not(.custom-paginationjs).paginationjs-theme-green .paginationjs-pages li.disabled > a:hover{background: none;}.paginationjs:not(.custom-paginationjs).paginationjs-theme-green .paginationjs-go-input > input[type="text"]{border-color: #449d44;}.paginationjs:not(.custom-paginationjs).paginationjs-theme-green .paginationjs-go-button > input[type="button"]{background: #449d44; border-color: #449d44; color: #fff;}.paginationjs:not(.custom-paginationjs).paginationjs-theme-green .paginationjs-go-button > input[type="button"]:hover{background-color: #55a555;}.paginationjs:not(.custom-paginationjs).paginationjs-theme-yellow .paginationjs-pages li{border-color: #ec971f;}.paginationjs:not(.custom-paginationjs).paginationjs-theme-yellow .paginationjs-pages li > a{color: #ec971f;}.paginationjs:not(.custom-paginationjs).paginationjs-theme-yellow .paginationjs-pages li > a:hover{background: #fdf5e9;}.paginationjs:not(.custom-paginationjs).paginationjs-theme-yellow .paginationjs-pages li.active > a{background: #ec971f; color: #fff;}.paginationjs:not(.custom-paginationjs).paginationjs-theme-yellow .paginationjs-pages li.disabled > a:hover{background: none;}.paginationjs:not(.custom-paginationjs).paginationjs-theme-yellow .paginationjs-go-input > input[type="text"]{border-color: #ec971f;}.paginationjs:not(.custom-paginationjs).paginationjs-theme-yellow .paginationjs-go-button > input[type="button"]{background: #ec971f; border-color: #ec971f; color: #fff;}.paginationjs:not(.custom-paginationjs).paginationjs-theme-yellow .paginationjs-go-button > input[type="button"]:hover{background-color: #eea135;}.paginationjs:not(.custom-paginationjs).paginationjs-theme-red .paginationjs-pages li{border-color: #c9302c;}.paginationjs:not(.custom-paginationjs).paginationjs-theme-red .paginationjs-pages li > a{color: #c9302c;}.paginationjs:not(.custom-paginationjs).paginationjs-theme-red .paginationjs-pages li > a:hover{background: #faeaea;}.paginationjs:not(.custom-paginationjs).paginationjs-theme-red .paginationjs-pages li.active > a{background: #c9302c; color: #fff;}.paginationjs:not(.custom-paginationjs).paginationjs-theme-red .paginationjs-pages li.disabled > a:hover{background: none;}.paginationjs:not(.custom-paginationjs).paginationjs-theme-red .paginationjs-go-input > input[type="text"]{border-color: #c9302c;}.paginationjs:not(.custom-paginationjs).paginationjs-theme-red .paginationjs-go-button > input[type="button"]{background: #c9302c; border-color: #c9302c; color: #fff;}.paginationjs:not(.custom-paginationjs).paginationjs-theme-red .paginationjs-go-button > input[type="button"]:hover{background-color: #ce4541;}';b("head").append('")}}"undefined"==typeof b&&c("Pagination requires jQuery.");var f="pagination",g="addHook",h="__pagination-";b.fn.pagination&&(f="pagination2"),b.fn[f]=function(f){if("undefined"==typeof f)return this;var g=b(this),i={initialize:function(){var a=this;if(g.data("pagination")||g.data("pagination",{}),a.callHook("beforeInit")!==!1){g.data("pagination").initialized&&b(".paginationjs",g).remove(),k.inlineStyle===!0&&e();var c=a.model={pageRange:k.pageRange,pageSize:k.pageSize};a.parseDataSource(k.dataSource,function(d){a.sync=b.isArray(d),a.sync&&(c.totalNumber=k.totalNumber=d.length),c.totalPage=a.getTotalPage();var e=a.render(!0);k.className&&e.addClass(k.className),c.el=e,g["bottom"===k.position?"append":"prepend"](e),a.observer(),g.data("pagination").initialized=!0,a.callHook("afterInit",e)})}},render:function(a){var c=this,d=c.model,e=d.el||b('
'),f=a!==!0;c.callHook("beforeRender",f);var g=d.pageNumber||k.pageNumber,h=k.pageRange,i=d.totalPage,j=g-h,l=g+h;return l>i&&(l=i,j=i-2*h,j=1>j?1:j),1>=j&&(j=1,l=Math.min(2*h+1,i)),e.html(c.createTemplate({currentPage:g,pageRange:h,totalPage:i,rangeStart:j,rangeEnd:l})),c.callHook("afterRender",f),e},createTemplate:function(a){var c,d,e=this,f=a.currentPage,g=a.totalPage,h=a.rangeStart,i=a.rangeEnd,j=k.totalNumber,l=k.showPrevious,m=k.showNext,n=k.showPageNumbers,o=k.showNavigator,p=k.showGoInput,q=k.showGoButton,r=k.pageLink,s=k.prevText,t=k.nextText,u=k.ellipsisText,v=k.goButtonText,w=k.classPrefix,x=k.activeClassName,y=k.disableClassName,z=k.ulClassName,A=b.isFunction(k.formatNavigator)?k.formatNavigator():k.formatNavigator,B=b.isFunction(k.formatGoInput)?k.formatGoInput():k.formatGoInput,C=b.isFunction(k.formatGoButton)?k.formatGoButton():k.formatGoButton,D=b.isFunction(k.autoHidePrevious)?k.autoHidePrevious():k.autoHidePrevious,E=b.isFunction(k.autoHideNext)?k.autoHideNext():k.autoHideNext,F=b.isFunction(k.header)?k.header():k.header,G=b.isFunction(k.footer)?k.footer():k.footer,H="",I='',J='';if(F&&(c=e.replaceVariables(F,{currentPage:f,totalPage:g,totalNumber:j}),H+=c),l||n||m){if(H+='
',H+=z?'
"}return o&&A&&(c=e.replaceVariables(A,{currentPage:f,totalPage:g,totalNumber:j}),H+='
'+c+"
"),p&&B&&(c=e.replaceVariables(B,{currentPage:f,totalPage:g,totalNumber:j,input:I}),H+='
'+c+"
"),q&&C&&(c=e.replaceVariables(C,{currentPage:f,totalPage:g,totalNumber:j,button:J}),H+='
'+c+"
"),G&&(c=e.replaceVariables(G,{currentPage:f,totalPage:g,totalNumber:j}),H+=c),H},go:function(a,c){function d(a){if(f.direction="undefined"==typeof f.pageNumber?0:h>f.pageNumber?1:-1,f.pageNumber=h,e.render(),e.disabled&&!e.sync&&e.enable(),g.data("pagination").model=f,b.isFunction(k.formatResult)){var d=b.extend(!0,[],a);b.isArray(a=k.formatResult(d))||(a=d)}g.data("pagination").currentPageData=a,e.callHook("beforePaging"),e.doCallback(a,c),e.callHook("afterPaging"),1==h&&e.callHook("afterIsFirstPage"),h==f.totalPage&&e.callHook("afterIsLastPage")}var e=this,f=e.model;if(!e.disabled){var h=a,i=k.pageSize,j=f.totalPage;if(h=parseInt(h),!(!h||1>h||h>j)){if(e.sync)return void d(e.getDataSegment(h));var l={},m=k.alias||{};l[m.pageSize?m.pageSize:"pageSize"]=i,l[m.pageNumber?m.pageNumber:"pageNumber"]=h;var n={type:"get",cache:!1,data:{},contentType:"application/x-www-form-urlencoded; charset=UTF-8",dataType:"json",async:!0};b.extend(!0,n,k.ajax),b.extend(n.data||{},l),n.url=k.dataSource,n.success=function(a){d(e.filterDataByLocator(a))},n.error=function(a,b,c){k.formatAjaxError&&k.formatAjaxError(a,b,c),e.enable()},e.disable(),b.ajax(n)}}},doCallback:function(a,c){var d=this,e=d.model;b.isFunction(c)?c(a,e):b.isFunction(k.callback)&&k.callback(a,e)},destroy:function(){this.callHook("beforeDestroy")!==!1&&(this.model.el.remove(),g.off(),b("#paginationjs-style").remove(),this.callHook("afterDestroy"))},previous:function(a){this.go(this.model.pageNumber-1,a)},next:function(a){this.go(this.model.pageNumber+1,a)},disable:function(){var a=this,b=a.sync?"sync":"async";a.callHook("beforeDisable",b)!==!1&&(a.disabled=!0,a.model.disabled=!0,a.callHook("afterDisable",b))},enable:function(){var a=this,b=a.sync?"sync":"async";a.callHook("beforeEnable",b)!==!1&&(a.disabled=!1,a.model.disabled=!1,a.callHook("afterEnable",b))},show:function(){g.is(":visible")||g.show()},hide:function(){g.is(":visible")&&g.hide()},replaceVariables:function(a,b){var c;for(var d in b){var e=b[d],f=new RegExp("<%=\\s*"+d+"\\s*%>","img");c=(c||a).replace(f,e)}return c},getDataSegment:function(a){var b=k.pageSize,c=k.dataSource,d=k.totalNumber,e=b*(a-1)+1,f=Math.min(a*b,d);return c.slice(e-1,f)},getTotalPage:function(){return Math.ceil(k.totalNumber/k.pageSize)},getLocator:function(a){var d;return"string"==typeof a?d=a:b.isFunction(a)?d=a():c('"locator" is incorrect. (String | Function)'),d},filterDataByLocator:function(a){var d,e=this.getLocator(k.locator);if(b.isObject(a)){try{b.each(e.split("."),function(b,c){d=(d?d:a)[c]})}catch(f){}d?b.isArray(d)||c("dataSource."+e+" must be an Array."):c("dataSource."+e+" is undefined.")}return d||a},parseDataSource:function(a,d){var e=this,f=arguments;b.isObject(a)?d(k.dataSource=e.filterDataByLocator(a)):b.isArray(a)?d(k.dataSource=a):b.isFunction(a)?k.dataSource(function(a){b.isFunction(a)&&c('Unexpect parameter of the "done" Function.'),f.callee.call(e,a,d)}):"string"==typeof a?(/^https?|file:/.test(a)&&(k.ajaxDataType="jsonp"),d(a)):c('Unexpect data type of the "dataSource".')},callHook:function(c){var d,e=g.data("pagination"),f=Array.prototype.slice.apply(arguments);return f.shift(),k[c]&&b.isFunction(k[c])&&k[c].apply(a,f)===!1&&(d=!1),e.hooks&&e.hooks[c]&&b.each(e.hooks[c],function(b,c){c.apply(a,f)===!1&&(d=!1)}),d!==!1},observer:function(){var a=this,d=a.model.el;g.on(h+"go",function(d,e,f){e=parseInt(b.trim(e)),e&&(b.isNumeric(e)||c('"pageNumber" is incorrect. (Number)'),a.go(e,f))}),d.delegate(".J-paginationjs-page","click",function(c){var d=b(c.currentTarget),e=b.trim(d.attr("data-num"));return!e||d.hasClass(k.disableClassName)||d.hasClass(k.activeClassName)?void 0:a.callHook("beforePageOnClick",c)===!1?!1:(a.go(e),a.callHook("afterPageOnClick",c),k.pageLink?void 0:!1)}),d.delegate(".J-paginationjs-previous","click",function(c){var d=b(c.currentTarget),e=b.trim(d.attr("data-num"));return e&&!d.hasClass(k.disableClassName)?a.callHook("beforePreviousOnClick",c)===!1?!1:(a.go(e),a.callHook("afterPreviousOnClick",c),k.pageLink?void 0:!1):void 0}),d.delegate(".J-paginationjs-next","click",function(c){var d=b(c.currentTarget),e=b.trim(d.attr("data-num"));return e&&!d.hasClass(k.disableClassName)?a.callHook("beforeNextOnClick",c)===!1?!1:(a.go(e),a.callHook("afterNextOnClick",c),k.pageLink?void 0:!1):void 0}),d.delegate(".J-paginationjs-go-button","click",function(){var c=b(".J-paginationjs-go-pagenumber",d).val();return a.callHook("beforeGoButtonOnClick",event,c)===!1?!1:(g.trigger(h+"go",c),void a.callHook("afterGoButtonOnClick",event,c))}),d.delegate(".J-paginationjs-go-pagenumber","keyup",function(c){if(13===c.which){var e=b(c.currentTarget).val();if(a.callHook("beforeGoInputOnEnter",c,e)===!1)return!1;g.trigger(h+"go",e),b(".J-paginationjs-go-pagenumber",d).focus(),a.callHook("afterGoInputOnEnter",c,e)}}),g.on(h+"previous",function(b,c){a.previous(c)}),g.on(h+"next",function(b,c){a.next(c)}),g.on(h+"disable",function(){a.disable()}),g.on(h+"enable",function(){a.enable()}),g.on(h+"show",function(){a.show()}),g.on(h+"hide",function(){a.hide()}),g.on(h+"destroy",function(){a.destroy()}),(i.sync||k.triggerPagingOnInit)&&g.trigger(h+"go",Math.min(k.pageNumber,a.model.totalPage))}};if(g.data("pagination")&&g.data("pagination").initialized===!0){if(b.isNumeric(f))return g.trigger.call(this,h+"go",f,arguments[1]),this;if("string"==typeof f){var j=Array.prototype.slice.apply(arguments);switch(j[0]=h+j[0],f){case"previous":case"next":case"go":case"disable":case"enable":case"show":case"hide":case"destroy":g.trigger.apply(this,j);break;case"getSelectedPageNum":return g.data("pagination").model?g.data("pagination").model.pageNumber:g.data("pagination").attributes.pageNumber;case"getTotalPage":return g.data("pagination").model.totalPage;case"getSelectedPageData":return g.data("pagination").currentPageData;case"isDisabled":return g.data("pagination").model.disabled===!0;default:c("Pagination do not provide action: "+f)}return this}c("invalid action: "+f)}else b.isObject(f)||c("options is illegal");var k=b.extend({},arguments.callee.defaults,f);return d(k),i.initialize(),this},b.fn[f].defaults={locator:"data",totalNumber:1,pageNumber:1,pageSize:10,pageRange:2,showPrevious:!0,showNext:!0,showPageNumbers:!0,showNavigator:!1,showGoInput:!1,showGoButton:!1,pageLink:"",prevText:"«",nextText:"»",ellipsisText:"...",goButtonText:"Go",classPrefix:"paginationjs",activeClassName:"active",disableClassName:"disabled",inlineStyle:!0,formatNavigator:"<%= currentPage %> / <%= totalPage %>",formatGoInput:"<%= input %>",formatGoButton:"<%= button %>",position:"bottom",autoHidePrevious:!1,autoHideNext:!1,triggerPagingOnInit:!0,showFirstOnEllipsisShow:!0,showLastOnEllipsisShow:!0,callback:function(){}},b.fn[g]=function(a,d){arguments.length<2&&c("Missing argument."),b.isFunction(d)||c("callback must be a function.");var e=b(this),f=e.data("pagination");f||(e.data("pagination",{}),f=e.data("pagination")),!f.hooks&&(f.hooks={}),f.hooks[a]=f.hooks[a]||[],f.hooks[a].push(d)},b[f]=function(a,d){arguments.length<2&&c("Requires two parameters.");var e;return e="string"!=typeof a&&a instanceof jQuery?a:b(a),e.length?(e.pagination(d),e):void 0},b.each(["Object","Array","Function"],function(a,c){b["is"+c]=function(a){return toString.call(a)==="[object "+c+"]"}}),"function"==typeof define&&(define.amd||define.cmd)&&define(function(){return b})}(this,window.jQuery); \ No newline at end of file +!function(a,b){function c(a){throw new Error("Pagination: "+a)}function d(a){a.dataSource||c('"dataSource" is required.'),"string"==typeof a.dataSource?"undefined"==typeof a.totalNumber?c('"totalNumber" is required.'):b.isNumeric(a.totalNumber)||c('"totalNumber" is incorrect. (Number)'):b.isObject(a.dataSource)&&("undefined"==typeof a.locator?c('"dataSource" is a Object, please specify "locator".'):"string"==typeof a.locator||b.isFunction(a.locator)||c(""+a.locator+" is incorrect. (String | Function)"))}function e(){var a=b("#paginationjs-style");if(!a.length){var c='.paginationjs:not(.custom-paginationjs){line-height: 1.6; font-family: "Marmelad", "Lucida Grande", "Hiragino Sans GB", Georgia, sans-serif; font-size: 14px; box-sizing: initial;}.paginationjs:not(.custom-paginationjs):after{display: table; content: " "; clear: both;}.paginationjs:not(.custom-paginationjs) .paginationjs-pages{float: left;}.paginationjs:not(.custom-paginationjs) .paginationjs-pages ul{float: left; margin: 0; padding: 0;}.paginationjs:not(.custom-paginationjs) .paginationjs-pages li{float: left; border: 1px solid #aaaaaa; border-right: none; list-style: none;}.paginationjs:not(.custom-paginationjs) .paginationjs-pages li > a{min-width: 30px; height: 28px; line-height: 28px; display: block; background: #fff; font-size: 14px; color: #333; text-decoration: none; text-align: center;}.paginationjs:not(.custom-paginationjs) .paginationjs-pages li > a:hover{background: #eee;}.paginationjs:not(.custom-paginationjs) .paginationjs-pages li.active{border: none;}.paginationjs:not(.custom-paginationjs) .paginationjs-pages li.active > a{height: 30px; line-height: 30px; background: #aaaaaa; color: #fff;}.paginationjs:not(.custom-paginationjs) .paginationjs-pages li.disabled > a{opacity: .3;}.paginationjs:not(.custom-paginationjs) .paginationjs-pages li.disabled > a:hover{background: none;}.paginationjs:not(.custom-paginationjs) .paginationjs-pages li:first-child{border-radius: 3px 0 0 3px;}.paginationjs:not(.custom-paginationjs) .paginationjs-pages li:first-child > a{border-radius: 3px 0 0 3px;}.paginationjs:not(.custom-paginationjs) .paginationjs-pages li:last-child{border-right: 1px solid #aaaaaa; border-radius: 0 3px 3px 0;}.paginationjs:not(.custom-paginationjs) .paginationjs-pages li:last-child > a{border-radius: 0 3px 3px 0;}.paginationjs:not(.custom-paginationjs) .paginationjs-go-input{float: left; margin-left: 10px; font-size: 14px;}.paginationjs:not(.custom-paginationjs) .paginationjs-go-input > input[type="text"]{width: 30px; height: 28px; background: #fff; border-radius: 3px; border: 1px solid #aaaaaa; padding: 0; font-size: 14px; text-align: center; vertical-align: baseline; outline: none; box-shadow: none; box-sizing: initial;}.paginationjs:not(.custom-paginationjs) .paginationjs-go-button{float: left; margin-left: 10px; font-size: 14px;}.paginationjs:not(.custom-paginationjs) .paginationjs-go-button > input[type="button"]{min-width: 40px; height: 30px; line-height: 28px; background: #fff; border-radius: 3px; border: 1px solid #aaaaaa; text-align: center; padding: 0 8px; font-size: 14px; vertical-align: baseline; outline: none; box-shadow: none; color: #333; cursor: pointer;}.paginationjs:not(.custom-paginationjs) .paginationjs-go-button > input[type="button"]:hover{background-color: #f8f8f8;}.paginationjs:not(.custom-paginationjs) .paginationjs-nav{float: left; height: 30px; line-height: 30px; margin-left: 10px; font-size: 14px;}.paginationjs:not(.custom-paginationjs).paginationjs-small{font-size: 12px;}.paginationjs:not(.custom-paginationjs).paginationjs-small li > a{min-width: 26px; height: 24px; line-height: 24px; font-size: 12px;}.paginationjs:not(.custom-paginationjs).paginationjs-small li.active > a{height: 26px; line-height: 26px;}.paginationjs:not(.custom-paginationjs).paginationjs-small .paginationjs-go-input{font-size: 12px;}.paginationjs:not(.custom-paginationjs).paginationjs-small .paginationjs-go-input > input[type="text"]{width: 26px; height: 24px; font-size: 12px;}.paginationjs:not(.custom-paginationjs).paginationjs-small .paginationjs-go-button{font-size: 12px;}.paginationjs:not(.custom-paginationjs).paginationjs-small .paginationjs-go-button > input[type="button"]{min-width: 30px; height: 26px; line-height: 24px; padding: 0 6px; font-size: 12px;}.paginationjs:not(.custom-paginationjs).paginationjs-small .paginationjs-nav{height: 26px; line-height: 26px; font-size: 12px;}.paginationjs:not(.custom-paginationjs).paginationjs-big{font-size: 16px;}.paginationjs:not(.custom-paginationjs).paginationjs-big li > a{min-width: 36px; height: 34px; line-height: 34px; font-size: 16px;}.paginationjs:not(.custom-paginationjs).paginationjs-big li.active > a{height: 36px; line-height: 36px;}.paginationjs:not(.custom-paginationjs).paginationjs-big .paginationjs-go-input{font-size: 16px;}.paginationjs:not(.custom-paginationjs).paginationjs-big .paginationjs-go-input > input[type="text"]{width: 36px; height: 34px; font-size: 16px;}.paginationjs:not(.custom-paginationjs).paginationjs-big .paginationjs-go-button{font-size: 16px;}.paginationjs:not(.custom-paginationjs).paginationjs-big .paginationjs-go-button > input[type="button"]{min-width: 50px; height: 36px; line-height: 34px; padding: 0 12px; font-size: 16px;}.paginationjs:not(.custom-paginationjs).paginationjs-big .paginationjs-nav{height: 36px; line-height: 36px; font-size: 16px;}.paginationjs:not(.custom-paginationjs).paginationjs-theme-blue .paginationjs-pages li{border-color: #289de9;}.paginationjs:not(.custom-paginationjs).paginationjs-theme-blue .paginationjs-pages li > a{color: #289de9;}.paginationjs:not(.custom-paginationjs).paginationjs-theme-blue .paginationjs-pages li > a:hover{background: #e9f4fc;}.paginationjs:not(.custom-paginationjs).paginationjs-theme-blue .paginationjs-pages li.active > a{background: #289de9; color: #fff;}.paginationjs:not(.custom-paginationjs).paginationjs-theme-blue .paginationjs-pages li.disabled > a:hover{background: none;}.paginationjs:not(.custom-paginationjs).paginationjs-theme-blue .paginationjs-go-input > input[type="text"]{border-color: #289de9;}.paginationjs:not(.custom-paginationjs).paginationjs-theme-blue .paginationjs-go-button > input[type="button"]{background: #289de9; border-color: #289de9; color: #fff;}.paginationjs:not(.custom-paginationjs).paginationjs-theme-blue .paginationjs-go-button > input[type="button"]:hover{background-color: #3ca5ea;}.paginationjs:not(.custom-paginationjs).paginationjs-theme-green .paginationjs-pages li{border-color: #449d44;}.paginationjs:not(.custom-paginationjs).paginationjs-theme-green .paginationjs-pages li > a{color: #449d44;}.paginationjs:not(.custom-paginationjs).paginationjs-theme-green .paginationjs-pages li > a:hover{background: #ebf4eb;}.paginationjs:not(.custom-paginationjs).paginationjs-theme-green .paginationjs-pages li.active > a{background: #449d44; color: #fff;}.paginationjs:not(.custom-paginationjs).paginationjs-theme-green .paginationjs-pages li.disabled > a:hover{background: none;}.paginationjs:not(.custom-paginationjs).paginationjs-theme-green .paginationjs-go-input > input[type="text"]{border-color: #449d44;}.paginationjs:not(.custom-paginationjs).paginationjs-theme-green .paginationjs-go-button > input[type="button"]{background: #449d44; border-color: #449d44; color: #fff;}.paginationjs:not(.custom-paginationjs).paginationjs-theme-green .paginationjs-go-button > input[type="button"]:hover{background-color: #55a555;}.paginationjs:not(.custom-paginationjs).paginationjs-theme-yellow .paginationjs-pages li{border-color: #ec971f;}.paginationjs:not(.custom-paginationjs).paginationjs-theme-yellow .paginationjs-pages li > a{color: #ec971f;}.paginationjs:not(.custom-paginationjs).paginationjs-theme-yellow .paginationjs-pages li > a:hover{background: #fdf5e9;}.paginationjs:not(.custom-paginationjs).paginationjs-theme-yellow .paginationjs-pages li.active > a{background: #ec971f; color: #fff;}.paginationjs:not(.custom-paginationjs).paginationjs-theme-yellow .paginationjs-pages li.disabled > a:hover{background: none;}.paginationjs:not(.custom-paginationjs).paginationjs-theme-yellow .paginationjs-go-input > input[type="text"]{border-color: #ec971f;}.paginationjs:not(.custom-paginationjs).paginationjs-theme-yellow .paginationjs-go-button > input[type="button"]{background: #ec971f; border-color: #ec971f; color: #fff;}.paginationjs:not(.custom-paginationjs).paginationjs-theme-yellow .paginationjs-go-button > input[type="button"]:hover{background-color: #eea135;}.paginationjs:not(.custom-paginationjs).paginationjs-theme-red .paginationjs-pages li{border-color: #c9302c;}.paginationjs:not(.custom-paginationjs).paginationjs-theme-red .paginationjs-pages li > a{color: #c9302c;}.paginationjs:not(.custom-paginationjs).paginationjs-theme-red .paginationjs-pages li > a:hover{background: #faeaea;}.paginationjs:not(.custom-paginationjs).paginationjs-theme-red .paginationjs-pages li.active > a{background: #c9302c; color: #fff;}.paginationjs:not(.custom-paginationjs).paginationjs-theme-red .paginationjs-pages li.disabled > a:hover{background: none;}.paginationjs:not(.custom-paginationjs).paginationjs-theme-red .paginationjs-go-input > input[type="text"]{border-color: #c9302c;}.paginationjs:not(.custom-paginationjs).paginationjs-theme-red .paginationjs-go-button > input[type="button"]{background: #c9302c; border-color: #c9302c; color: #fff;}.paginationjs:not(.custom-paginationjs).paginationjs-theme-red .paginationjs-go-button > input[type="button"]:hover{background-color: #ce4541;}';b("head").append('")}}"undefined"==typeof b&&c("Pagination requires jQuery.");var f="pagination",g="addHook",h="__pagination-";b.fn.pagination&&(f="pagination2"),b.fn[f]=function(f){if("undefined"==typeof f)return this;var g=b(this),i={initialize:function(){var a=this;if(g.data("pagination")||g.data("pagination",{}),a.callHook("beforeInit")!==!1){g.data("pagination").initialized&&b(".paginationjs",g).remove(),k.inlineStyle===!0&&e();var c=a.model={pageRange:k.pageRange,pageSize:k.pageSize};a.parseDataSource(k.dataSource,function(d){a.sync=b.isArray(d),a.sync&&(c.totalNumber=k.totalNumber=d.length),c.totalPage=a.getTotalPage();var e=a.render(!0);k.className&&e.addClass(k.className),c.el=e,g["bottom"===k.position?"append":"prepend"](e),a.observer(),g.data("pagination").initialized=!0,a.callHook("afterInit",e)})}},render:function(a){var c=this,d=c.model,e=d.el||b('
'),f=a!==!0;c.callHook("beforeRender",f);var g=d.pageNumber||k.pageNumber,h=k.pageRange,i=d.totalPage,j=g-h,l=g+h;return l>i&&(l=i,j=i-2*h,j=1>j?1:j),1>=j&&(j=1,l=Math.min(2*h+1,i)),e.html(c.createTemplate({currentPage:g,pageRange:h,totalPage:i,rangeStart:j,rangeEnd:l})),c.callHook("afterRender",f),e},createTemplate:function(a){var c,d,e=this,f=a.currentPage,g=a.totalPage,h=a.rangeStart,i=a.rangeEnd,j=k.totalNumber,l=k.showPrevious,m=k.showNext,n=k.showPageNumbers,o=k.showNavigator,p=k.showGoInput,q=k.showGoButton,r=k.pageLink,s=k.prevText,t=k.nextText,u=k.ellipsisText,v=k.goButtonText,w=k.classPrefix,x=k.activeClassName,y=k.disableClassName,z=k.ulClassName,A=b.isFunction(k.formatNavigator)?k.formatNavigator():k.formatNavigator,B=b.isFunction(k.formatGoInput)?k.formatGoInput():k.formatGoInput,C=b.isFunction(k.formatGoButton)?k.formatGoButton():k.formatGoButton,D=b.isFunction(k.autoHidePrevious)?k.autoHidePrevious():k.autoHidePrevious,E=b.isFunction(k.autoHideNext)?k.autoHideNext():k.autoHideNext,F=b.isFunction(k.header)?k.header():k.header,G=b.isFunction(k.footer)?k.footer():k.footer,H="",I='',J='';if(F&&(c=e.replaceVariables(F,{currentPage:f,totalPage:g,totalNumber:j}),H+=c),l||n||m){if(H+='
',H+=z?'
"}return o&&A&&(c=e.replaceVariables(A,{currentPage:f,totalPage:g,totalNumber:j}),H+='
'+c+"
"),p&&B&&(c=e.replaceVariables(B,{currentPage:f,totalPage:g,totalNumber:j,input:I}),H+='
'+c+"
"),q&&C&&(c=e.replaceVariables(C,{currentPage:f,totalPage:g,totalNumber:j,button:J}),H+='
'+c+"
"),G&&(c=e.replaceVariables(G,{currentPage:f,totalPage:g,totalNumber:j}),H+=c),H},go:function(a,c){function d(a){if(f.direction="undefined"==typeof f.pageNumber?0:h>f.pageNumber?1:-1,f.pageNumber=h,e.render(),e.disabled&&!e.sync&&e.enable(),g.data("pagination").model=f,b.isFunction(k.formatResult)){var d=b.extend(!0,[],a);b.isArray(a=k.formatResult(d))||(a=d)}g.data("pagination").currentPageData=a,e.callHook("beforePaging"),e.doCallback(a,c),e.callHook("afterPaging"),1==h&&e.callHook("afterIsFirstPage"),h==f.totalPage&&e.callHook("afterIsLastPage")}var e=this,f=e.model;if(!e.disabled){var h=a,i=k.pageSize,j=f.totalPage;if(h=parseInt(h),!(!h||1>h||h>j)){if(e.sync)return void d(e.getDataSegment(h));var l={},m=k.alias||{};l[m.pageSize?m.pageSize:"pageSize"]=i,l[m.pageNumber?m.pageNumber:"pageNumber"]=h;var n={type:"get",cache:!1,data:{},contentType:"application/x-www-form-urlencoded; charset=UTF-8",dataType:"json",async:!0};b.extend(!0,n,k.ajax),b.extend(n.data||{},l),n.url=k.dataSource,n.success=function(a){d(e.filterDataByLocator(a))},n.error=function(a,b,c){k.formatAjaxError&&k.formatAjaxError(a,b,c),e.enable()},e.disable(),b.ajax(n)}}},doCallback:function(a,c){var d=this,e=d.model;b.isFunction(c)?c(a,e):b.isFunction(k.callback)&&k.callback(a,e)},destroy:function(){this.callHook("beforeDestroy")!==!1&&(this.model.el.remove(),g.off(),b("#paginationjs-style").remove(),this.callHook("afterDestroy"))},previous:function(a){this.go(this.model.pageNumber-1,a)},next:function(a){this.go(this.model.pageNumber+1,a)},disable:function(){var a=this,b=a.sync?"sync":"async";a.callHook("beforeDisable",b)!==!1&&(a.disabled=!0,a.model.disabled=!0,a.callHook("afterDisable",b))},enable:function(){var a=this,b=a.sync?"sync":"async";a.callHook("beforeEnable",b)!==!1&&(a.disabled=!1,a.model.disabled=!1,a.callHook("afterEnable",b))},show:function(){var a=this;a.model.el.is(":visible")||a.model.el.show()},hide:function(){var a=this;a.model.el.is(":visible")&&a.model.el.hide()},replaceVariables:function(a,b){var c;for(var d in b){var e=b[d],f=new RegExp("<%=\\s*"+d+"\\s*%>","img");c=(c||a).replace(f,e)}return c},getDataSegment:function(a){var b=k.pageSize,c=k.dataSource,d=k.totalNumber,e=b*(a-1)+1,f=Math.min(a*b,d);return c.slice(e-1,f)},getTotalPage:function(){return Math.ceil(k.totalNumber/k.pageSize)},getLocator:function(a){var d;return"string"==typeof a?d=a:b.isFunction(a)?d=a():c('"locator" is incorrect. (String | Function)'),d},filterDataByLocator:function(a){var d,e=this.getLocator(k.locator);if(b.isObject(a)){try{b.each(e.split("."),function(b,c){d=(d?d:a)[c]})}catch(f){}d?b.isArray(d)||c("dataSource."+e+" must be an Array."):c("dataSource."+e+" is undefined.")}return d||a},parseDataSource:function(a,d){var e=this,f=arguments;b.isObject(a)?d(k.dataSource=e.filterDataByLocator(a)):b.isArray(a)?d(k.dataSource=a):b.isFunction(a)?k.dataSource(function(a){b.isFunction(a)&&c('Unexpect parameter of the "done" Function.'),f.callee.call(e,a,d)}):"string"==typeof a?(/^https?|file:/.test(a)&&(k.ajaxDataType="jsonp"),d(a)):c('Unexpect data type of the "dataSource".')},callHook:function(c){var d,e=g.data("pagination"),f=Array.prototype.slice.apply(arguments);return f.shift(),k[c]&&b.isFunction(k[c])&&k[c].apply(a,f)===!1&&(d=!1),e.hooks&&e.hooks[c]&&b.each(e.hooks[c],function(b,c){c.apply(a,f)===!1&&(d=!1)}),d!==!1},observer:function(){var a=this,d=a.model.el;g.on(h+"go",function(d,e,f){e=parseInt(b.trim(e)),e&&(b.isNumeric(e)||c('"pageNumber" is incorrect. (Number)'),a.go(e,f))}),d.delegate(".J-paginationjs-page","click",function(c){var d=b(c.currentTarget),e=b.trim(d.attr("data-num"));return!e||d.hasClass(k.disableClassName)||d.hasClass(k.activeClassName)?void 0:a.callHook("beforePageOnClick",c)===!1?!1:(a.go(e),a.callHook("afterPageOnClick",c),k.pageLink?void 0:!1)}),d.delegate(".J-paginationjs-previous","click",function(c){var d=b(c.currentTarget),e=b.trim(d.attr("data-num"));return e&&!d.hasClass(k.disableClassName)?a.callHook("beforePreviousOnClick",c)===!1?!1:(a.go(e),a.callHook("afterPreviousOnClick",c),k.pageLink?void 0:!1):void 0}),d.delegate(".J-paginationjs-next","click",function(c){var d=b(c.currentTarget),e=b.trim(d.attr("data-num"));return e&&!d.hasClass(k.disableClassName)?a.callHook("beforeNextOnClick",c)===!1?!1:(a.go(e),a.callHook("afterNextOnClick",c),k.pageLink?void 0:!1):void 0}),d.delegate(".J-paginationjs-go-button","click",function(){var c=b(".J-paginationjs-go-pagenumber",d).val();return a.callHook("beforeGoButtonOnClick",event,c)===!1?!1:(g.trigger(h+"go",c),void a.callHook("afterGoButtonOnClick",event,c))}),d.delegate(".J-paginationjs-go-pagenumber","keyup",function(c){if(13===c.which){var e=b(c.currentTarget).val();if(a.callHook("beforeGoInputOnEnter",c,e)===!1)return!1;g.trigger(h+"go",e),b(".J-paginationjs-go-pagenumber",d).focus(),a.callHook("afterGoInputOnEnter",c,e)}}),g.on(h+"previous",function(b,c){a.previous(c)}),g.on(h+"next",function(b,c){a.next(c)}),g.on(h+"disable",function(){a.disable()}),g.on(h+"enable",function(){a.enable()}),g.on(h+"show",function(){a.show()}),g.on(h+"hide",function(){a.hide()}),g.on(h+"destroy",function(){a.destroy()}),(i.sync||k.triggerPagingOnInit)&&g.trigger(h+"go",Math.min(k.pageNumber,a.model.totalPage))}};if(g.data("pagination")&&g.data("pagination").initialized===!0){if(b.isNumeric(f))return g.trigger.call(this,h+"go",f,arguments[1]),this;if("string"==typeof f){var j=Array.prototype.slice.apply(arguments);switch(j[0]=h+j[0],f){case"previous":case"next":case"go":case"disable":case"enable":case"show":case"hide":case"destroy":g.trigger.apply(this,j);break;case"getSelectedPageNum":return g.data("pagination").model?g.data("pagination").model.pageNumber:g.data("pagination").attributes.pageNumber;case"getTotalPage":return g.data("pagination").model.totalPage;case"getSelectedPageData":return g.data("pagination").currentPageData;case"isDisabled":return g.data("pagination").model.disabled===!0;default:c("Pagination do not provide action: "+f)}return this}c("invalid action: "+f)}else b.isObject(f)||c("options is illegal");var k=b.extend({},arguments.callee.defaults,f);return d(k),i.initialize(),this},b.fn[f].defaults={locator:"data",totalNumber:1,pageNumber:1,pageSize:10,pageRange:2,showPrevious:!0,showNext:!0,showPageNumbers:!0,showNavigator:!1,showGoInput:!1,showGoButton:!1,pageLink:"",prevText:"«",nextText:"»",ellipsisText:"...",goButtonText:"Go",classPrefix:"paginationjs",activeClassName:"active",disableClassName:"disabled",inlineStyle:!0,formatNavigator:"<%= currentPage %> / <%= totalPage %>",formatGoInput:"<%= input %>",formatGoButton:"<%= button %>",position:"bottom",autoHidePrevious:!1,autoHideNext:!1,triggerPagingOnInit:!0,showFirstOnEllipsisShow:!0,showLastOnEllipsisShow:!0,callback:function(){}},b.fn[g]=function(a,d){arguments.length<2&&c("Missing argument."),b.isFunction(d)||c("callback must be a function.");var e=b(this),f=e.data("pagination");f||(e.data("pagination",{}),f=e.data("pagination")),!f.hooks&&(f.hooks={}),f.hooks[a]=f.hooks[a]||[],f.hooks[a].push(d)},b[f]=function(a,d){arguments.length<2&&c("Requires two parameters.");var e;return e="string"!=typeof a&&a instanceof jQuery?a:b(a),e.length?(e.pagination(d),e):void 0},b.each(["Object","Array","Function"],function(a,c){b["is"+c]=function(a){return toString.call(a)==="[object "+c+"]"}}),"function"==typeof define&&(define.amd||define.cmd)&&define(function(){return b})}(this,window.jQuery); \ No newline at end of file