PageSourceSearch

https://www.mingshui.gov.cn/ms/xhtml/js/page_list.js

js mingshui.gov.cn collected 2026-10-02 17:07:39 UTC 6,347 bytes, 137 lines download raw bytes

1'use strict';
2
3(function ($) {
4    var _pageinit;
5    var zp = {
6        init: function init(obj, pageinit) {
7            return function () {
8                zp.addhtml(obj, pageinit);
9                //zp.bindEvent(obj,pageinit);
10            }();
11        },
12        addhtml: function addhtml(obj, pageinit) {
13            return function () {
14                obj.empty();
15                /*上一页*/
16                //console.log(pageinit);
17                if (pageinit.current > 1) {
18                    obj.append('<a href="javascript:;" class="prebtn">上一页</a>');
19                } else {
20                    obj.remove('.prevPage');
21                    obj.append('<span class="disabled">上一页</span>');
22                }
23                /*中间页*/
24                // console.log(pageinit.pageNum)
25                if (pageinit.current > 3 && pageinit.pageNum > 3) {
26                    obj.append('<a href="javascript:;" class="zxfPagenum">' + 1 + '</a>');
27                    // obj.append('<a href="javascript:;" class="zxfPagenum">'+2+'</a>');
28                    obj.append('<span>...</span>');
29                }
30                if (pageinit.current > 2 && pageinit.current <= pageinit.pageNum - 3) {
31                    var start = pageinit.current - 1,
32                        end = pageinit.current + 1;
33                } else if (pageinit.current > 2 && pageinit.current > pageinit.pageNum - 3) {
34                    var start = pageinit.pageNum - 2,
35                        end = pageinit.pageNum;
36                } else {
37                    var start = 1,
38                        end = 3; // zhao
39                }
40                for (; start <= end; start++) {
41                    if (start <= pageinit.pageNum && start >= 1) {
42                        if (start == pageinit.current) {
43                            obj.append('<span class="current">' + start + '</span>');
44                        } else if (start == pageinit.current + 1) {
45                            obj.append('<a href="javascript:;" class="zxfPagenum nextpage">' + start + '</a>');
46                        } else {
47                            obj.append('<a href="javascript:;" class="zxfPagenum">' + start + '</a>');
48                        }
49                    }
50                }
51                if (end < pageinit.pageNum) {
52                    obj.append('<span>...</span>');
53                    obj.append('<a href="javascript:;" class="zxfPagenum">' + pageinit.pageNum + '</a>');
54                }
55                /*下一页*/
56                if (pageinit.current >= pageinit.pageNum) {
57                    obj.remove('.nextbtn');
58                    obj.append('<span class="disabled">下一页</span>');
59                } else {
60                    obj.append('<a href="javascript:;" class="nextbtn">下一页</a>');
61                }
62                /*尾部*/
63                obj.append('<span>' + '共' + '<b>' + pageinit.pageNum + '</b>' + '页,' + '</span>');
64                obj.append('<span>' + '到第' + '<input type="number" class="zxfinput" value="' + (Number(pageinit.pageNum) == Number(pageinit.current) ? pageinit.current : Number(pageinit.current + 1)) + '"/>' + '页' + '</span>');
65                obj.append('<span class="zxfokbtn">' + '确定' + '</span>');
66
67                // console.log(pageinit.pageNum)
68                // 一页不显示 
69                if (pageinit.pageNum < 2) {
70                    $('#page_div').hide();
71                }
72            }();
73        },
74        bindEvent: function bindEvent(obj) {
75            return function () {
76                obj.on("click", "a.prebtn", function () {
77                    var cur = parseInt(obj.children("span.current").text());
78                    var current = $.extend(_pageinit, { "current": cur - 1 });
79                    zp.addhtml(obj, current);
80                    if (typeof _pageinit.backfun == "function") {
81                        _pageinit.backfun(current);
82                    }
83                });
84                obj.on("click", "a.zxfPagenum", function () {
85                    var cur = parseInt($(this).text());
86                    var current = $.extend(_pageinit, { "current": cur });
87                    zp.addhtml(obj, current);
88                    if (typeof _pageinit.backfun == "function") {
89                        _pageinit.backfun(current);
90                    }
91                });
92                obj.on("click", "a.nextbtn", function () {
93                    var cur = parseInt(obj.children("span.current").text());
94                    var current = $.extend(_pageinit, { "current": cur + 1 });
95                    zp.addhtml(obj, current);
96                    if (typeof _pageinit.backfun == "function") {
97                        _pageinit.backfun(current);
98                    }
99                });
100                obj.on("keydown", "input.zxfinput", function (e) {
101
102                    if (window.event.keyCode == 13 || e.keyCode == 13) {
103                        var cur = parseInt($("input.zxfinput").val());
104                        var current = $.extend(_pageinit, { "current": cur });
105                        zp.addhtml(obj, { "current": cur, "pageNum": _pageinit.pageNum });
106                        if (typeof _pageinit.backfun == "function") {
107                            _pageinit.backfun(current);
108                        }
109                    }
110                });
111                obj.on("click", "span.zxfokbtn", function () {
112                    var cur = parseInt($("input.zxfinput").val());
113                    var current = $.extend(_pageinit, { "current": cur });
114                    zp.addhtml(obj, { "current": cur, "pageNum": _pageinit.pageNum });
115                    if (typeof _pageinit.backfun == "function") {
116                        _pageinit.backfun(current);
117                    }
118                });
119            }();
120        }
121    };
122    $.fn.createPage = function (options) {
123        _pageinit = options;
124        var pageinit = $.extend({
125            pageNum: 15,
126            current: 1,
127            backfun: function backfun() {}
128        }, options);
129        zp.init(this, pageinit);
130    };
131    $.fn.bindEvent = function (options) {
132        var pageinit = $.extend({
133            backfun: function backfun() {}
134        }, _pageinit);
135        zp.bindEvent(this, pageinit);
136    };
137})(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.