PageSourceSearch

https://wynews.cn/material/createpage_zy.js

js wynews.cn collected 2026-10-08 19:08:43 UTC 4,458 bytes, 107 lines download raw bytes

1
2function toPage(obj) {
3    console.log(obj)
4    var nPageCount = obj.count;
5    var sPageExt = obj.ext;
6    var sPageName = obj.name;
7    var _num = document.getElementById("num").value;
8    if (isNaN(_num)) {
9        alert("请输入数字");
10        return false;
11    }
12    var str = sPageName + "_" + (_num - 1) + "." + sPageExt;
13    var url = location.href.substring(0, location.href.lastIndexOf("/") + 1);
14    if (_num < 1 || _num == null)
15        location.href = url + sPageName + "." + sPageExt;
16    else if (_num > nPageCount)
17        alert("本频道最多" + nPageCount + "页");
18    else
19        location.href = url + str;
20}
21//不需要碎片功能的分页
22function createPageHTML(_nPageCount, _nCurrIndex, _sPageName, _sPageExt, jump) {
23
24    var sPageName = _sPageName.toLowerCase();
25    var sPageExt = _sPageExt.toLowerCase();
26    var nPageCount = _nPageCount;
27    if (_nPageCount == null || _nPageCount <= 1) {
28        return;
29    }
30    // document.write("<span>共</span><span class='red'>" + nPageCount + "</span><span>页</span>");
31
32    var nCurrIndex = _nCurrIndex || 0;
33    document.write('<div class="page">');
34    // 1 输出首页和上一页
35    // 1.1 当前页是首页
36    if (_nPageCount > 1) {
37        // document.write('<a class="first" href=' + _sPageName + '.' + sPageExt + '>首页</a>');
38    }
39    if (nCurrIndex == 0) {
40        document.write("<a href='javascript:void(0)' class='pre'>上一页</a> ");
41        document.write('<span class="btns">');
42        document.write("<a class='active' href='javascript:void(0)'>1</a>");
43    } else if (nCurrIndex == 1) { // 1.2 当前页是第2页
44        document.write("<a class='pre' href='" + _sPageName + "." + sPageExt + "'>上一页</a>");
45        document.write('<span class="btns">');
46        document.write("<a  href='" + _sPageName + "." + sPageExt + "'>1</a>");
47    } else { // 1.3 当前页不是首页和第2页
48        document.write("<a class='pre' href='" + _sPageName + "_" + (nCurrIndex - 1) + "." + sPageExt + "'>上一页</a>");
49        document.write('<span class="btns">');
50        document.write("<a  href='" + _sPageName + "." + sPageExt + "'>1</a>");
51    }
52
53    // 2 输出中间分页
54    // 这里是加载省略号的flag
55    var isHiddenExist = 0;
56    for (var i = 1; i < _nPageCount; i++) {
57        if (nCurrIndex == i) { // 2.1 当前页 标红
58            document.write("<a  class='active' href='javascript:void(0);'>" + (i + 1) + "</a>");
59        } else {
60            // 2.2 如果是页首,中间页,页尾,当前页的前后三页则不省略
61            if (i < 4 || i < ((nCurrIndex + 1) + 3) && i > ((nCurrIndex + 1) - 3) || i > (_nPageCount / 2 - 2) && i < (_nPageCount / 2 + 2) || i > (_nPageCount - 3)) {
62                document.write("<a  style='#ed534b' href='" + _sPageName + "_" + i + "." +
63                    sPageExt +
64                    "'>" + (i + 1)
65                    + "</a>");
66                isHiddenExist = 0;
67            } else { // 2.3 否则就构造...
68                if (isHiddenExist == 0) {
69                    document.write("<a class='dian' href='javascript:void(0)'>...</a>");
70                    isHiddenExist = 1;
71                }
72            }
73        }
74    }
75    //分页跳转
76    // 3 输出下一页和尾页
77    // 3.1 当前页是尾页
78    document.write('</span>');
79    if (nCurrIndex == (_nPageCount - 1)) {
80        document.write("<a  class='next' href='javascript:void(0)'>下一页</a>");
81    } else if (nCurrIndex == 0) { // 3.2 当前页是首页
82        console.log("==" + _nPageCount);
83        document.write("<a class='next' href='" + _sPageName + "_" + (nCurrIndex + 1) + "." + sPageExt +
84            "'>下一页</a>");
85    } else { // 3.3 当前页不是尾页和首页
86
87        document.write("<a class='next' href='" + _sPageName + "_" + (nCurrIndex + 1) + "." + sPageExt + "'>下一页</a>");
88    }
89    if (_nPageCount > 1) {
90        // document.write('<a class="last" href=' + _sPageName + '_' + (_nPageCount - 1) + '.' + sPageExt + '>尾页</a>');
91    }
92    var obj = {
93        count: _nPageCount,
94        ext: sPageExt,
95        name: _sPageName
96    }
97    var objStr = JSON.stringify(obj);
98
99    if (jump) {
100        document.write(
101            "<span class='jump'>转到第</span><input type='text' id='num' /><span>页</span><input class='cur go' type='submit' value='提交' onClick='javascript:toPage(" + objStr + ")' />"
102        );
103    }
104    document.write('</div>');
105
106
107}

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.