PageSourceSearch

https://www.higiena.net.pl/js/slide-menu.js

js higiena.net.pl collected 2026-10-08 06:16:19 UTC 9,950 bytes, 195 lines download raw bytes

1"use strict";
2
3function _classCallCheck(t, e) {
4    if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
5}
6
7var _createClass = function () {
8    function t(t, e) {
9        for (var n = 0; n < e.length; n++) {
10            var i = e[n];
11            i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(t, i.key, i)
12        }
13    }
14
15    return function (e, n, i) {
16        return n && t(e.prototype, n), i && t(e, i), e
17    }
18}();
19!function (t) {
20    var e = "slideMenu", n = {
21        position: "left",
22        showBackLink: !0,
23        keycodeOpen: null,
24        keycodeClose: 27,
25        submenuLinkBefore: "",
26        submenuLinkAfter: "",
27        backLinkBefore: "",
28        backLinkAfter: ""
29    }, i = function () {
30        function e(t) {
31            _classCallCheck(this, e), this.options = t, this._menu = t.elem, this._menu.find("ul:first").wrap('<div class="slider">'), this._anchors = this._menu.find("a"), this._slider = this._menu.find(".slider:first"), this._level = 0, this._isOpen = !1, this._isAnimating = !1, this._hasMenu = this._anchors.length > 0, this._lastAction = null, this._setupEventHandlers(), this._setupMenu(), this._hasMenu && this._setupSubmenus()
32        }
33
34        return _createClass(e, [{
35            key: "toggle", value: function () {
36                var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : null,
37                    e = !(arguments.length > 1 && void 0 !== arguments[1]) || arguments[1], n = void 0;
38                return null === t ? void (this._isOpen ? this.close() : this.open()) : (t ? (n = 0, this._isOpen = !0) : (n = "left" === this.options.position ? "100%" : "100%", this._isOpen = !1), this._triggerEvent(), void (e ? this._triggerAnimation(this._menu, n) : (this._pauseAnimations(this._triggerAnimation.bind(this, this._menu, n)), this._isAnimating = !1)))
39            }
40        }, {
41            key: "toggleSpe", value: function () {
42                var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : null,
43                    e = !(arguments.length > 1 && void 0 !== arguments[1]) || arguments[1], n = void 0;
44                return null === t ? void (this._isOpen ? this.close() : this.open()) : (t ? (n = 0, this._isOpen = !0) : (n = "left" === this.options.position ? "100%" : "100%", this._isOpen = !1), this._triggerEvent(), void (e ? this._triggerAnimationSpe(this._menu, n) : (this._pauseAnimations(this._triggerAnimationSpe.bind(this, this._menu, n)), this._isAnimating = !1)))
45            }
46        }, {
47            key: "open", value: function () {
48                var t = !(arguments.length > 0 && void 0 !== arguments[0]) || arguments[0];
49                this._lastAction = "open", this.toggle(!0, t)
50            }
51        }, {
52            key: "close", value: function () {
53                var t = !(arguments.length > 0 && void 0 !== arguments[0]) || arguments[0];
54                this._lastAction = "close", this.toggleSpe(!1, t)
55            }
56        }, {
57            key: "close2", value: function () {
58                var t = !(arguments.length > 0 && void 0 !== arguments[0]) || arguments[0];
59                this._lastAction = "close2", this.toggle(!1, t)
60            }
61        }, {
62            key: "back", value: function () {
63                this._lastAction = "back", this._navigate(null, -1)
64            }
65        }, {
66            key: "navigateTo", value: function (e) {
67                var n = this;
68                if (e = this._menu.find(t(e)).first(), !e.length) return !1;
69                var i = e.parents("ul"), s = i.length - 1;
70                return 0 !== s && void this._pauseAnimations(function () {
71                    n._level = s, i.show().first().addClass("active"), n._triggerAnimation(n._slider, 100 * -n._level)
72                })
73            }
74        }, {
75            key: "_setupEventHandlers", value: function () {
76                var e = this;
77                this._hasMenu && this._anchors.click(function (n) {
78                    var i = t(n.target).is("a") ? t(n.target) : t(n.target).parents("a:first");
79                    e._navigate(i)
80                }), t(this._menu.add(this._slider)).on("transitionend msTransitionEnd", function () {
81                    e._isAnimating = !1, e._triggerEvent(!0)
82                }), t(document).keydown(function (t) {
83                    switch (t.which) {
84                        case e.options.keycodeClose:
85                            e.close();
86                            break;
87                        case e.options.keycodeOpen:
88                            e.open();
89                            break;
90                        default:
91                            return
92                    }
93                    t.preventDefault()
94                }), this._menu.on("sm.back-after", function () {
95                    var t = "ul " + ".active ".repeat(e._level + 1);
96                    e._menu.find(t).removeClass("active").hide()
97                })
98            }
99        }, {
100            key: "_triggerEvent", value: function () {
101                var t = arguments.length > 0 && void 0 !== arguments[0] && arguments[0], e = "sm." + this._lastAction;
102                t && (e += "-after"), this._menu.trigger(e)
103            }
104        }, {
105            key: "_navigate", value: function (t) {
106                var e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 1;
107                if (!this._isAnimating) {
108                    var n = (this._level + e) * -100;
109                    if (e > 0) {
110                        if (!t.next("ul").length) return;
111                        t.next("ul").addClass("active").show();
112                        $(".slide-menu").animate({ scrollTop: 0 }, "fast");
113                    } else if (0 === this._level) return;
114                    this._lastAction = e > 0 ? "forward" : "back", this._level = this._level + e, this._triggerAnimation(this._slider, n)
115                }
116            }
117        }, {
118            key: "_triggerAnimationSpe", value: function (t, e) {
119                this._triggerEvent(), String(e).indexOf("%") === -1 && (e += "%"), t.css("transform", "translateX(-" + e + ")"), this._isAnimating = !0
120            }
121        }, {
122            key: "_triggerAnimation", value: function (t, e) {
123                this._triggerEvent(), String(e).indexOf("%") === -1 && (e += "%"), t.css("transform", "translateX(" + e + ")"), this._isAnimating = !0
124            }
125        }, {
126            key: "_setupMenu", value: function () {
127                var t = this;
128                this._pauseAnimations(function () {
129                    switch (t.options.position) {
130                        case"left":
131                            t._menu.css({left: 0, right: "auto", transform: "translateX(-100%)"});
132                            break;
133                        default:
134                            t._menu.css({left: "auto", right: 0})
135                    }
136                    t._menu.show()
137                })
138            }
139        }, {
140            key: "_pauseAnimations", value: function (t) {
141                this._menu.addClass("no-transition"), t(), this._menu[0].offsetHeight, this._menu.removeClass("no-transition")
142            }
143        }, {
144            key: "_setupSubmenus", value: function () {
145                var e = this;
146                this._anchors.each(function (n, i) {
147                    if (i = t(i), i.next("ul").length) {
148                        i.click(function (t) {
149                            t.preventDefault()
150                        });
151                        var s = i.text();
152                        if (i.html(e.options.submenuLinkBefore + s + e.options.submenuLinkAfter), e.options.showBackLink) {
153                            var a = t('<a href class="slide-menu-control" data-action="back">' + s + "</a>");
154                            a.html(e.options.backLinkBefore + a.text() + e.options.backLinkAfter), i.next("ul").prepend(t("<li>").append(a))
155                        }
156                    }
157                })
158            }
159        }]), e
160    }();
161    t("body").on("click", ".slide-menu-control", function (n) {
162        var i = void 0, s = t(this).data("target");
163        if (i = s && "this" !== s ? t("#" + s) : t(this).parents(".slide-menu:first"), i.length) {
164            var a = i.data(e), o = t(this).data("action");
165            return a && "function" == typeof a[o] && a[o](), !1
166        }
167    }), t.fn[e] = function (s) {
168        if (!t(this).length) return void console.warn("Slide Menu: Unable to find menu DOM element. Maybe a typo?");
169        s = t.extend({}, n, s), s.elem = t(this);
170        var a = new i(s);
171        return t(this).data(e, a), a
172    }
173    t("body").on("click", ".slide-change", function (n) {
174        var i = void 0, s = t('.slide-menu-control').data("target");
175        $('.slide-change').toggleClass('change');
176        $('header .navbar-fixed-top.fixed-top').toggleClass('change');
177        if (i = s && "this" !== s ? t("#" + s) : t(this).parents(".slide-menu:first"), i.length) {
178            var a = i.data(e), o = t(this).data("action"); '.slide-menu-control'
179            return a && "function" == typeof a[o] && a[o](), !1
180        }
181    }), t.fn[e] = function (s) {
182        if (!t(this).length) return void console.warn("Slide Menu: Unable to find menu DOM element. Maybe a typo?");
183        s = t.extend({}, n, s), s.elem = t(this);
184        var a = new i(s);
185        return t(this).data(e, a), a
186    }
187}(jQuery);
188$(document).ready(function () {
189    $('.spe-but').on('click',function (){
190        $('#speBg').fadeIn( "slow" );
191    });
192    $('.spe-but-close').on('click',function (){
193        $('#speBg').fadeOut( "slow" );
194    });
195});

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.