vendor: 4,350 bytes, lines 1-8
1/*! 2 * jQuery pagination plugin v1.4.1 3 * http://esimakin.github.io/twbs-pagination/ 4 * 5 * Copyright 2014-2016, Eugene Simakin 6 * Released under Apache 2.0 license 7 * http://apache.org/licenses/LICENSE-2.0.html 8 */(function(a,l,g,h){"use strict";var p=a.fn.twbsPagination,r=function(t,i){if(this.$element=a(t),this.options=a.extend({},a.fn.twbsPagination.defaults,i),this.options.startPage<1||this.options.startPage>this.options.totalPages)throw new Error("Start page option is incorrect");if(this.options.totalPages=parseInt(this.options.totalPages),isNaN(this.options.totalPages))throw new Error("Total pages option is not correct!");if(this.options.visiblePages=parseInt(this.options.visiblePages),isNaN(this.options.visiblePages))throw new Error("Visible pages option is not correct!");if(this.options.onPageClick instanceof Function&&this.$element.first().on("page",this.options.onPageClick),this.options.hideOnlyOnePage&&this.options.totalPages==1)return this.$element.trigger("page",1),this;this.options.totalPages<this.options.visiblePages&&(this.options.visiblePages=this.options.totalPages),this.options.href&&(this.options.startPage=this.getPageFromQueryString(),this.options.startPage||(this.options.startPage=1));var e=typeof this.$element.prop=="function"?this.$element.prop("tagName"):this.$element.attr("tagName");return e==="UL"?this.$listContainer=this.$element:this.$listContainer=a("<ul></ul>"),this.$listContainer.addClass(this.options.paginationClass),e!=="UL"&&this.$element.append(this.$listContainer),this.options.initiateStartPageClick?this.show(this.options.startPage):(this.currentPage=this.options.startPage,this.render(this.getPages(this.options.startPage)),this.setupEvents()),this};r.prototype={constructor:r,destroy:function(){return this.$element.empty(),this.$element.removeData("twbs-pagination"),this.$element.off("page"),this},show:function(t){if(t<1||t>this.options.totalPages)throw new Error("Page is incorrect.");return this.currentPage=t,this.render(this.getPages(t)),this.setupEvents(),this.$element.trigger("page",t),this},enable:function(){this.show(this.currentPage)},disable:function(){var t=this;this.$listContainer.off("click").on("click","li",function(i){i.preventDefault()}),this.$listContainer.children().each(function(){var i=a(this);i.hasClass(t.options.activeClass)||a(this).addClass(t.options.disabledClass)})},buildListItems:function(t){var i=[];if(this.options.first&&i.push(this.buildItem("first",1)),this.options.prev){var e=t.currentPage>1?t.currentPage-1:this.options.loop?this.options.totalPages:1;i.push(this.buildItem("prev",e))}for(var s=0;s<t.numeric.length;s++)i.push(this.buildItem("page",t.numeric[s]));if(this.options.next){var n=t.currentPage<this.options.totalPages?t.currentPage+1:this.options.loop?1:this.options.totalPages;i.push(this.buildItem("next",n))}return this.options.last&&i.push(this.buildItem("last",this.options.totalPages)),i},buildItem:function(t,i){var e=a("<li></li>"),s=a("<a></a>"),n=this.options[t]?this.makeText(this.options[t],i):i;return e.addClass(this.options[t+"Class"]),e.data("page",i),e.data("page-type",t),e.append(s.attr("href",this.makeHref(i)).addClass(this.options.anchorClass).html(n)),e},getPages:function(t){var i=[],e=Math.floor(this.options.visiblePages/2),s=t-e+1-this.options.visiblePages%2,n=t+e;s<=0&&(s=1,n=this.options.visiblePages),n>this.options.totalPages&&(s=this.options.totalPages-this.options.visiblePages+1,n=this.options.totalPages);for(var o=s;o<=n;)i.push(o),o++;return{currentPage:t,numeric:i}},render:function(t){var i=this;this.$listContainer.children().remove();var e=this.buildListItems(t);a.each(e,function(s,n){i.$listContainer.append(n)}),this.$listContainer.children().each(function(){var s=a(this),n=s.data("page-type");switch(n){case"page":s.data("page")===t.currentPage&&s.addClass(i.options.activeClass);break;case"first":s.toggleClass(i.options.disabledClass,t.currentPage===1);break;case"last":s.toggleClass(i.options.disabledClass,t.currentPage===i.options.totalPages);break;case"prev":s.toggleClass(i.options.disabledClass,!i.options.loop&&t.currentPage===1);break;case"next":s.toggleClass(i.options.disabledClass,!i.options.loop&&t.currentPage===i.options.totalPages);break;default:break}})},setupEvents:function(){var t=this;this.$listContainer.off("click").on("click","li",function(i){var e=a(this);
8if(e.hasClass(t.options.disabledClass)||e.hasClass(t.options.activeClass))return!1;!t.options.href&&i.preventDefault(),t.show(parseInt(e.data("page")))})},makeHref:function(t){return this.options.href?this.generateQueryString(t):"#"},makeText:function(t,i){return t.replace(this.options.pageVariable,i).replace(this.options.totalPagesVariable,this.options.totalPages)},getPageFromQueryString:function(t){var i=this.getSearchString(t),e=new RegExp(this.options.pageVariable+"(=([^&#]*)|&|#|$)"),s=e.exec(i);return!s||!s[2]||(s=decodeURIComponent(s[2]),s=parseInt(s),isNaN(s))?null:s},generateQueryString:function(t,i){var e=this.getSearchString(i),s=new RegExp(this.options.pageVariable+"=*[^&#]*");return e?"?"+e.replace(s,this.options.pageVariable+"="+t):""},getSearchString:function(t){var i=t||l.location.search;return i===""?null:(i.indexOf("?")===0&&(i=i.substr(1)),i)},getCurrentPage:function(){return this.currentPage}},a.fn.twbsPagination=function(t){var i=Array.prototype.slice.call(arguments,1),e,s=a(this),n=s.data("twbs-pagination"),o=typeof t=="object"?t:{};return n||s.data("twbs-pagination",n=new r(this,o)),typeof t=="string"&&(e=n[t].apply(n,i)),e===h?s:e},a.fn.twbsPagination.defaults={totalPages:1,startPage:1,visiblePages:5,initiateStartPageClick:!0,hideOnlyOnePage:!1,href:!1,pageVariable:"{{page}}",totalPagesVariable:"{{total_pages}}",page:null,first:"First",prev:"Previous",next:"Next",last:"Last",loop:!1,onPageClick:null,paginationClass:"pagination",nextClass:"page-item next",prevClass:"page-item prev",lastClass:"page-item last",firstClass:"page-item first",pageClass:"page-item",activeClass:"active",disabledClass:"disabled",anchorClass:"page-link"},a.fn.twbsPagination.Constructor=r,a.fn.twbsPagination.noConflict=function(){return a.fn.twbsPagination=p,this},a.fn.twbsPagination.version="1.4.1"})(window.jQuery,window,document); 9//# sourceMappingURL=jquery.twbsPagination.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.