PageSourceSearch

https://wsbfdzz.github.io/search/js/cb-search.js

js wsbfdzz.github.io collected 2026-10-03 10:11:00 UTC 2,795 bytes, 87 lines download raw bytes

1$(document).ready(function () {
2    var time1 = 0;
3    var show = false;
4    var names = new Array(); //文章名字等
5    var urls = new Array(); //文章地址
6    $(document).keyup(function (e) {
7        var time2 = new Date().getTime();
8        if (e.keyCode == 17) {
9            var gap = time2 - time1;
10            time1 = time2;
11            if (gap < 500) {
12                if (show) {
13                    $(".cb-search-tool").css("display", "none");
14                    show = false;
15                } else {
16                    $(".cb-search-tool").css("display", "block");
17                    show = true;
18                    $("#cb-search-content").val("");
19                    $("#cb-search-content").focus();
20                }
21                time1 = 0;
22            }
23        } else if (e.keyCode == 27) {
24            $(".cb-search-tool").css("display", "none");
25            show = false;
26            time1 = 0;
27        }
28    });
29
30    $("#cb-search-content").keyup(function (e) {
31        var time2 = new Date().getTime();
32        if (e.keyCode == 17) {
33            var gap = time2 - time1;
34            time1 = time2;
35            if (gap < 500) {
36                if (show) {
37                    $(".cb-search-tool").css("display", "none");
38                    show = false;
39                } else {
40                    $(".cb-search-tool").css("display", "block");
41                    show = true;
42                    $("#cb-search-content").val("");
43                    $("#cb-search-content").focus();
44                }
45                time1 = 0;
46            }
47        }
48    });
49
50    $("#cb-close-btn").click(function () {
51        $(".cb-search-tool").css("display", "none");
52        show = false;
53        time1 = 0;
54    });
55
56    $("#cb-search-btn").click(function () {
57        $(".cb-search-tool").css("display", "block");
58        show = true;
59        $("#cb-search-content").val("");
60        $("#cb-search-content").focus();
61        time1 = 0;
62    });
63
64    $.getJSON("/search/cb-search.json").done(function (data) {
65        if (data.code == 0) {
66            for (var index in data.data) {
67                var item = data.data[index];
68                names.push(item.title);
69                urls.push(item.url);
70            }
71
72            $("#cb-search-content").typeahead({
73                source: names,
74
75                afterSelect: function (item) {
76                    $(".cb-search-tool").css("display", "none");
77                    show = false;
78                    window.location.href = (urls[names.indexOf(item)]);
79                    return item;
80                }
81            });
82        }
83    }).error(function (data, b) {
84        console.log("json解析错误,搜索功能暂不可用,请检查文章title,确保不含有换行等特殊符号");
85    });
86
87});

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.