1/** 2 * uisearch.js v1.0.0 3 * http://www.codrops.com 4 * 5 * Licensed under the MIT license. 6 * http://www.opensource.org/licenses/mit-license.php 7 * 8 * Copyright 2013, Codrops 9 * http://www.codrops.com 10 */ 11!(function (t) { 12 "use strict"; 13 function e(t) { 14 return new RegExp("(^|\\s+)" + t + "(\\s+|$)"); 15 } 16 var n, s, i; 17 function a(t, e) { 18 (n(t, e) ? i : s)(t, e); 19 } 20 "classList" in document.documentElement 21 ? ((n = function (t, e) { 22 return t.classList.contains(e); 23 }), 24 (s = function (t, e) { 25 t.classList.add(e); 26 }), 27 (i = function (t, e) { 28 t.classList.remove(e); 29 })) 30 : ((n = function (t, n) { 31 return e(n).test(t.className); 32 }), 33 (s = function (t, e) { 34 n(t, e) || (t.className = t.className + " " + e); 35 }), 36 (i = function (t, n) { 37 t.className = t.className.replace(e(n), " "); 38 })); 39 var r = { hasClass: n, addClass: s, removeClass: i, toggleClass: a, has: n, add: s, remove: i, toggle: a }; 40 "function" == typeof define && define.amd ? define(r) : (t.classie = r); 41})(window), 42 (function (t) { 43 "use strict"; 44 function e(t, e) { 45 (this.el = t), (this.inputEl = t.querySelector("form > input.sb-search-input")), (this.inputSubmit = t.querySelector("form > input.sb-search-submit")), (this.triggerEl = t.querySelector(".sb-search-toggle-icon")), this._initEvents(); 46 } 47 !t.addEventListener && 48 t.Element && 49 (function () { 50 function t(t, e) { 51 Window.prototype[t] = HTMLDocument.prototype[t] = Element.prototype[t] = e; 52 } 53 var e = []; 54 t("addEventListener", function (t, n) { 55 var s = this; 56 e.unshift({ 57 __listener: function (t) { 58 (t.currentTarget = s), 59 (t.pageX = t.clientX + document.documentElement.scrollLeft), 60 (t.pageY = t.clientY + document.documentElement.scrollTop), 61 (t.preventDefault = function () { 62 t.returnValue = !1; 63 }), 64 (t.relatedTarget = t.fromElement || null), 65 (t.stopPropagation = function () { 66 t.cancelBubble = !0; 67 }), 68 (t.relatedTarget = t.fromElement || null), 69 (t.target = t.srcElement || s), 70 (t.timeStamp = +new Date()), 71 n.call(s, t); 72 }, 73 listener: n, 74 target: s, 75 type: t, 76 }), 77 this.attachEvent("on" + t, e[0].__listener); 78 }), 79 t("removeEventListener", function (t, n) { 80 for (var s = 0, i = e.length; s < i; ++s) if (e[s].target == this && e[s].type == t && e[s].listener == n) return this.detachEvent("on" + t, e.splice(s, 1)[0].__listener); 81 }), 82 t("dispatchEvent", function (t) { 83 try { 84 return this.fireEvent("on" + t.type, t); 85 } catch (i) { 86 for (var n = 0, s = e.length; n < s; ++n) e[n].target == this && e[n].type == t.type && e[n].call(this, t); 87 } 88 }); 89 })(), 90 !String.prototype.trim && 91 (String.prototype.trim = function () { 92 return this.replace(/^\s+|\s+$/g, ""); 93 }), 94 (e.prototype = { 95 _initEvents: function () { 96 var t = this, 97 e = !1; 98 this.triggerEl.addEventListener("click", function (e) { 99 e.stopPropagation(), 100 e.preventDefault(), 101 t.open(); 102 }), 103 this.el.addEventListener("click", function (e) { 104 e.stopPropagation(), 105 (t.inputEl.value = t.inputEl.value.trim()), 106 classie.has(t.el, "sb-search-open") ? classie.has(t.el, "sb-search-open") && /^\s*$/.test(t.inputEl.value) && (e.preventDefault(), t.close()) : null;//(e.preventDefault(), t.open()); 107 }), 108 109 this.el.addEventListener( 110 "touchstart", 111 function (e) { 112 (t.inputEl.value = t.inputEl.value.trim()), classie.has(t.el, "sb-search-open") ? classie.has(t.el, "sb-search-open") && /^\s*$/.test(t.inputEl.value) && t.close() : null;//t.open(); 113 }, 114 { passive: !0 } 115 ), 116 this.inputEl.addEventListener("click", function (t) { 117 t.stopPropagation(); 118 }), 119 this.inputEl.addEventListener("keypress", function (n) { 120 if (13 == n.which) { 121 var s = t.el.querySelector("form"); 122 (e = !0), s.submit(); 123 } 124 }), 125 this.inputSubmit && 126 this.inputSubmit.addEventListener("click", function (n) { 127 n.preventDefault(), n.stopPropagation(), e || t.close(); 128 }), 129 this.inputEl.addEventListener( 130 "touchstart", 131 function (t) { 132 t.stopPropagation(); 133 }, 134 { passive: !0 } 135 ); 136 }, 137 open: function () { 138 var t = this; 139 classie.remove(this.el, "sb-search-closed"), classie.add(this.el, "sb-search-open"), this.inputEl.focus(); 140 var e = function (n) { 141 t.close(), this.removeEventListener("click", e), this.removeEventListener("touchstart", e); 142 }; 143 document.addEventListener("click", e), document.addEventListener("touchstart", e); 144 }, 145 close: function () { 146 this.inputEl.blur(), classie.remove(this.el, "sb-search-open"), classie.add(this.el, "sb-search-closed"); 147 }, 148 }), 149 (t.UISearch = e); 150 })(window);
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.