SheQu/Content/B-UI/BJUI/js/bjui-pagination.js
(开头部分) 10KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
/*!
* B-JUI v1.0 (http://b-jui.com)
* Git@OSC (http://git.oschina.net/xknaan/B-JUI)
* Copyright 2014 K'naan (xknaan@163.com).
* Licensed under Apache (http://www.apache.org/licenses/LICENSE-2.0)
*/
/* ========================================================================
* B-JUI: bjui-pagination.js v1.0
* @author K'naan (xknaan@163.com)
* -- Modified from dwz.pagination.js (author:ZhangHuihua@msn.com)
* http://git.oschina.net/xknaan/B-JUI/blob/master/BJUI/js/bjui-pagination.js
* ========================================================================
* Copyright 2014 K'naan.
* Licensed under Apache (http://www.apache.org/licenses/LICENSE-2.0)
* ======================================================================== */
+function ($) {
'use strict';
// PAGINATION CLASS DEFINITION
// ======================
var Pagination = function(element, options) {
this.$element = $(element)
this.options = options
this.tools = this.TOOLS()
}
Pagination.DEFAULTS = {
first : 'li.j-first',
prev : 'li.j-prev',
next : 'li.j-next',
last : 'li.j-last',
nums : 'li.j-num > a',
jump : 'li.jumpto',
pageNumFrag : '<li class="#liClass#"><a href="javascript:;">#pageNum#</a></li>',
total : 0,
pageSize : 10,
pageNum : 10,
pageCurrent : 1,
callback : function() { return false }
}
Pagination.prototype.TOOLS = function() {
var that = this
var options = this.options
var tools = {
pageNums: function() {
return Math.ceil(options.total / options.pageSize)
},
getInterval: function() {
var ne_half = Math.ceil(options.pageNum / 2)
var pn = this.pageNums()
var upper_limit = pn - options.pageNum
var start = this.getCurrentPage() > ne_half ? Math.max(Math.min(this.getCurrentPage() - ne_half, upper_limit), 0) : 0
var end = this.getCurrentPage() > ne_half ? Math.min(this.getCurrentPage() + ne_half, pn) : Math.min(options.pageNum, pn)
return {start: start + 1, end:end + 1}
},
后面还有 223 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读 AI
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
