代码拉取完成,页面将自动刷新
/**
*
* 暂为找到开源地址,作项目备份记录
*
*/
!
function(a) {
var e = function(b, c) {
this.ele = b, this.defaults = {
//currentPage: 1,
totalPage: 10,
isShow: !0,
count: 5,
homePageText: "首页",
endPageText: "尾页",
prevPageText: ">>",
nextPageText: "<<",
callback: function() {}
}, this.opts = a.extend({}, this.defaults, c), this.current = this.opts.currentPage, this.total = this.opts.totalPage, this.init()
};
e.prototype = {
init: function() {
this.render(), this.eventBind()
},
render: function() {
var a = this.opts,
b = this.current,
c = this.total,
d = this.getPagesTpl(),
e = this.ele.empty();
this.isRender = !0,
this.homePage = '<a href="javascript:void(0);" class="ui-pagination-page-item" data-current="1">' + a.homePageText + "</a>",
this.prevPage = '<a href="javascript:void(0);" class="ui-pagination-page-item" data-current="' + (b - 1) + '">' + a.prevPageText + "</a>",
this.nextPage = '<a href="javascript:void(0);" class="ui-pagination-page-item" data-current="' + (b + 1) + '">' + a.nextPageText + "</a>",
this.endPage = '<a href="javascript:void(0);" class="ui-pagination-page-item" data-current="' + c + '">' + a.endPageText + "</a>",
this.pagego = '<span class="zuandao">转到:</span>'+ '<input type="text" placeholder="0" class="yema" /><a class="ui-pagination-page-btn tizym" href="javascript:void(0);">GO</a>',
this.checkPage(), this.isRender && e.html("<div class='ui-pagination-container'>" + this.homePage + this.prevPage + d + this.nextPage + this.endPage + this.pagego+"</div>")
},
checkPage: function() {
var a = this.opts,
b = this.total,
c = this.current;
a.isShow || (this.homePage = this.endPage = ""), 1 === c && (this.homePage = this.prevPage = ""), c === b && (this.endPage = this.nextPage = ""), 1 === b && (this.homePage = this.prevPage = this.endPage = this.nextPage = ""), 1 >= b && (this.isRender = !1)
},
getPagesTpl: function() {
var f, g, h, i, j, k, a = this.opts,
b = this.total,
c = this.current,
d = "",
e = a.count;
if (e >= b) for (k = 1; b >= k; k++) d += k === c ?
'<a href="javascript:void(0);" class="ui-pagination-page-item active" data-current="' + k + '">' + k + "</a>" :
'<a href="javascript:void(0);" class="ui-pagination-page-item" data-current="' + k + '">' + k + "</a>";
else if (f = e / 2, f >= c) for (k = 1; e >= k; k++) d += k === c ?
'<a href="javascript:void(0);" class="ui-pagination-page-item active" data-current="' + k + '">' + k + "</a>" :
'<a href="javascript:void(0);" class="ui-pagination-page-item" data-current="' + k + '">' + k + "</a>";
else for (g = Math.floor(f), h = c + g, i = c - g, j = 0 == e % 2, h > b && (j ? (i -= h - b - 1, h = b + 1) : (i -= h - b, h = b)), j || h++, k = i; h > k; k++) d += k === c ?
'<a href="javascript:void(0);" class="ui-pagination-page-item active" data-current="' + k + '">' + k + "</a>" :
'<a href="javascript:void(0);" class="ui-pagination-page-item" data-current="' + k + '">' + k + "</a>";
return d
//+'<span class="zuandao">转到:</span>'+ '<input type="text" placeholder="1" class="yema" /><a class="ui-pagination-page-btn tizym" href="javascript:void(0);">GO</a>'
},
setPage: function(a, b) {
return a === this.current && b === this.total ? this.ele : (this.current = a, this.total = b, this.render(), this.ele)
},
getPage: function() {
return {
current: this.current,
total: this.total
}
},
eventBind: function() {
var b = this.total,
c = this,
d = this.opts.callback;
this.ele.off("click").on("click", ".ui-pagination-page-item", function() {
var b = a(this).data("current");
c.current != b && (c.current = b, c.render(), d && "function" == typeof d && d(b))
}).on("click", ".ui-pagination-page-btn", function() {
var e = parseInt(a(this)[0].parentNode.getElementsByTagName("input")[0].value);
e && "NaN" != e && e > 0 && c.current != e && b >= e && (c.current = e, c.render(), d && "function" == typeof d && d(e))
})
}
}, a.fn.pagination = function(a, b, c) {
if ("object" == typeof a) {
var d = new e(this, a);
this.data("pagination", d)
}
return "string" == typeof a ? this.data("pagination")[a](b, c) : this
}
}(jQuery, window, document);
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。