PageSourceSearch

https://www.changde.gov.cn/content/_common/fulltextsearch/js/power…7kwztIYCApMr45et6iWJ_WrdP4LBiURt5p0JCB0P0R8

js changde.gov.cn collected 2026-10-02 07:38:10 UTC 5,565 bytes, 180 lines download raw bytes

1var associativeWordTimeout = null;
2$(function () {
3    /**
4    * 设置智能标签跳转点击事件。
5    */
6    /**
7    * 设置搜索排行跳转点击事件。
8    */
9    $(document).on("click", ".s-top-ranking a", setSearchUrl);
10    /**
11    * 设置热门搜索跳转点击事件。
12    */
13    $(document).on("click", ".s-hot-search a", setSearchUrl);
14
15    function setSearchUrl() {
16        var url = $(this).data("searchurl");
17        validateCode(function () {
18            var captchaTicketId = $("input[name=CaptchaTicketId]").val();
19            var captchaTicket = $("input[name=CaptchaTicket]").val();
20            window.location.href = url += '&cti=' + captchaTicketId + '&ct=' + captchaTicket;
21        }, false);
22    }
23
24    $("input[name=wd]").on('click',
25        function (e) {
26            GetAssociativeWord();
27            e.stopPropagation();
28        });
29
30    $("input[name=wd]").on('input',
31        function (e) {
32            e = window.event || e;
33            // 忽略上下方向键。
34            if (e.keyCode == 38 || e.keyCode == 40) {
35                return;
36            }
37            clearTimeout(associativeWordTimeout);
38            associativeWordTimeout = setTimeout(GetAssociativeWord, 300);
39            e.stopPropagation();
40        });
41
42    $(document).on('click',
43        '.dropdown-word ul li',
44        function () {
45            $("input[name=wd]").val($(this).html());
46            $(".dropdown-word").hide();
47            $(".search").trigger("click");
48            var event = jQuery.Event("keydown"); //模拟一个键盘回车事件
49            event.keyCode = 13;
50            $("input[name=wd]").trigger(event);
51        });
52
53    $(document).on('click',
54        function () {
55            $(".dropdown-word").hide();
56        });
57
58    $(".dropdown-word").registerKeyControll({
59        callback: function (data) {
60            $("input[name=wd]").val(data);
61        }
62    });
63});
64
65function GetAssociativeWord() {
66    var keyword = $("input[name=wd]").val();
67    if (keyword != "") {
68        $.ajax({
69            url: $("input[name=wd]").attr("data-url"),
70            data: { keyword: keyword },
71            type: "get",
72            cache: false,
73            success: function (data) {
74                $(".dropdown-word ul li").remove();
75                if (typeof(data) != "object") {
76                    return;
77                }
78
79                if (data.length > 0) {
80                    $(".dropdown-word").show();
81                    var associativeWordHtml = "";
82                    for (var i = 0; i < data.length; i++) {
83                        associativeWordHtml += "<li>" + data[i].WordInfo + "</li>";
84                    }
85
86                    $(".dropdown-word ul").append(associativeWordHtml);
87                } else {
88                    $(".dropdown-word").hide();
89                }
90            }
91        });
92    } else {
93        $(".dropdown-word").hide();
94    }
95}
96
97(function ($) {
98    $.fn.registerKeyControll = function (opt) {
99        if ($(this).length == 0) {
100            return false;
101        }
102        var opts = $.extend({
103                defaultIndex: -1, //默认选中项
104                callback: function () {} //选择完毕后触发回调
105            },
106            opt);
107
108        var list = $(this);
109        var index = opts.defaultIndex;
110        $(document).on('keydown',
111            function (e) {
112                e = window.event || e;
113                if ($(list).find('ul li').length <= 0) {
114                    return;
115                }
116
117                if (e.keyCode == 38) {
118                    resetIndex();
119                    sPrevIndex();
120                    for (var i = 0,
121                        len = $(list).find('ul li').length;
122                        i < len;
123                        i++) {
124                        $(list).find('ul li')[i].className = i == index ? "current-selectword" : "";
125                    }
126                    opts.callback($(list).find('ul li')[index].innerHTML);
127                }
128
129                if (e.keyCode == 40) {
130                    resetIndex();
131                    sNextIndex();
132                    for (var i = 0,
133                        len = $(list).find('ul li').length;
134                        i < len;
135                        i++) {
136                        $(list).find('ul li')[i].className = i == index ? "current-selectword" : "";
137                    }
138                    opts.callback($(list).find('ul li')[index].innerHTML);
139                }
140
141            });
142
143        $(list).on('mouseover',
144            function () {
145                for (var i = 0,
146                    len = $(list).find('ul li').length;
147                    i < len;
148                    i++) {
149                    $(list).find('ul li')[i].className = "";
150                }
151            });
152
153        function sNextIndex() {
154            index = index >= $(list).find('ul li').length - 1 ? 0 : index + 1;
155            return index;
156        }
157
158        function sPrevIndex() {
159            index = index <= 0 ? $(list).find('ul li').length - 1 : index - 1;
160            return index;
161        }
162
163        function resetIndex() {
164            var hasSelect = false;
165            for (var i = 0,
166                len = $(list).find('ul li').length;
167                i < len;
168                i++) {
169                if ($(list).find('ul li')[i].className == "current-selectword") {
170                    hasSelect = true;
171                    break;
172                }
173            }
174
175            if (!hasSelect) {
176                index = -1;
177            }
178        }
179    };
180})(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.