PageSourceSearch

https://www.xztech.ai/Public/Cn/Yongsy/Yongsy.js

js xztech.ai collected 2026-10-05 13:20:15 UTC 6,615 bytes, 247 lines download raw bytes

1var MODULE_NAME_URL = '/' + ysconfig.MODULE_NAME;
2/**
3 * Determine if the site is stopped
4 * @returns {undefined}
5 */
6function closeWeb() {
7    var xmlhttp = new XMLHttpRequest();
8    xmlhttp.open("POST", MODULE_NAME_URL + "/Common/closeWeb", true);
9    xmlhttp.send();
10    xmlhttp.onreadystatechange = function () {
11        if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
12            if (xmlhttp.responseText == 2) {
13                // /Public/ErrorTpl/404
14                location.href = '/404';
15            }
16        }
17    }
18}
19/**
20 * Determine the IP  language jump
21 * @returns {undefined}
22 */
23// 使用这个方法的时候请注意,把他拿到首页去,不要留在这里,因为判断现在只判断首页,放在这里就是判断全站了,这不对
24function judgeWeb() {
25    var xmlhttp = new XMLHttpRequest();
26    xmlhttp.open("POST", MODULE_NAME_URL + "/Verifyip/judgeWeb", true);
27    xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
28    xmlhttp.send("referrer=" + document.referrer);
29    xmlhttp.onreadystatechange = function () {
30        if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
31            var judObj = JSON.parse(xmlhttp.responseText);
32            if (judObj.code == 1) {
33                window.location.href = judObj.url;
34            }
35        }
36    }
37}
38
39function dataStatistics(url) {
40    var xmlhttp = new XMLHttpRequest();
41    xmlhttp.open("GET", url, true);
42    xmlhttp.send();
43    xmlhttp.onreadystatechange = function () {}
44}
45
46
47(function () {
48    closeWeb();
49    // judgeWeb();
50})();
51
52
53//写cookies,一个小时过期 
54function setCookie(name, value) {
55    var exp = new Date();
56    exp.setTime(exp.getTime() + 60 * 60 * 1000);
57    document.cookie = name + "=" + escape(value) + ";expires=" + exp.toGMTString() + ";path=/";
58}
59
60//读取cookies 
61function getCookie(name) {
62    var arr, reg = new RegExp("(^| )" + name + "=([^;]*)(;|$)");
63    if (arr = document.cookie.match(reg))
64        return unescape(arr[2]);
65    else
66        return null;
67}
68
69//删除cookies 
70function delCookie(name) {
71    var exp = new Date();
72    exp.setTime(exp.getTime() - 60 * 60 * 1000);
73    var cval = getCookie(name);
74    if (cval != null)
75        document.cookie = name + "=" + cval + ";expires=" + exp.toGMTString() + ";path=/";
76}
77
78// 搜索的方法
79var queryData = {
80    query: function (url, wd) {
81        var base = new this.Base64();
82        if (wd) {
83            location.href = url + "/wd/" + base.encode(wd);
84        } else {
85            location.href = url;
86        }
87    },
88    Base64: function Base64() {
89
90        // public method for encoding
91        this.encode = function (input) {
92            /**
93             * / 替换成 %^%
94             * \ 替换成 %$%
95             * @type @exp;input@call;replace|@exp;input@call;replace
96             */
97            //            var oInput = input.replace('/', '%^%');
98            //            oInput = oInput.replace('\\', '%$%');
99            var oInput = getSpecifiedStr(input, '/', '%^%');
100            oInput = getSpecifiedStr(oInput, '\\', '%$%');
101            return encodeURIComponent(oInput);
102        }
103    }
104}
105// 检索的字符串替换特殊字符的方法
106function getSpecifiedStr(str, find, spec) {
107    var newStr = str.replace(find, spec);
108    var len = newStr.indexOf(find);
109    if (len != -1) {
110        newStr = getSpecifiedStr(newStr, find, spec);
111    }
112    return newStr;
113}
114
115// 提示框
116function ysalert(msg) {
117    layerHandel = layer.alert(msg, {
118        'title': ysconfig.TIP.MSG,
119        'btn': [ysconfig.TIP.OK]
120    }, function () {
121        layer.close(layerHandel);
122    });
123}
124
125
126// 公共检索
127var searchTip = ysconfig.TIP.KEYWORDS;
128
129function on_search() {
130    var wd = $("#keywords").val();
131    if (wd.length == 0) {
132        alert(searchTip);
133    } else {
134        var url = MODULE_NAME_URL + "/Index/search";
135        queryData.query(url, wd);
136    }
137}
138
139function phsearch() {
140    var wd = $("#phkeywords").val();
141    if (wd.length == 0) {
142        alert(searchTip);
143    } else {
144        var url = MODULE_NAME_URL + "/Index/search";
145        queryData.query(url, wd);
146    }
147}
148
149$("#keywords").keyup(function (event) {
150    if (event.keyCode == 13) {
151        var wd = $("#keywords").val();
152        if (wd.length == 0) {
153            alert(searchTip);
154        } else {
155            var url = MODULE_NAME_URL + "/Index/search";
156            queryData.query(url, wd);
157        }
158    }
159});
160$("#phkeywords").keyup(function (event) {
161    if (event.keyCode == 13) {
162        var wd = $("#phkeywords").val();
163        if (wd.length == 0) {
164            alert(searchTip);
165        } else {
166            var url = MODULE_NAME_URL + "/Index/search";
167            queryData.query(url, wd);
168        }
169    }
170});
171
172//产品检索
173$(".pro-pull-search-search").click(function () {
174    searchProduct();
175})
176
177$("#prokw").keyup(function (event) {
178    if (event.keyCode == 13) {
179        searchProduct();
180    }
181});
182
183function searchProduct() {
184    var wd = $("#prokw").val();
185    if (wd.length == 0) {
186        alert(searchTip);
187    } else {
188        var url = MODULE_NAME_URL+"/Index/search/modules/product";
189        queryData.query(url, wd);
190    }
191}
192
193//锚点定位#号和问号兼容版
194function yxtop(param) {
195    var head1 = parseFloat($('html').css('--headh'));
196    var dataDef = {
197        navHeight: head1 || 0,
198        time: 500,
199        tp: "",
200        delay: 0,
201        reload: true,
202    };
203    var data = $.extend(dataDef, param);
204    function init(data) {
205        var navHeight = data.navHeight;
206        var time = data.time;
207        if ($(window).width() < 1200) {
208            navHeight = 56;
209        }
210        var tp = window.location.hash.replace(/^#section/, '');
211        tp = tp || data.tp;
212        if (tp) {
213            $("html,body").animate({
214                scrollTop: $('[data-page="' + tp + '"]').offset().top - navHeight
215            }, time);
216        }
217    }
218    let isInitiated = false;
219    function initPage() {
220        if (isInitiated) return;
221        isInitiated = true;
222        init(data);
223    }
224    if (document.readyState === "complete" || document.readyState === "interactive") {
225        initPage();
226    } else {
227        window.addEventListener('load', initPage, false);
228    }
229    window.addEventListener('pageshow', function(e) {
230        if (e.persisted) { 
231            initPage();
232        }
233    }, false);
234
235    $(window).on("hashchange", function () {
236        if(data.reload){
237            window.location.reload();
238        }else{
239            init(data);
240        }
241    });
242    if (data.delay) {
243        setTimeout(function () {
244            init(data);
245        }, data.delay);
246    }
247}

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.