!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a(jQuery)}(function(a){function b(a,b){return this.numPages=null,this.currPage=0,this.init(a,b)}function c(b){return a(['
',b,""].join(""))}b.prototype.DATA_KEY="pagination",b.prototype.defaults={startingPage:0,perPage:20,totalDataSize:null,currDataSize:null},b.prototype.init=function(a,c){return c=c||{},this.$element=a,this.options=jQuery.extend(!0,{},this.defaults,c),this.currPage=this.options.startingPage,null!==this.options.totalDataSize&&(this.numPages=Math.ceil(this.options.totalDataSize/this.options.perPage),this.currPage>=this.numPages&&(this.currPage=this.numPages-1)),this.$element.data(b.prototype.DATA_KEY,this),this._render(),this},b.prototype._render=function(){return 0===this.options.totalDataSize?this:1===this.numPages?this:(this.numPages>0?(this._renderPages(),this._scrollToActivePage()):this._renderPrevNext(),this)},b.prototype._renderPrevNext=function(){var b=this,d=c("Prev"),e=c("Next"),f=a("").addClass("pagination pagination-prev-next");return 0===this.currPage?d.addClass("disabled"):d.click(function(){b.prevPage()}),this.numPages&&this.currPage===this.numPages-1||this.options.currDataSize&&this.options.currDataSize").addClass("pagination-scroll-container"),e=a("").addClass("pagination pagination-page-list"),f=function(){b.goToPage(a(this).data("page"))},g=0;g=a&&(a=0),this.numPages&&a>=this.numPages&&(a=this.numPages-1),a===this.currPage?this:(this.currPage=a,this.$element.trigger("pagination.page-change",this.currPage),this._render(),this)},b.prototype.prevPage=function(){return this.goToPage(this.currPage-1)},b.prototype.nextPage=function(){return this.goToPage(this.currPage+1)},b.prototype.page=function(){return this.currPage},b.create=function(a,c){return new b(a,c)},jQuery.fn.extend({pagination:function(c){var d=jQuery.makeArray(arguments).slice(1);if("object"===jQuery.type(c))return this.map(function(){return b.create(a(this),c),this});var e=a(this[0]),f=e.data(b.prototype.DATA_KEY);if(f){if("string"!==jQuery.type(c))return f;var g=f[c];if("function"===jQuery.type(g))return g.apply(f,d)}return void 0}})});
//# sourceMappingURL=../../maps/ui/pagination.js.map