X-Git-Url: http://repos.xcallymotion.com/?a=blobdiff_plain;f=public%2Fbower_components%2Fbootstrap-select%2Fbootstrap-select.js;h=4a1a052a55fd263b46b6340b7802b9bc03f8b9bb;hb=5d92478b1cb7479f39a43973775a6f6147fba8ac;hp=7d4b79f48d20f3f0f96e9579f251d946d7d84f80;hpb=6fdab3092eb5921e04b504e7c4b8d9a83a249fb1;p=motion.git diff --git a/public/bower_components/bootstrap-select/bootstrap-select.js b/public/bower_components/bootstrap-select/bootstrap-select.js index 7d4b79f..4a1a052 100644 --- a/public/bower_components/bootstrap-select/bootstrap-select.js +++ b/public/bower_components/bootstrap-select/bootstrap-select.js @@ -1,5 +1,5 @@ /*! - * Bootstrap-select v1.7.5 (http://silviomoreto.github.io/bootstrap-select) + * Bootstrap-select v1.7.7 (http://silviomoreto.github.io/bootstrap-select) * * Copyright 2013-2015 bootstrap-select * Licensed under MIT (https://github.com/silviomoreto/bootstrap-select/blob/master/LICENSE) @@ -279,7 +279,7 @@ this.setStyle = Selectpicker.prototype.setStyle; this.selectAll = Selectpicker.prototype.selectAll; this.deselectAll = Selectpicker.prototype.deselectAll; - this.destroy = Selectpicker.prototype.remove; + this.destroy = Selectpicker.prototype.destroy; this.remove = Selectpicker.prototype.remove; this.show = Selectpicker.prototype.show; this.hide = Selectpicker.prototype.hide; @@ -287,7 +287,7 @@ this.init(); }; - Selectpicker.VERSION = '1.7.5'; + Selectpicker.VERSION = '1.7.7'; // part of this is duplicated in i18n/defaults-en_US.js. Make sure to update both. Selectpicker.DEFAULTS = { @@ -720,10 +720,10 @@ li = document.createElement('li'), a = document.createElement('a'), text = document.createElement('span'), - header = this.options.header ? this.$menu.find('.popover-title')[0].cloneNode(true) : null, + header = this.options.header && this.$menu.find('.popover-title').length > 0 ? this.$menu.find('.popover-title')[0].cloneNode(true) : null, search = this.options.liveSearch ? document.createElement('div') : null, - actions = this.options.actionsBox && this.multiple ? this.$menu.find('.bs-actionsbox')[0].cloneNode(true) : null, - doneButton = this.options.doneButton && this.multiple ? this.$menu.find('.bs-donebutton')[0].cloneNode(true) : null; + actions = this.options.actionsBox && this.multiple && this.$menu.find('.bs-actionsbox').length > 0 ? this.$menu.find('.bs-actionsbox')[0].cloneNode(true) : null, + doneButton = this.options.doneButton && this.multiple && this.$menu.find('.bs-donebutton').length > 0 ? this.$menu.find('.bs-donebutton')[0].cloneNode(true) : null; text.className = 'text'; newElement.className = this.$menu[0].parentNode.className + ' open'; @@ -932,15 +932,16 @@ }, selectPosition: function () { + this.$bsContainer = $('
'); + var that = this, - $drop = $('
'), pos, actualHeight, getPlacement = function ($element) { - $drop.addClass($element.attr('class').replace(/form-control|fit-width/gi, '')).toggleClass('dropup', $element.hasClass('dropup')); + that.$bsContainer.addClass($element.attr('class').replace(/form-control|fit-width/gi, '')).toggleClass('dropup', $element.hasClass('dropup')); pos = $element.offset(); actualHeight = $element.hasClass('dropup') ? 0 : $element[0].offsetHeight; - $drop.css({ + that.$bsContainer.css({ 'top': pos.top + actualHeight, 'left': pos.left, 'width': $element[0].offsetWidth @@ -948,13 +949,18 @@ }; this.$newElement.on('click', function () { + var $this = $(this); + if (that.isDisabled()) { return; } - getPlacement($(this)); - $drop.appendTo(that.options.container); - $drop.toggleClass('open', !$(this).hasClass('open')); - $drop.append(that.$menu); + + getPlacement($this); + + that.$bsContainer + .appendTo(that.options.container) + .toggleClass('open', !$this.hasClass('open')) + .append(that.$menu); }); $(window).on('resize scroll', function () { @@ -963,7 +969,7 @@ this.$element.on('hide.bs.select', function () { that.$menu.data('height', that.$menu.height()); - $drop.detach(); + that.$bsContainer.detach(); }); }, @@ -1577,6 +1583,21 @@ remove: function () { this.$newElement.remove(); this.$element.remove(); + }, + + destroy: function() { + this.$newElement.remove(); + + if (this.$bsContainer) { + this.$bsContainer.remove(); + } else { + this.$menu.remove(); + } + + this.$element + .off('.bs.select') + .removeData('selectpicker') + .removeClass('bs-select-hidden selectpicker'); } }; @@ -1641,7 +1662,7 @@ $(document) .data('keycount', 0) - .on('keydown', '.bootstrap-select [data-toggle=dropdown], .bootstrap-select [role="menu"], .bs-searchbox input', Selectpicker.prototype.keydown) + .on('keydown.bs.select', '.bootstrap-select [data-toggle=dropdown], .bootstrap-select [role="menu"], .bs-searchbox input', Selectpicker.prototype.keydown) .on('focusin.modal', '.bootstrap-select [data-toggle=dropdown], .bootstrap-select [role="menu"], .bs-searchbox input', function (e) { e.stopPropagation(); });