1/*! 2 * Bootstrap-select v1.7.3 (http://silviomoreto.github.io/bootstrap-select) 3 * 4 * Copyright 2013-2015 bootstrap-select 5 * Licensed under MIT (https://github.com/silviomoreto/bootstrap-select/blob/master/LICENSE) 6 */ 7! function(a, b) { 8 "function" == typeof define && define.amd ? define(["jquery"], function(a) { 9 return b(a) 10 }) : "object" == typeof exports ? module.exports = b(require("jquery")) : b(jQuery) 11}(this, function() { 12 ! function(a) { 13 "use strict"; 14 15 function b(b) { 16 var c = [{ 17 re: /[\xC0-\xC6]/g, 18 ch: "A" 19 }, { 20 re: /[\xE0-\xE6]/g, 21 ch: "a" 22 }, { 23 re: /[\xC8-\xCB]/g, 24 ch: "E" 25 }, { 26 re: /[\xE8-\xEB]/g, 27 ch: "e" 28 }, { 29 re: /[\xCC-\xCF]/g, 30 ch: "I" 31 }, { 32 re: /[\xEC-\xEF]/g, 33 ch: "i" 34 }, { 35 re: /[\xD2-\xD6]/g, 36 ch: "O" 37 }, { 38 re: /[\xF2-\xF6]/g, 39 ch: "o" 40 }, { 41 re: /[\xD9-\xDC]/g, 42 ch: "U" 43 }, { 44 re: /[\xF9-\xFC]/g, 45 ch: "u" 46 }, { 47 re: /[\xC7-\xE7]/g, 48 ch: "c" 49 }, { 50 re: /[\xD1]/g, 51 ch: "N" 52 }, { 53 re: /[\xF1]/g, 54 ch: "n" 55 }]; 56 return a.each(c, function() { 57 b = b.replace(this.re, this.ch) 58 }), b 59 } 60 61 function c(a) { 62 var b = { 63 "&": "&", 64 "<": "<", 65 ">": ">", 66 '"': """, 67 "'": "'", 68 "`": "`" 69 }, 70 c = "(?:" + Object.keys(b).join("|") + ")", 71 d = new RegExp(c), 72 e = new RegExp(c, "g"), 73 f = null == a ? "" : "" + a; 74 return d.test(f) ? f.replace(e, function(a) { 75 return b[a] 76 }) : f 77 } 78 79 function d(b, c) { 80 var d = arguments, 81 f = b, 82 g = c; 83 [].shift.apply(d); 84 var h, i = this.each(function() { 85 var b = a(this); 86 if (b.is("select")) { 87 var c = b.data("selectpicker"), 88 i = "object" == typeof f && f; 89 if (c) { 90 if (i) 91 for (var j in i) i.hasOwnProperty(j) && (c.options[j] = i[j]) 92 } else { 93 var k = a.extend({}, e.DEFAULTS, a.fn.selectpicker.defaults || {}, b.data(), i); 94 b.data("selectpicker", c = new e(this, k, g)) 95 } 96 "string" == typeof f && (h = c[f] instanceof Function ? c[f].apply(c, d) : c.options[f]) 97 } 98 }); 99 return "undefined" != typeof h ? h : i 100 } 101 String.prototype.includes || ! function() { 102 var a = {}.toString, 103 b = function() { 104 try { 105 var a = {}, 106 b = Object.defineProperty, 107 c = b(a, a, a) && b 108 } catch (d) {} 109 return c 110 }(), 111 c = "".indexOf, 112 d = function(b) { 113 if (null == this) throw TypeError(); 114 var d = String(this); 115 if (b && "[object RegExp]" == a.call(b)) throw TypeError(); 116 var e = d.length, 117 f = String(b), 118 g = f.length, 119 h = arguments.length > 1 ? arguments[1] : void 0, 120 i = h ? Number(h) : 0; 121 i != i && (i = 0); 122 var j = Math.min(Math.max(i, 0), e); 123 return g + j > e ? !1 : -1 != c.call(d, f, i) 124 }; 125 b ? b(String.prototype, "includes", { 126 value: d, 127 configurable: !0, 128 writable: !0 129 }) : String.prototype.includes = d 130 }(), String.prototype.startsWith || ! function() { 131 var a = function() { 132 try { 133 var a = {}, 134 b = Object.defineProperty, 135 c = b(a, a, a) && b 136 } catch (d) {} 137 return c 138 }(), 139 b = {}.toString, 140 c = function(a) { 141 if (null == this) throw TypeError(); 142 var c = String(this); 143 if (a && "[object RegExp]" == b.call(a)) throw TypeError(); 144 var d = c.length, 145 e = String(a), 146 f = e.length, 147 g = arguments.length > 1 ? arguments[1] : void 0, 148 h = g ? Number(g) : 0; 149 h != h && (h = 0); 150 var i = Math.min(Math.max(h, 0), d); 151 if (f + i > d) return !1; 152 for (var j = -1; ++j < f;) 153 if (c.charCodeAt(i + j) != e.charCodeAt(j)) return !1; 154 return !0 155 }; 156 a ? a(String.prototype, "startsWith", { 157 value: c, 158 configurable: !0, 159 writable: !0 160 }) : String.prototype.startsWith = c 161 }(), Object.keys || (Object.keys = function(a, b, c) { 162 c = []; 163 for (b in a) c.hasOwnProperty.call(a, b) && c.push(b); 164 return c 165 }), a.fn.triggerNative = function(a) { 166 var b, c = this[0]; 167 c.dispatchEvent ? ("function" == typeof Event ? b = new Event(a, { 168 bubbles: !0 169 }) : (b = document.createEvent("Event"), b.initEvent(a, !0, !1)), c.dispatchEvent(b)) : (c.fireEvent && (b = document.createEventObject(), b.eventType = a, c.fireEvent("on" + a, b)), this.trigger(a)) 170 }, a.expr[":"].icontains = function(b, c, d) { 171 var e = a(b), 172 f = (e.data("tokens") || e.text()).toUpperCase(); 173 return f.includes(d[3].toUpperCase()) 174 }, a.expr[":"].ibegins = function(b, c, d) { 175 var e = a(b), 176 f = (e.data("tokens") || e.text()).toUpperCase(); 177 return f.startsWith(d[3].toUpperCase()) 178 }, a.expr[":"].aicontains = function(b, c, d) { 179 var e = a(b), 180 f = (e.data("tokens") || e.data("normalizedText") || e.text()).toUpperCase(); 181 return f.includes(d[3].toUpperCase()) 182 }, a.expr[":"].aibegins = function(b, c, d) { 183 var e = a(b), 184 f = (e.data("tokens") || e.data("normalizedText") || e.text()).toUpperCase(); 185 return f.startsWith(d[3].toUpperCase()) 186 }; 187 var e = function(b, c, d) { 188 d && (d.stopPropagation(), d.preventDefault()), this.$element = a(b), this.$newElement = null, this.$button = null, this.$menu = null, this.$lis = null, this.options = c, null === this.options.title && (this.options.title = this.$element.attr("title")), this.val = e.prototype.val, this.render = e.prototype.render, this.refresh = e.prototype.refresh, this.setStyle = e.prototype.setStyle, this.selectAll = e.prototype.selectAll, this.deselectAll = e.prototype.deselectAll, this.destroy = e.prototype.remove, this.remove = e.prototype.remove, this.show = e.prototype.show, this.hide = e.prototype.hide, this.init() 189 }; 190 e.VERSION = "1.7.2", e.DEFAULTS = { 191 noneSelectedText: "Nic wybranego", //Nothing selected 192 noneResultsText: "No results matched {0}", 193 countSelectedText: function(a, b) { 194 return 1 == a ? "{0} item selected" : " WYBIERZ KATEGORIĘ" //items selected 195 }, 196 maxOptionsText: function(a, b) { 197 return [1 == a ? "Limit reached ({n} item max)" : "Limit reached ({n} items max)", 1 == b ? "Group limit reached ({n} item max)" : "Group limit reached ({n} items max)"] 198 }, 199 selectAllText: "Wszystkie", 200 deselectAllText: "Skasuj", 201 doneButton: !1, 202 doneButtonText: "Zamknij", 203 multipleSeparator: ", ", 204 styleBase: "btn", 205 style: "btn-default", 206 size: "auto", 207 title: null, 208 selectedTextFormat: "values", 209 width: !1, 210 container: !1, 211 hideDisabled: !1, 212 showSubtext: !1, 213 showIcon: !0, 214 showContent: !0, 215 dropupAuto: !0, 216 header: !1, 217 liveSearch: !1, 218 liveSearchPlaceholder: null, 219 liveSearchNormalize: !1, 220 liveSearchStyle: "contains", 221 actionsBox: !1, 222 iconBase: "glyphicon", 223 tickIcon: "glyphicon-ok", 224 maxOptions: !1, 225 mobile: !1, 226 selectOnTab: !1, 227 dropdownAlignRight: !1 228 }, e.prototype = { 229 constructor: e, 230 init: function() { 231 var b = this, 232 c = this.$element.attr("id"); 233 this.$element.addClass("bs-select-hidden"), this.liObj = {}, this.multiple = this.$element.prop("multiple"), this.autofocus = this.$element.prop("autofocus"), this.$newElement = this.createView(), this.$element.after(this.$newElement), this.$button = this.$newElement.children("button"), this.$menu = this.$newElement.children(".dropdown-menu"), this.$menuInner = this.$menu.children(".inner"), this.$searchbox = this.$menu.find("input"), this.options.dropdownAlignRight && this.$menu.addClass("dropdown-menu-right"), "undefined" != typeof c && (this.$button.attr("data-id", c), a('label[for="' + c + '"]').click(function(a) { 234 a.preventDefault(), b.$button.focus() 235 })), this.checkDisabled(), this.clickListener(), this.options.liveSearch && this.liveSearchListener(), this.render(), this.setStyle(), this.setWidth(), this.options.container && this.selectPosition(), this.$menu.data("this", this), this.$newElement.data("this", this), this.options.mobile && this.mobile(), this.$newElement.on("hide.bs.dropdown", function(a) { 236 b.$element.trigger("hide.bs.select", a) 237 }), this.$newElement.on("hidden.bs.dropdown", function(a) { 238 b.$element.trigger("hidden.bs.select", a) 239 }), this.$newElement.on("show.bs.dropdown", function(a) { 240 b.$element.trigger("show.bs.select", a) 241 }), this.$newElement.on("shown.bs.dropdown", function(a) { 242 b.$element.trigger("shown.bs.select", a) 243 }), setTimeout(function() { 244 b.$element.trigger("loaded.bs.select") 245 }) 246 }, 247 createDropdown: function() { 248 var b = this.multiple ? " show-tick" : "", 249 d = this.$element.parent().hasClass("input-group") ? " input-group-btn" : "", 250 e = this.autofocus ? " autofocus" : "", 251 f = this.options.header ? '<div class="popover-title"><button type="button" class="close" aria-hidden="true">×</button>' + this.options.header + "</div>" : "", 252 g = this.options.liveSearch ? '<div class="bs-searchbox"><input type="text" class="form-control" autocomplete="off"' + (null === this.options.liveSearchPlaceholder ? "" : ' placeholder="' + c(this.options.liveSearchPlaceholder) + '"') + "></div>" : "", 253 h = this.multiple && this.options.actionsBox ? '<div class="bs-actionsbox"><div class="btn-group btn-group-sm btn-block"><button type="button" class="actions-btn bs-select-all btn btn-default">' + this.options.selectAllText + '</button><button type="button" class="actions-btn bs-deselect-all btn btn-default">' + this.options.deselectAllText + '</button><button type="button" class="btn btn-sm btn-default">' + this.options.doneButtonText + "</button></div></div>" : "", 254 i = this.multiple && this.options.doneButton ? '<div class="bs-donebutton"><div class="btn-group btn-block"><button type="button" class="btn btn-sm btn-default">' + this.options.doneButtonText + "</button></div></div>" : "", 255 j = '<div class="btn-group bootstrap-select' + b + d + '"><button type="button" class="' + this.options.styleBase + ' dropdown-toggle" data-toggle="dropdown"' + e + '><span class="filter-option pull-left"></span> <span class="caret"></span></button><div class="dropdown-menu open">' + f + g + h + '<ul class="dropdown-menu inner" role="menu"></ul>' + i + "</div></div>"; 256 257 258 return a(j) 259 }, 260 createView: function() { 261 var a = this.createDropdown(), 262 b = this.createLi(); 263 return a.find("ul")[0].innerHTML = b, a 264 }, 265 reloadLi: function() { 266 this.destroyLi(); 267 var a = this.createLi(); 268 this.$menuInner[0].innerHTML = a 269 }, 270 destroyLi: function() { 271 this.$menu.find("li").remove() 272 }, 273 createLi: function() { 274 var d = this, 275 e = [], 276 f = 0, 277 g = document.createElement("option"), 278 h = -1, 279 i = function(a, b, c, d) { 280 return "<li" + ("undefined" != typeof c & "" !== c ? ' class="' + c + '"' : "") + ("undefined" != typeof b & null !== b ? ' data-original-index="' + b + '"' : "") + ("undefined" != typeof d & null !== d ? 'data-optgroup="' + d + '"' : "") + ">" + a + "</li>" 281 }, 282 j = function(a, e, f, g) { 283 return '<a tabindex="0"' + ("undefined" != typeof e ? ' class="' + e + '"' : "") + ("undefined" != typeof f ? ' style="' + f + '"' : "") + (d.options.liveSearchNormalize ? ' data-normalized-text="' + b(c(a)) + '"' : "") + ("undefined" != typeof g || null !== g ? ' data-tokens="' + g + '"' : "") + ">" + a + '<span class="' + d.options.iconBase + " " + d.options.tickIcon + ' check-mark"></span></a>' 284 }; 285 if (this.options.title && !this.multiple && (h--, !this.$element.find(".bs-title-option").length)) { 286 var k = this.$element[0]; 287 g.className = "bs-title-option", g.appendChild(document.createTextNode(this.options.title)), g.value = "", k.insertBefore(g, k.firstChild), void 0 === a(k.options[k.selectedIndex]).attr("selected") && (g.selected = !0) 288 } 289 return this.$element.find("option").each(function(b) { 290 var c = a(this); 291 if (h++, !c.hasClass("bs-title-option")) { 292 var g = this.className || "", 293 k = this.style.cssText,
294 l = c.data("content") ? c.data("content") : c.html(), 295 m = c.data("tokens") ? c.data("tokens") : null, 296 n = "undefined" != typeof c.data("subtext") ? '<small class="text-muted">' + c.data("subtext") + "</small>" : "", 297 o = "undefined" != typeof c.data("icon") ? '<span class="' + d.options.iconBase + " " + c.data("icon") + '"></span> ' : "", 298 p = this.disabled || "OPTGROUP" === this.parentElement.tagName && this.parentElement.disabled; 299 if ("" !== o && p && (o = "<span>" + o + "</span>"), d.options.hideDisabled && p) return void h--; 300 if (c.data("content") || (l = o + '<span class="text">' + l + n + "</span>"), "OPTGROUP" === this.parentElement.tagName && c.data("divider") !== !0) { 301 var q = " " + this.parentElement.className || ""; 302 if (0 === c.index()) { 303 f += 1; 304 var r = this.parentElement.label, 305 s = "undefined" != typeof c.parent().data("subtext") ? '<small class="text-muted">' + c.parent().data("subtext") + "</small>" : "", 306 t = c.parent().data("icon") ? '<span class="' + d.options.iconBase + " " + c.parent().data("icon") + '"></span> ' : ""; 307 r = t + '<span class="text">' + r + s + "</span>", 0 !== b && e.length > 0 && (h++, e.push(i("", null, "divider", f + "div"))), h++, e.push(i(r, null, "dropdown-header" + q, f)) 308 } 309 e.push(i(j(l, "opt " + g + q, k, m), b, "", f)) 310 } else c.data("divider") === !0 ? e.push(i("", b, "divider")) : c.data("hidden") === !0 ? e.push(i(j(l, g, k, m), b, "hidden is-hidden")) : (this.previousElementSibling && "OPTGROUP" === this.previousElementSibling.tagName && (h++, e.push(i("", null, "divider", f + "div"))), e.push(i(j(l, g, k, m), b))); 311 d.liObj[b] = h 312 } 313 }), this.multiple || 0 !== this.$element.find("option:selected").length || this.options.title || this.$element.find("option").eq(0).prop("selected", !0).attr("selected", "selected"), e.join("") 314 }, 315 findLis: function() { 316 return null == this.$lis && (this.$lis = this.$menu.find("li")), this.$lis 317 }, 318 render: function(b) { 319 var c, d = this; 320 b !== !1 && this.$element.find("option").each(function(a) { 321 var b = d.findLis().eq(d.liObj[a]); 322 d.setDisabled(a, this.disabled || "OPTGROUP" === this.parentElement.tagName && this.parentElement.disabled, b), d.setSelected(a, this.selected, b) 323 }), this.tabIndex(); 324 var e = this.$element.find("option").map(function() { 325 if (this.selected) { 326 if (d.options.hideDisabled && (this.disabled || "OPTGROUP" === this.parentElement.tagName && this.parentElement.disabled)) return !1; 327 var b, c = a(this), 328 e = c.data("icon") && d.options.showIcon ? '<i class="' + d.options.iconBase + " " + c.data("icon") + '"></i> ' : ""; 329 return b = d.options.showSubtext && c.data("subtext") && !d.multiple ? ' <small class="text-muted">' + c.data("subtext") + "</small>" : "", "undefined" != typeof c.attr("title") ? c.attr("title") : c.data("content") && d.options.showContent ? c.data("content") : e + c.html() + b 330 } 331 }).toArray(), 332 f = this.multiple ? e.join(this.options.multipleSeparator) : e[0]; 333 if (this.multiple && this.options.selectedTextFormat.indexOf("count") > -1) { 334 var g = this.options.selectedTextFormat.split(">"); 335 if (g.length > 1 && e.length > g[1] || 1 == g.length && e.length >= 2) { 336 c = this.options.hideDisabled ? ", [disabled]" : ""; 337 var h = this.$element.find("option").not('[data-divider="true"], [data-hidden="true"]' + c).length, 338 i = "function" == typeof this.options.countSelectedText ? this.options.countSelectedText(e.length, h) : this.options.countSelectedText; 339 f = i.replace("{0}", e.length.toString()).replace("{1}", h.toString()) 340 } 341 } 342 void 0 == this.options.title && (this.options.title = this.$element.attr("title")), "static" == this.options.selectedTextFormat && (f = this.options.title), f || (f = "undefined" != typeof this.options.title ? this.options.title : this.options.noneSelectedText), this.$button.attr("title", a.trim(f.replace(/<[^>]*>?/g, ""))), this.$button.children(".filter-option").html(f), this.$element.trigger("rendered.bs.select") 343 }, 344 setStyle: function(a, b) { 345 this.$element.attr("class") && this.$newElement.addClass(this.$element.attr("class").replace(/selectpicker|mobile-device|bs-select-hidden|validate\[.*\]/gi, "")); 346 var c = a ? a : this.options.style; 347 "add" == b ? this.$button.addClass(c) : "remove" == b ? this.$button.removeClass(c) : (this.$button.removeClass(this.options.style), this.$button.addClass(c)) 348 }, 349 liHeight: function(b) { 350 if (b || this.options.size !== !1 && !this.sizeInfo) { 351 var c = document.createElement("div"), 352 d = document.createElement("div"), 353 e = document.createElement("ul"), 354 f = document.createElement("li"), 355 g = document.createElement("li"), 356 h = document.createElement("a"), 357 i = document.createElement("span"), 358 j = this.options.header ? this.$menu.find(".popover-title")[0].cloneNode(!0) : null, 359 k = this.options.liveSearch ? document.createElement("div") : null, 360 l = this.options.actionsBox && this.multiple ? this.$menu.find(".bs-actionsbox")[0].cloneNode(!0) : null, 361 m = this.options.doneButton && this.multiple ? this.$menu.find(".bs-donebutton")[0].cloneNode(!0) : null; 362 if (i.className = "text", c.className = this.$menu[0].parentNode.className + " open", d.className = "dropdown-menu open", e.className = "dropdown-menu inner", f.className = "divider", i.appendChild(document.createTextNode("Inner text")), h.appendChild(i), g.appendChild(h), e.appendChild(g), e.appendChild(f), j && d.appendChild(j), k) { 363 var n = document.createElement("span"); 364 k.className = "bs-searchbox", n.className = "form-control", k.appendChild(n), d.appendChild(k) 365 } 366 l && d.appendChild(l), d.appendChild(e), m && d.appendChild(m), c.appendChild(d), document.body.appendChild(c); 367 var o = h.offsetHeight, 368 p = j ? j.offsetHeight : 0, 369 q = k ? k.offsetHeight : 0, 370 r = l ? l.offsetHeight : 0, 371 s = m ? m.offsetHeight : 0, 372 t = a(f).outerHeight(!0), 373 u = "function" == typeof getComputedStyle ? getComputedStyle(d) : !1, 374 v = u ? null : a(d), 375 w = parseInt(u ? u.paddingTop : v.css("paddingTop")) + parseInt(u ? u.paddingBottom : v.css("paddingBottom")) + parseInt(u ? u.borderTopWidth : v.css("borderTopWidth")) + parseInt(u ? u.borderBottomWidth : v.css("borderBottomWidth")), 376 x = w + parseInt(u ? u.marginTop : v.css("marginTop")) + parseInt(u ? u.marginBottom : v.css("marginBottom")) + 2; 377 document.body.removeChild(c), this.sizeInfo = { 378 liHeight: o, 379 headerHeight: p, 380 searchHeight: q, 381 actionsHeight: r, 382 doneButtonHeight: s, 383 dividerHeight: t, 384 menuPadding: w, 385 menuExtras: x 386 } 387 } 388 }, 389 setSize: function() { 390 if (this.findLis(), this.liHeight(), this.options.header && this.$menu.css("padding-top", 0), this.options.size !== !1) { 391 var b, c, d, e, f = this, 392 g = this.$menu, 393 h = this.$menuInner,
394 i = a(window), 395 j = this.$newElement[0].offsetHeight, 396 k = this.sizeInfo.liHeight, 397 l = this.sizeInfo.headerHeight, 398 m = this.sizeInfo.searchHeight, 399 n = this.sizeInfo.actionsHeight, 400 o = this.sizeInfo.doneButtonHeight, 401 p = this.sizeInfo.dividerHeight, 402 q = this.sizeInfo.menuPadding, 403 r = this.sizeInfo.menuExtras, 404 s = this.options.hideDisabled ? ".disabled" : "", 405 t = function() { 406 d = f.$newElement.offset().top - i.scrollTop(), e = i.height() - d - j 407 }; 408 if (t(), "auto" === this.options.size) { 409 var u = function() { 410 var i, j = function(b, c) { 411 return function(d) { 412 return c ? d.classList ? d.classList.contains(b) : a(d).hasClass(b) : !(d.classList ? d.classList.contains(b) : a(d).hasClass(b)) 413 } 414 }, 415 p = f.$menuInner[0].getElementsByTagName("li"), 416 s = Array.prototype.filter ? Array.prototype.filter.call(p, j("hidden", !1)) : f.$lis.not(".hidden"), 417 u = Array.prototype.filter ? Array.prototype.filter.call(s, j("dropdown-header", !0)) : s.filter(".dropdown-header"); 418 t(), b = e - r, f.options.container ? (g.data("height") || g.data("height", g.height()), c = g.data("height")) : c = g.height(), f.options.dropupAuto && f.$newElement.toggleClass("dropup", d > e && c > b - r), f.$newElement.hasClass("dropup") && (b = d - r), i = s.length + u.length > 3 ? 3 * k + r - 2 : 0, g.css({ 419 "max-height": b + "px", 420 overflow: "hidden", 421 "min-height": i + l + m + n + o + "px" 422 }), h.css({ 423 "max-height": b - l - m - n - o - q + "px", 424 "overflow-y": "auto", 425 "min-height": Math.max(i - q, 0) + "px" 426 }) 427 }; 428 u(), this.$searchbox.off("input.getSize propertychange.getSize").on("input.getSize propertychange.getSize", u), i.off("resize.getSize scroll.getSize").on("resize.getSize scroll.getSize", u) 429 } else if (this.options.size && "auto" != this.options.size && this.$lis.not(s).length > this.options.size) { 430 var v = this.$lis.not(".divider").not(s).children().slice(0, this.options.size).last().parent().index(), 431 w = this.$lis.slice(0, v + 1).filter(".divider").length; 432 b = k * this.options.size + w * p + q, f.options.container ? (g.data("height") || g.data("height", g.height()), c = g.data("height")) : c = g.height(), f.options.dropupAuto && this.$newElement.toggleClass("dropup", d > e && c > b - r), g.css({ 433 "max-height": b + l + m + n + o + "px", 434 overflow: "hidden", 435 "min-height": "" 436 }), h.css({ 437 "max-height": b - q + "px", 438 "overflow-y": "auto", 439 "min-height": "" 440 }) 441 } 442 } 443 }, 444 setWidth: function() { 445 if ("auto" === this.options.width) { 446 this.$menu.css("min-width", "0"); 447 var a = this.$menu.parent().clone().appendTo("body"), 448 b = this.options.container ? this.$newElement.clone().appendTo("body") : a, 449 c = a.children(".dropdown-menu").outerWidth(), 450 d = b.css("width", "auto").children("button").outerWidth(); 451 a.remove(), b.remove(), this.$newElement.css("width", Math.max(c, d) + "px") 452 } else "fit" === this.options.width ? (this.$menu.css("min-width", ""), this.$newElement.css("width", "").addClass("fit-width")) : this.options.width ? (this.$menu.css("min-width", ""), this.$newElement.css("width", this.options.width)) : (this.$menu.css("min-width", ""), this.$newElement.css("width", "")); 453 this.$newElement.hasClass("fit-width") && "fit" !== this.options.width && this.$newElement.removeClass("fit-width") 454 }, 455 selectPosition: function() { 456 var b, c, d = this, 457 e = "<div />", 458 f = a(e), 459 g = function(a) { 460 f.addClass(a.attr("class").replace(/form-control|fit-width/gi, "")).toggleClass("dropup", a.hasClass("dropup")), b = a.offset(), c = a.hasClass("dropup") ? 0 : a[0].offsetHeight, f.css({ 461 top: b.top + c, 462 left: b.left, 463 width: a[0].offsetWidth, 464 position: "absolute" 465 }) 466 }; 467 this.$newElement.on("click", function() { 468 d.isDisabled() || (g(a(this)), f.appendTo(d.options.container), f.toggleClass("open", !a(this).hasClass("open")), f.append(d.$menu)) 469 }), a(window).on("resize scroll", function() { 470 g(d.$newElement) 471 }), this.$element.on("hide.bs.select", function() { 472 d.$menu.data("height", d.$menu.height()), f.detach() 473 }) 474 }, 475 setSelected: function(a, b, c) { 476 if (!c) var c = this.findLis().eq(this.liObj[a]); 477 c.toggleClass("selected", b) 478 }, 479 setDisabled: function(a, b, c) { 480 if (!c) var c = this.findLis().eq(this.liObj[a]); 481 b ? c.addClass("disabled").children("a").attr("href", "#").attr("tabindex", -1) : c.removeClass("disabled").children("a").removeAttr("href").attr("tabindex", 0) 482 }, 483 isDisabled: function() { 484 return this.$element[0].disabled 485 }, 486 checkDisabled: function() { 487 var a = this; 488 this.isDisabled() ? (this.$newElement.addClass("disabled"), this.$button.addClass("disabled").attr("tabindex", -1)) : (this.$button.hasClass("disabled") && (this.$newElement.removeClass("disabled"), this.$button.removeClass("disabled")), -1 != this.$button.attr("tabindex") || this.$element.data("tabindex") || this.$button.removeAttr("tabindex")), this.$button.click(function() { 489 return !a.isDisabled() 490 }) 491 }, 492 tabIndex: function() { 493 this.$element.is("[tabindex]") && (this.$element.data("tabindex", this.$element.attr("tabindex")), this.$button.attr("tabindex", this.$element.data("tabindex"))) 494 }, 495 clickListener: function() { 496 var b = this, 497 c = a(document); 498 this.$newElement.on("touchstart.dropdown", ".dropdown-menu", function(a) { 499 a.stopPropagation() 500 }), c.data("spaceSelect", !1), this.$button.on("keyup", function(a) { 501 /(32)/.test(a.keyCode.toString(10)) && c.data("spaceSelect") && (a.preventDefault(), c.data("spaceSelect", !1)) 502 }), this.$newElement.on("click", function() { 503 b.setSize(), b.$element.on("shown.bs.select", function() { 504 if (b.options.liveSearch || b.multiple) { 505 if (!b.multiple) { 506 var a = b.liObj[b.$element[0].selectedIndex]; 507 if ("number" != typeof a || b.options.size === !1) return; 508 var c = b.$lis.eq(a)[0].offsetTop - b.$menuInner[0].offsetTop; 509 c = c - b.$menuInner[0].offsetHeight / 2 + b.sizeInfo.liHeight / 2, b.$menuInner[0].scrollTop = c 510 } 511 } else b.$menu.find(".selected a").focus() 512 }) 513 }), this.$menu.on("click", "li a", function(c) { 514 var d = a(this), 515 e = d.parent().data("originalIndex"), 516 f = b.$element.val(), 517 g = b.$element.prop("selectedIndex"); 518 if (b.multiple && c.stopPropagation(), c.preventDefault(), !b.isDisabled() && !d.parent().hasClass("disabled")) { 519 var h = b.$element.find("option"), 520 i = h.eq(e), 521 j = i.prop("selected"), 522 k = i.parent("optgroup"), 523 l = b.options.maxOptions, 524 m = k.data("maxOptions") || !1; 525 if (b.multiple) { 526 if (i.prop("selected", !j), b.setSelected(e, !j), d.blur(), l !== !1 || m !== !1) { 527 var n = l < h.filter(":selected").length, 528 o = m < k.find("option:selected").length; 529 if (l && n || m && o) 530 if (l && 1 == l) h.prop("selected", !1), i.prop("selected", !0), b.$menu.find(".selected").removeClass("selected"), b.setSelected(e, !0); 531 else if (m && 1 == m) { 532 k.find("option:selected").prop("selected", !1), i.prop("selected", !0); 533 var p = d.parent().data("optgroup"); 534 b.$menu.find('[data-optgroup="' + p + '"]').removeClass("selected"), b.setSelected(e, !0) 535 } else { 536 var q = "function" == typeof b.options.maxOptionsText ? b.options.maxOptionsText(l, m) : b.options.maxOptionsText, 537 r = q[0].replace("{n}", l), 538 s = q[1].replace("{n}", m), 539 t = a('<div class="notify"></div>'); 540 q[2] && (r = r.replace("{var}", q[2][l > 1 ? 0 : 1]), s = s.replace("{var}", q[2][m > 1 ? 0 : 1])), i.prop("selected", !1), b.$menu.append(t), l && n && (t.append(a("<div>" + r + "</div>")), b.$element.trigger("maxReached.bs.select")), m && o && (t.append(a("<div>" + s + "</div>")), b.$element.trigger("maxReachedGrp.bs.select")), setTimeout(function() { 541 b.setSelected(e, !1) 542 }, 10), t.delay(750).fadeOut(300, function() { 543 a(this).remove() 544 }) 545 } 546 } 547 } else h.prop("selected", !1), i.prop("selected", !0), b.$menu.find(".selected").removeClass("selected"), b.setSelected(e, !0); 548 b.multiple ? b.options.liveSearch && b.$searchbox.focus() : b.$button.focus(), (f != b.$element.val() && b.multiple || g != b.$element.prop("selectedIndex") && !b.multiple) && (b.$element.triggerNative("change"), b.$element.trigger("changed.bs.select", [e, i.prop("selected"), j])) 549 } 550 }), this.$menu.on("click", "li.disabled a, .popover-title, .popover-title :not(.close)", function(c) { 551 c.currentTarget == this && (c.preventDefault(), c.stopPropagation(), b.options.liveSearch && !a(c.target).hasClass("close") ? b.$searchbox.focus() : b.$button.focus()) 552 }), this.$menu.on("click", "li.divider, li.dropdown-header", function(a) { 553 a.preventDefault(), a.stopPropagation(), b.options.liveSearch ? b.$searchbox.focus() : b.$button.focus() 554 }), this.$menu.on("click", ".popover-title .close", function() { 555 b.$button.click() 556 }), this.$searchbox.on("click", function(a) { 557 a.stopPropagation() 558 }), this.$menu.on("click", ".actions-btn", function(c) { 559 b.options.liveSearch ? b.$searchbox.focus() : b.$button.focus(), c.preventDefault(), c.stopPropagation(), a(this).hasClass("bs-select-all") ? b.selectAll() : b.deselectAll(), b.$element.triggerNative("change") 560 }), this.$element.change(function() { 561 b.render(!1) 562 }) 563 }, 564 liveSearchListener: function() { 565 var d = this, 566 e = a('<li class="no-results"></li>'); 567 this.$newElement.on("click.dropdown.data-api touchstart.dropdown.data-api", function() { 568 d.$menuInner.find(".active").removeClass("active"), d.$searchbox.val() && (d.$searchbox.val(""), d.$lis.not(".is-hidden").removeClass("hidden"), e.parent().length && e.remove()), d.multiple || d.$menuInner.find(".selected").addClass("active"), setTimeout(function() { 569 d.$searchbox.focus() 570 }, 10) 571 }), this.$searchbox.on("click.dropdown.data-api focus.dropdown.data-api touchend.dropdown.data-api", function(a) { 572 a.stopPropagation() 573 }), this.$searchbox.on("input propertychange", function() { 574 if (d.$searchbox.val()) { 575 var f = d.$lis.not(".is-hidden").removeClass("hidden").children("a"); 576 f = d.options.liveSearchNormalize ? f.not(":a" + d._searchStyle() + '("' + b(d.$searchbox.val()) + '")') : f.not(":" + d._searchStyle() + '("' + d.$searchbox.val() + '")'), f.parent().addClass("hidden"), d.$lis.filter(".dropdown-header").each(function() { 577 var b = a(this), 578 c = b.data("optgroup"); 579 0 === d.$lis.filter("[data-optgroup=" + c + "]").not(b).not(".hidden").length && (b.addClass("hidden"), d.$lis.filter("[data-optgroup=" + c + "div]").addClass("hidden")) 580 }); 581 var g = d.$lis.not(".hidden"); 582 g.each(function(b) { 583 var c = a(this); 584 c.hasClass("divider") && (c.index() === g.eq(0).index() || c.index() === g.last().index() || g.eq(b + 1).hasClass("divider")) && c.addClass("hidden") 585 }), d.$lis.not(".hidden, .no-results").length ? e.parent().length && e.remove() : (e.parent().length && e.remove(), e.html(d.options.noneResultsText.replace("{0}", '"' + c(d.$searchbox.val()) + '"')).show(), d.$menuInner.append(e)) 586 } else d.$lis.not(".is-hidden").removeClass("hidden"), e.parent().length && e.remove(); 587 d.$lis.filter(".active").removeClass("active"), d.$searchbox.val() && d.$lis.not(".hidden, .divider, .dropdown-header").eq(0).addClass("active").children("a").focus(), a(this).focus() 588 }) 589 }, 590 _searchStyle: function() { 591 var a = "icontains"; 592 switch (this.options.liveSearchStyle) { 593 case "begins": 594 case "startsWith": 595 a = "ibegins"; 596 break; 597 case "contains": 598 } 599 return a 600 }, 601 val: function(a) { 602 return "undefined" != typeof a ? (this.$element.val(a), this.render(), this.$element) : this.$element.val() 603 }, 604 selectAll: function() { 605 this.findLis(), this.$element.find("option:enabled").not("[data-divider], [data-hidden]").prop("selected", !0), this.$lis.not(".divider, .dropdown-header, .disabled, .hidden").addClass("selected"), this.render(!1) 606 }, 607 deselectAll: function()
607 { 608 this.findLis(), this.$element.find("option:enabled").not("[data-divider], [data-hidden]").prop("selected", !1), this.$lis.not(".divider, .dropdown-header, .disabled, .hidden").removeClass("selected"), this.render(!1) 609 }, 610 keydown: function(c) { 611 var d, e, f, g, h, i, j, k, l, m = a(this), 612 n = m.is("input") ? m.parent().parent() : m.parent(), 613 o = n.data("this"), 614 p = ":not(.disabled, .hidden, .dropdown-header, .divider)", 615 q = { 616 32: " ", 617 48: "0", 618 49: "1", 619 50: "2", 620 51: "3", 621 52: "4", 622 53: "5", 623 54: "6", 624 55: "7", 625 56: "8", 626 57: "9", 627 59: ";", 628 65: "a", 629 66: "b", 630 67: "c", 631 68: "d", 632 69: "e", 633 70: "f", 634 71: "g", 635 72: "h", 636 73: "i", 637 74: "j", 638 75: "k", 639 76: "l", 640 77: "m", 641 78: "n", 642 79: "o", 643 80: "p", 644 81: "q", 645 82: "r", 646 83: "s", 647 84: "t", 648 85: "u", 649 86: "v", 650 87: "w", 651 88: "x", 652 89: "y", 653 90: "z", 654 96: "0", 655 97: "1", 656 98: "2", 657 99: "3", 658 100: "4", 659 101: "5", 660 102: "6", 661 103: "7", 662 104: "8", 663 105: "9" 664 }; 665 if (o.options.liveSearch && (n = m.parent().parent()), o.options.container && (n = o.$menu), d = a("[role=menu] li a", n), l = o.$menu.parent().hasClass("open"), !l && (c.keyCode >= 48 && c.keyCode <= 57 || c.keyCode >= 65 && c.keyCode <= 90) && (o.options.container ? o.$newElement.trigger("click") : (o.setSize(), o.$menu.parent().addClass("open"), l = !0), o.$searchbox.focus()), o.options.liveSearch && (/(^9$|27)/.test(c.keyCode.toString(10)) && l && 0 === o.$menu.find(".active").length && (c.preventDefault(), o.$menu.parent().removeClass("open"), o.options.container && o.$newElement.removeClass("open"), o.$button.focus()), d = a("[role=menu] li:not(.disabled, .hidden, .dropdown-header, .divider)", n), m.val() || /(38|40)/.test(c.keyCode.toString(10)) || 0 === d.filter(".active").length && (d = o.$newElement.find("li"), d = o.options.liveSearchNormalize ? d.filter(":a" + o._searchStyle() + "(" + b(q[c.keyCode]) + ")") : d.filter(":" + o._searchStyle() + "(" + q[c.keyCode] + ")"))), d.length) { 666 if (/(38|40)/.test(c.keyCode.toString(10))) e = d.index(d.filter(":focus")), g = d.parent(p).first().data("originalIndex"), h = d.parent(p).last().data("originalIndex"), f = d.eq(e).parent().nextAll(p).eq(0).data("originalIndex"), i = d.eq(e).parent().prevAll(p).eq(0).data("originalIndex"), j = d.eq(f).parent().prevAll(p).eq(0).data("originalIndex"), o.options.liveSearch && (d.each(function(b) { 667 a(this).hasClass("disabled") || a(this).data("index", b) 668 }), e = d.index(d.filter(".active")), g = d.first().data("index"), h = d.last().data("index"), f = d.eq(e).nextAll().eq(0).data("index"), i = d.eq(e).prevAll().eq(0).data("index"), j = d.eq(f).prevAll().eq(0).data("index")), k = m.data("prevIndex"), 38 == c.keyCode ? (o.options.liveSearch && (e -= 1), e != j && e > i && (e = i), g > e && (e = g), e == k && (e = h)) : 40 == c.keyCode && (o.options.liveSearch && (e += 1), -1 == e && (e = 0), e != j && f > e && (e = f), e > h && (e = h), e == k && (e = g)), m.data("prevIndex", e), o.options.liveSearch ? (c.preventDefault(), m.hasClass("dropdown-toggle") || (d.removeClass("active").eq(e).addClass("active").children("a").focus(), m.focus())) : d.eq(e).focus(); 669 else if (!m.is("input")) { 670 var r, s, t = []; 671 d.each(function() { 672 a(this).parent().hasClass("disabled") || a.trim(a(this).text().toLowerCase()).substring(0, 1) == q[c.keyCode] && t.push(a(this).parent().index()) 673 }), r = a(document).data("keycount"), r++, a(document).data("keycount", r), s = a.trim(a(":focus").text().toLowerCase()).substring(0, 1), s != q[c.keyCode] ? (r = 1, a(document).data("keycount", r)) : r >= t.length && (a(document).data("keycount", 0), r > t.length && (r = 1)), d.eq(t[r - 1]).focus() 674 } 675 if ((/(13|32)/.test(c.keyCode.toString(10)) || /(^9$)/.test(c.keyCode.toString(10)) && o.options.selectOnTab) && l) { 676 if (/(32)/.test(c.keyCode.toString(10)) || c.preventDefault(), o.options.liveSearch) /(32)/.test(c.keyCode.toString(10)) || (o.$menu.find(".active a").click(), m.focus()); 677 else { 678 var u = a(":focus"); 679 u.click(), u.focus(), c.preventDefault(), a(document).data("spaceSelect", !0) 680 } 681 a(document).data("keycount", 0) 682 }(/(^9$|27)/.test(c.keyCode.toString(10)) && l && (o.multiple || o.options.liveSearch) || /(27)/.test(c.keyCode.toString(10)) && !l) && (o.$menu.parent().removeClass("open"), o.options.container && o.$newElement.removeClass("open"), o.$button.focus()) 683 } 684 }, 685 mobile: function() { 686 this.$element.addClass("mobile-device").appendTo(this.$newElement), this.options.container && this.$menu.hide() 687 }, 688 refresh: function() { 689 this.$lis = null, this.liObj = {}, this.reloadLi(), this.render(), this.checkDisabled(), this.liHeight(!0), this.setStyle(), this.setWidth(), this.$lis && this.$searchbox.trigger("propertychange"), this.$element.trigger("refreshed.bs.select") 690 }, 691 hide: function() { 692 this.$newElement.hide() 693 }, 694 show: function() { 695 this.$newElement.show() 696 }, 697 remove: function() { 698 this.$newElement.remove(), this.$element.remove() 699 } 700 }; 701 var f = a.fn.selectpicker; 702 a.fn.selectpicker = d, a.fn.selectpicker.Constructor = e, a.fn.selectpicker.noConflict = function() { 703 return a.fn.selectpicker = f, this 704 }, a(document).data("keycount", 0).on("keydown", '.bootstrap-select [data-toggle=dropdown], .bootstrap-select [role="menu"], .bs-searchbox input', e.prototype.keydown).on("focusin.modal", '.bootstrap-select [data-toggle=dropdown], .bootstrap-select [role="menu"], .bs-searchbox input', function(a) { 705 a.stopPropagation() 706 }), a(window).on("load.bs.select.data-api", function() { 707 a(".selectpicker").each(function() { 708 var b = a(this); 709 d.call(b, b.data()) 710 }) 711 }) 712 }(jQuery) 713}); 714//# sourceMappingURL=bootstrap-select.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.