/*! layPage-v1.3.0 分页组件 License MIT http://laypage.layui.com/ By 贤心 */ !function(){"use strict";function t(u){var f="laypagecss";t.dir="dir"in t?t.dir:n.getpath+"/skin/laypage.min.css";new n(u);t.dir&&!i[r](f)&&n.use(t.dir,f)}t.v="1.3";var i=document,r="getElementById",u="getElementsByTagName",f=0,n=function(n){var t=this,i=t.config=n||{};i.item=f++;t.render(!0)};n.on=function(t,i,r){return t.attachEvent?t.attachEvent("on"+i,function(){r.call(t,window.even)}):t.addEventListener(i,r,!1),n};n.getpath=function(){var n=document.scripts,t=n[n.length-1].src;return t.substring(0,t.lastIndexOf("/")+1)}();n.use=function(n,r){var f=i.createElement("link");f.type="text/css";f.rel="stylesheet";f.href=t.dir;r&&(f.id=r);i[u]("head")[0].appendChild(f);f=null};n.prototype.type=function(){var n=this.config;if("object"==typeof n.cont)return void 0===n.cont.length?2:3};n.prototype.view=function(){var u=this,n=u.config,r=[],i={};if(n.pages=0|n.pages,n.curr=0|n.curr||1,n.groups="groups"in n?0|n.groups:5,n.first="first"in n?n.first:"首页",n.last="last"in n?n.last:"尾页",n.prev="prev"in n?n.prev:"上一页",n.next="next"in n?n.next:"下一页",n.pages<=1)return"";for(n.groups>n.pages&&(n.groups=n.pages),i.index=Math.ceil((n.curr+(n.groups>1&&n.groups!==n.pages?1:0))/(0===n.groups?1:n.groups)),n.curr>1&&n.prev&&r.push(''+n.prev+"<\/a>"),i.index>1&&n.first&&0!==n.groups&&r.push(''+n.first+"<\/a>…<\/span>"),i.poor=Math.floor((n.groups-1)/2),i.start=i.index>1?n.curr-i.poor:1,i.end=i.index>1?function(){var t=n.curr+(n.groups-i.poor-1);return t>n.pages?n.pages:t}():n.groups,i.end-i.start"+i.start+"<\/span>"):r.push(''+i.start+"<\/a>");return n.pages>n.groups&&i.end…<\/span>'+n.last+"<\/a>"),i.flow=!n.prev&&0===n.groups,(n.curr!==n.pages&&n.next||i.flow)&&r.push(function(){return i.flow&&n.curr===n.pages?''+n.next+"<\/span>":''+n.next+"<\/a>"}()),''+r.join("")+function(){return n.skip?'到第<\/label>页<\/label>确定<\/button><\/span>':""}()+"<\/div>"};n.prototype.jump=function(t){if(t){for(var r=this,f=r.config,e=t.children,o=t[u]("button")[0],s=t[u]("input")[0],i=0,h=e.length;h>i;i++)"a"===e[i].nodeName.toLowerCase()&&n.on(e[i],"click",function(){var n=0|this.getAttribute("data-page");f.curr=n;r.render()});o&&n.on(o,"click",function(){var n=0|s.value.replace(/\s|\D/g,"");n&&n<=f.pages&&(f.curr=n,r.render())})}};n.prototype.render=function(n){var u=this,t=u.config,e=u.type(),f=u.view();2===e?t.cont.innerHTML=f:3===e?t.cont.html(f):i[r](t.cont).innerHTML=f;t.jump&&t.jump(t,n);u.jump(i[r]("laypage_"+t.item));t.hash&&!n&&(location.hash="!"+t.hash+"="+t.curr)};"function"==typeof define?define(function(){return t}):"undefined"!=typeof exports?module.exports=t:window.laypage=t}(); //# sourceMappingURL=laypage.min.js.map