1"use strict"; 2function _classCallCheck(e, t) { 3 if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function"); 4} 5var _extends = 6 Object.assign || 7 function (e) { 8 for (var t = 1; t < arguments.length; t++) { 9 var i = arguments[t]; 10 for (var n in i) Object.prototype.hasOwnProperty.call(i, n) && (e[n] = i[n]); 11 } 12 return e; 13 }, 14 _createClass = (function () { 15 function e(e, t) { 16 for (var i = 0; i < t.length; i++) { 17 var n = t[i]; 18 (n.enumerable = n.enumerable || !1), (n.configurable = !0), "value" in n && (n.writable = !0), Object.defineProperty(e, n.key, n); 19 } 20 } 21 return function (t, i, n) { 22 return i && e(t.prototype, i), n && e(t, n), t; 23 }; 24 })(), 25 Slinky = (function () { 26 function e(t) { 27 var i = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}; 28 _classCallCheck(this, e), (this.settings = _extends({}, this.options, i)), this._init(t); 29 } 30 return ( 31 _createClass(e, [ 32 { 33 key: "options", 34 get: function () { 35 return { resize: !0, speed: 300, theme: "slinky-theme-default", title: !1 }; 36 }, 37 }, 38 ]), 39 _createClass(e, [ 40 { 41 key: "_init", 42 value: function (e) { 43 (this.menu = $(e)), (this.base = this.menu.children().first()); 44 this.base; 45 var t = this.menu, 46 i = this.settings; 47 t.addClass("slinky-menu").addClass(i.theme), this._transition(i.speed), $("a + ul", t).prev().addClass("next"), $("li > a", t).wrapInner("<span>"); 48 var n = $("<li>").addClass("header"); 49 $("li > ul", t).prepend(n); 50 var s = $("<a>").prop("href", "#").addClass("back"); 51 $(".header", t).prepend(s), 52 i.title && 53 $("li > ul", t).each(function (e, t) { 54 var i = $(t).parent().find("a").first(); 55 var titleText = i.text(); 56 var titleHref = i.attr("href"); 57 if (titleText && titleHref) { 58 var n = $("<header>").addClass("title").append($("<a>").prop("href", titleHref).text(titleText).css("padding", "0")); 59 $("> .header", t).append(n); 60 } 61 }), 62 this._addListeners(), 63 this._jumpToInitial(); 64 }, 65 }, 66 { 67 key: "_addListeners", 68 value: function () { 69 var e = this, 70 t = this.menu, 71 i = this.settings; 72 $("a", t).on("click", function (n) { 73 if (e._clicked + i.speed > Date.now()) return !1; 74 e._clicked = Date.now(); 75 var s = $(n.currentTarget); 76 (0 === s.attr("href").indexOf("#") || s.hasClass("next") || s.hasClass("back")) && n.preventDefault(), 77 s.hasClass("next") 78 ? (t.find(".active").removeClass("active"), s.next().show().addClass("active"), e._move(1), i.resize && e._resize(s.next())) 79 : s.hasClass("back") && 80 (e._move(-1, function () { 81 t.find(".active").removeClass("active"), s.parent().parent().hide().parentsUntil(t, "ul").first().addClass("active"); 82 }), 83 i.resize && e._resize(s.parent().parent().parentsUntil(t, "ul"))); 84 }); 85 }, 86 }, 87 { 88 key: "_jumpToInitial", 89 value: function () { 90 var e = this.menu.find(".active"); 91 e.length > 0 && (e.removeClass("active"), this.jump(e, !1)); 92 }, 93 }, 94 { 95 key: "_move", 96 value: function () { 97 var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 0, 98 t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : function () {}; 99 if (0 !== e) { 100 var i = this.settings, 101 n = this.base, 102 s = Math.round(parseInt(n.get(0).style.left)) || 0; 103 n.css("left", s - 100 * e + "%"), "function" == typeof t && setTimeout(t, i.speed); 104 } 105 }, 106 }, 107 { 108 key: "_resize", 109 value: function (e) { 110 this.menu.height(e.outerHeight()); 111 }, 112 }, 113 { 114 key: "_transition", 115 value: function () { 116 var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 300, 117 t = this.menu, 118 i = this.base; 119 t.css("transition-duration", e + "ms"), i.css("transition-duration", e + "ms"); 120 }, 121 }, 122 { 123 key: "jump", 124 value: function (e) { 125 var t = !(arguments.length > 1 && void 0 !== arguments[1]) || arguments[1]; 126 if (e) { 127 var i = this.menu, 128 n = this.settings, 129 s = $(e), 130 a = i.find(".active"), 131 r = 0; 132 a.length > 0 && (r = a.parentsUntil(i, "ul").length), i.find("ul").removeClass("active").hide(); 133 var l = s.parentsUntil(i, "ul"); 134 l.show(), s.show().addClass("active"), t || this._transition(0), this._move(l.length - r), n.resize && this._resize(s), t || this._transition(n.speed); 135 } 136 }, 137 }, 138 { 139 key: "home", 140 value: function () { 141 var e = !(arguments.length > 0 && void 0 !== arguments[0]) || arguments[0], 142 t = this.base, 143 i = this.menu, 144 n = this.settings; 145 e || this._transition(0); 146 var s = i.find(".active"), 147 a = s.parentsUntil(i, "ul"); 148 this._move(-a.length, function () { 149 s.removeClass("active").hide(), a.not(t).hide(); 150 }), 151 n.resize && this._resize(t), 152 !1 === e && this._transition(n.speed); 153 }, 154 }, 155 {
156 key: "destroy", 157 value: function () { 158 var e = this, 159 t = this.base, 160 i = this.menu; 161 $(".header", i).remove(), 162 $("a", i).removeClass("next").off("click"), 163 i.css({ height: "", "transition-duration": "" }), 164 t.css({ left: "", "transition-duration": "" }), 165 $("li > a > span", i).contents().unwrap(), 166 i.find(".active").removeClass("active"), 167 i 168 .attr("class") 169 .split(" ") 170 .forEach(function (e) { 171 0 === e.indexOf("slinky") && i.removeClass(e); 172 }), 173 ["settings", "menu", "base"].forEach(function (t) { 174 return delete e[t]; 175 }); 176 }, 177 }, 178 ]), 179 e 180 ); 181 })(); 182jQuery.fn.slinky = function (e) { 183 return new Slinky(this, e); 184}; 185//# sourceMappingURL=slinky.min.js.map
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.