OpenAuth.Net/OpenAuth.Mvc/Content/scripts/plugins/pagination/jquery.pagination-1.2.7.min.js

2 lines
8.2 KiB
JavaScript
Raw Normal View History

2017-01-12 19:48:01 +08:00
/*! jQuery Pagination Plugin - v1.2.7 - 12/6/2015 | (c) 2015 Mricle , Licensed MIT , http://mricle.com/JqueryPagination */
!function (a) { "use strict"; var d, e, f, g, h, i, j, k, l, b = { pageClicked: "pageClicked", jumpClicked: "jumpClicked", pageSizeChanged: "pageSizeChanged" }, c = function (c, d) { var f, g, e = { pageSize: 10, pageBtnCount: 11, showFirstLastBtn: !0, firstBtnText: null, lastBtnText: null, prevBtnText: "&laquo;", nextBtnText: "&raquo;", loadFirstPage: !0, remote: { url: null, params: null, callback: null, success: null, beforeSend: null, complete: null, pageIndexName: "pageIndex", pageSizeName: "pageSize", totalName: "total" }, showInfo: !1, infoFormat: "{start} ~ {end} of {total} entires", showJump: !1, jumpBtnText: "Go", showPageSizes: !1, pageSizeItems: null, debug: !1 }; this.$element = a(c), this.$page = a('<ul class="m-pagination-page"></ul>'), this.$size = a('<div class="m-pagination-size"></div>'), this.$jump = a('<div class="m-pagination-jump"></div>'), this.$info = a('<div class="m-pagination-info"></div>'), this.options = a.extend(!0, {}, e, a.fn.page.defaults, d), this.total = this.options.total || 0, this.options.pageSizeItems = this.options.pageSizeItems || [5, 10, 15, 20], this.currentPageIndex = 0, this.currentPageSize = this.options.pageSize, this.pageCount = h(this.total, this.currentPageSize), null == this.options.remote.success && (this.options.remote.success = this.options.remote.callback), f = function (b) { var e, f, c = b, d = a('<select data-page-btn="size"></select>'); for (e = 0; e < c.options.pageSizeItems.length; e++) d.append('<option value="' + c.options.pageSizeItems[e] + '">' + c.options.pageSizeItems[e] + "</option>"); d.val(c.currentPageSize), c.$size.append(d), f = '<div class="m-pagination-group"><input type="text"><button data-page-btn="jump" type="button">' + c.options.jumpBtnText + "</button></div>", c.$jump.append(f), c.$jump.find("input").change(function () { j(this.value, c.pageCount) || (this.value = null) }), c.$element.append(c.$page.hide()), c.$element.append(c.$size.hide()), c.$element.append(c.$jump.hide()), c.$element.append(c.$info.hide()), c._remoteOrRedner(0), c.$element.on("click", { page: c }, function (a) { g(a) }).on("change", { page: c }, function (a) { g(a) }) }, g = function (c) { var f, g, h, d = c.data.page, e = a(c.target); "click" !== c.type || void 0 === e.data("pageIndex") || e.parent().hasClass("active") ? "click" === c.type && "jump" === e.data("pageBtn") ? (g = d.$jump.find("input").val(), j(g, d.pageCount) && (f = g - 1, d.$element.trigger(b.jumpClicked, f), d.debug("event[ jumpClicked ] : pageIndex = " + f), d._remoteOrRedner(f)), d.$jump.find("input").val(null)) : "change" === c.type && "size" === e.data("pageBtn") && (h = d.$size.find("select").val(), d.currentPageSize = h, d.$element.trigger(b.pageSizeChanged, h), d.debug("event[ pageSizeChanged ] : pageSize = " + h), d._remoteOrRedner(0)) : (f = a(c.target).data("pageIndex"), d.$element.trigger(b.pageClicked, f), d.debug("event[ pageClicked ] : pageIndex = " + f), d._remoteOrRedner(f)) }, "undefined" == typeof this.options.total && null === this.options.remote.url ? console && console.error("[init error] : the options must have the parameter of 'remote.url' or 'total'.") : "undefined" != typeof this.options.total || this.options.loadFirstPage ? f(this) : console && console.error("[init error] : if you don't remote the first page. you must set the options or 'total'.") }; c.prototype = { _remoteOrRedner: function (a) { null != this.options.remote.url && (this.options.loadFirstPage || a > 0) ? this.remote(a) : this.renderPagination(a) }, remote: function (b, c) { var e, f, d = this; (isNaN(parseInt(b)) || "object" == typeof b) && (c = b, b = null), isNaN(parseInt(b)) && (b = d.currentPageIndex), e = {}, e[this.options.remote.pageIndexName] = b, e[this.options.remote.pageSizeName] = this.currentPageSize, this.options.remote.params = i(this.options.remote.params), c && (c = i(c), this.options.remote.params = a.extend({}, this.options.remote.params, c)), f = a.extend({}, this.options.remote.params, e), a.ajax({ url: this.options.remote.url, dataType: "json", data: f, contentType: "application/Json",