PageSourceSearch

https://geekstudio.us/assets/js/jquery.nice-select.min.js

js geekstudio.us collected 2026-09-24 13:43:11 UTC 4,229 bytes, 116 lines download raw bytes

1!(function (e) {
2  e.fn.niceSelect = function (t) {
3    function s(t) {
4      t.after(
5        e("<div></div>")
6          .addClass("nice-select")
7          .addClass(t.attr("class") || "")
8          .addClass(t.attr("disabled") ? "disabled" : "")
9          .attr("tabindex", t.attr("disabled") ? null : "0")
10          .html('<span class="current"></span><ul class="list"></ul>')
11      );
12      var s = t.next(),
13        n = t.find("option"),
14        i = t.find("option:selected");
15      s.find(".current").html(i.data("display") || i.text()),
16        n.each(function (t) {
17          var n = e(this),
18            i = n.data("display");
19          s.find("ul").append(
20            e("<li></li>")
21              .attr("data-value", n.val())
22              .attr("data-display", i || null)
23              .addClass(
24                "option" +
25                  (n.is(":selected") ? " selected" : "") +
26                  (n.is(":disabled") ? " disabled" : "")
27              )
28              .html(n.text())
29          );
30        });
31    }
32    if ("string" == typeof t)
33      return (
34        "update" == t
35          ? this.each(function () {
36              var t = e(this),
37                n = e(this).next(".nice-select"),
38                i = n.hasClass("open");
39              n.length && (n.remove(), s(t), i && t.next().trigger("click"));
40            })
41          : "destroy" == t
42          ? (this.each(function () {
43              var t = e(this),
44                s = e(this).next(".nice-select");
45              s.length && (s.remove(), t.css("display", ""));
46            }),
47            0 == e(".nice-select").length && e(document).off(".nice_select"))
48          : console.log('Method "' + t + '" does not exist.'),
49        this
50      );
51    this.hide(),
52      this.each(function () {
53        var t = e(this);
54        t.next().hasClass("nice-select") || s(t);
55      }),
56      e(document).off(".nice_select"),
57      e(document).on("click.nice_select", ".nice-select", function (t) {
58        var s = e(this);
59        e(".nice-select").not(s).removeClass("open"),
60          s.toggleClass("open"),
61          s.hasClass("open")
62            ? (s.find(".option"),
63              s.find(".focus").removeClass("focus"),
64              s.find(".selected").addClass("focus"))
65            : s.focus();
66      }),
67      e(document).on("click.nice_select", function (t) {
68        0 === e(t.target).closest(".nice-select").length &&
69          e(".nice-select").removeClass("open").find(".option");
70      }),
71      e(document).on(
72        "click.nice_select",
73        ".nice-select .option:not(.disabled)",
74        function (t) {
75          var s = e(this),
76            n = s.closest(".nice-select");
77          n.find(".selected").removeClass("selected"), s.addClass("selected");
78          var i = s.data("display") || s.text();
79          n.find(".current").text(i),
80            n.prev("select").val(s.data("value")).trigger("change");
81        }
82      ),
83      e(document).on("keydown.nice_select", ".nice-select", function (t) {
84        var s = e(this),
85          n = e(s.find(".focus") || s.find(".list .option.selected"));
86        if (32 == t.keyCode || 13 == t.keyCode)
87          return (
88            s.hasClass("open") ? n.trigger("click") : s.trigger("click"), !1
89          );
90        if (40 == t.keyCode) {
91          if (s.hasClass("open")) {
92            var i = n.nextAll(".option:not(.disabled)").first();
93            i.length > 0 &&
94              (s.find(".focus").removeClass("focus"), i.addClass("focus"));
95          } else s.trigger("click");
96          return !1;
97        }
98        if (38 == t.keyCode) {
99          if (s.hasClass("open")) {
100            var l = n.prevAll(".option:not(.disabled)").first();
101            l.length > 0 &&
102              (s.find(".focus").removeClass("focus"), l.addClass("focus"));
103          } else s.trigger("click");
104          return !1;
105        }
106        if (27 == t.keyCode) s.hasClass("open") && s.trigger("click");
107        else if (9 == t.keyCode && s.hasClass("open")) return !1;
108      });
109    var n = document.createElement("a").style;
110    return (
111      (n.cssText = "pointer-events:auto"),
112      "auto" !== n.pointerEvents && e("html").addClass("no-csspointerevents"),
113      this
114    );
115  };
116})(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.