PageSourceSearch

https://peoplemedia.tw/javascripts/jquery.simplePagination.js

js peoplemedia.tw collected 2026-10-02 12:00:26 UTC 4,274 bytes, 1 lines download raw bytes

1!function(p){var g={init:function(e){var t=p.extend({items:1,itemsOnPage:1,pages:0,displayedPages:5,edges:2,currentPage:1,hrefTextPrefix:"#page-",hrefTextSuffix:"",prevText:"Prev",nextText:"Next",ellipseText:"&hellip;",cssStyle:"light-theme",labelMap:[],selectOnClick:!0,nextAtFront:!1,onPageClick:function(e,t){},onInit:function(){}},e||{}),a=this;return t.pages=t.pages||(Math.ceil(t.items/t.itemsOnPage)?Math.ceil(t.items/t.itemsOnPage):1),t.currentPage=t.currentPage-1,t.halfDisplayed=t.displayedPages/2,this.each(function(){a.addClass(t.cssStyle+" simple-pagination").data("pagination",t),g._draw.call(a)}),t.onInit(),this},selectPage:function(e){return g._selectPage.call(this,e-1),this},prevPage:function(){var e=this.data("pagination");return 0<e.currentPage&&g._selectPage.call(this,e.currentPage-1),this},nextPage:function(){var e=this.data("pagination");return e.currentPage<e.pages-1&&g._selectPage.call(this,e.currentPage+1),this},getPagesCount:function(){return this.data("pagination").pages},getCurrentPage:function(){return this.data("pagination").currentPage+1},destroy:function(){return this.empty(),this},drawPage:function(e){var t=this.data("pagination");return t.currentPage=e-1,this.data("pagination",t),g._draw.call(this),this},redraw:function(){return g._draw.call(this),this},disable:function(){var e=this.data("pagination");return e.disabled=!0,this.data("pagination",e),g._draw.call(this),this},enable:function(){var e=this.data("pagination");return e.disabled=!1,this.data("pagination",e),g._draw.call(this),this},updateItems:function(e){var t=this.data("pagination");t.items=e,t.pages=g._getPages(t),this.data("pagination",t),g._draw.call(this)},updateItemsOnPage:function(e){var t=this.data("pagination");return t.itemsOnPage=e,t.pages=g._getPages(t),this.data("pagination",t),g._selectPage.call(this,0),this},_draw:function(){var e=this.data("pagination"),t=g._getInterval(e),a=(g.destroy.call(this),"UL"===("function"==typeof this.prop?this.prop("tagName"):this.attr("tagName"))?this:p("<ul></ul>").appendTo(this));if(e.prevText&&g._appendItem.call(this,e.currentPage-1,{text:e.prevText,classes:"prev"}),e.nextText&&e.nextAtFront&&g._appendItem.call(this,e.currentPage+1,{text:e.nextText,classes:"next"}),0<t.start&&0<e.edges){for(var n=Math.min(e.edges,t.start),s=0;s<n;s++)g._appendItem.call(this,s);e.edges<t.start&&t.start-e.edges!=1?a.append('<li class="disabled"><span class="ellipse">'+e.ellipseText+"</span></li>"):t.start-e.edges==1&&g._appendItem.call(this,e.edges)}for(s=t.start;s<t.end;s++)g._appendItem.call(this,s);if(t.end<e.pages&&0<e.edges)for(e.pages-e.edges>t.end&&e.pages-e.edges-t.end!=1?a.append('<li class="disabled"><span class="ellipse">'+e.ellipseText+"</span></li>"):e.pages-e.edges-t.end==1&&g._appendItem.call(this,t.end++),s=Math.max(e.pages-e.edges,t.end);s<e.pages;s++)g._appendItem.call(this,s);e.nextText&&!e.nextAtFront&&g._appendItem.call(this,e.currentPage+1,{text:e.nextText,classes:"next"})},_getPages:function(e){return Math.ceil(e.items/e.itemsOnPage)||1},_getInterval:function(e){return{start:Math.ceil(e.currentPage>e.halfDisplayed?Math.max(Math.min(e.currentPage-e.halfDisplayed,e.pages-e.displayedPages),0):0),end:Math.ceil(e.currentPage>e.halfDisplayed?Math.min(e.currentPage+e.halfDisplayed,e.pages):Math.min(e.displayedPages,e.pages))}},_appendItem:function(t,e){var a,n=this,s=n.data("pagination"),i=p("<li></li>"),l=n.find("ul"),r={text:(t=t<0?0:t<s.pages?t:s.pages-1)+1,classes:""};s.labelMap.length&&s.labelMap[t]&&(r.text=s.labelMap[t]),r=p.extend(r,e||{}),t==s.currentPage||s.disabled?(s.disabled?i.addClass("disabled"):i.addClass("active"),a=p('<span class="current">'+r.text+"</span>")):(a=p('<a href="'+s.hrefTextPrefix+(t+1)+s.hrefTextSuffix+'" class="page-link">'+r.text+"</a>")).click(function(e){return g._selectPage.call(n,t,e)}),r.classes&&a.addClass(r.classes),i.append(a),(l.length?l:n).append(i)},_selectPage:function(e,t){var a=this.data("pagination");return a.currentPage=e,a.selectOnClick&&g._draw.call(this),a.onPageClick(e+1,t)}};p.fn.pagination=function(e){return g[e]&&"_"!=e.charAt(0)?g[e].apply(this,Array.prototype.slice.call(arguments,1
1)):"object"!=typeof e&&e?void p.error("Method "+e+" does not exist on jQuery.pagination"):g.init.apply(this,arguments)}}(jQuery);

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.