From e0ddfcdf288c23bd97b8511a290db7291ccf1860 Mon Sep 17 00:00:00 2001 From: Gleb Mazovetskiy Date: Sat, 7 Mar 2015 18:58:03 +0000 Subject: rake convert --- assets/javascripts/bootstrap.js | 136 +++++++++++++------------ assets/javascripts/bootstrap.min.js | 4 +- assets/javascripts/bootstrap/affix.js | 4 +- assets/javascripts/bootstrap/carousel.js | 8 +- assets/javascripts/bootstrap/collapse.js | 8 +- assets/javascripts/bootstrap/dropdown.js | 2 +- assets/javascripts/bootstrap/modal.js | 56 +++++----- assets/javascripts/bootstrap/popover.js | 7 +- assets/javascripts/bootstrap/scrollspy.js | 33 +++--- assets/javascripts/bootstrap/tooltip.js | 18 ++-- assets/stylesheets/bootstrap/_modals.scss | 4 +- assets/stylesheets/bootstrap/_scaffolding.scss | 12 +++ assets/stylesheets/bootstrap/_type.scss | 2 +- assets/stylesheets/bootstrap/_variables.scss | 3 +- lib/bootstrap-sass/version.rb | 2 +- templates/project/_bootstrap-variables.sass | 3 +- 16 files changed, 161 insertions(+), 141 deletions(-) diff --git a/assets/javascripts/bootstrap.js b/assets/javascripts/bootstrap.js index 5a11cc2..d2f3948 100644 --- a/assets/javascripts/bootstrap.js +++ b/assets/javascripts/bootstrap.js @@ -307,10 +307,10 @@ if (typeof jQuery === 'undefined') { this.$element = $(element) this.$indicators = this.$element.find('.carousel-indicators') this.options = options - this.paused = - this.sliding = - this.interval = - this.$active = + this.paused = null + this.sliding = null + this.interval = null + this.$active = null this.$items = null this.options.keyboard && this.$element.on('keydown.bs.carousel', $.proxy(this.keydown, this)) @@ -544,7 +544,8 @@ if (typeof jQuery === 'undefined') { var Collapse = function (element, options) { this.$element = $(element) this.options = $.extend({}, Collapse.DEFAULTS, options) - this.$trigger = $(this.options.trigger).filter('[href="#' + element.id + '"], [data-target="#' + element.id + '"]') + this.$trigger = $('[data-toggle="collapse"][href="#' + element.id + '"],' + + '[data-toggle="collapse"][data-target="#' + element.id + '"]') this.transitioning = null if (this.options.parent) { @@ -561,8 +562,7 @@ if (typeof jQuery === 'undefined') { Collapse.TRANSITION_DURATION = 350 Collapse.DEFAULTS = { - toggle: true, - trigger: '[data-toggle="collapse"]' + toggle: true } Collapse.prototype.dimension = function () { @@ -731,7 +731,7 @@ if (typeof jQuery === 'undefined') { var $target = getTargetFromTrigger($this) var data = $target.data('bs.collapse') - var option = data ? 'toggle' : $.extend({}, $this.data(), { trigger: this }) + var option = data ? 'toggle' : $this.data() Plugin.call($target, option) }) @@ -812,7 +812,7 @@ if (typeof jQuery === 'undefined') { return $this.trigger('click') } - var desc = ' li:not(.divider):visible a' + var desc = ' li:not(.disabled):visible a' var $items = $parent.find('[role="menu"]' + desc + ', [role="listbox"]' + desc) if (!$items.length) return @@ -916,12 +916,15 @@ if (typeof jQuery === 'undefined') { // ====================== var Modal = function (element, options) { - this.options = options - this.$body = $(document.body) - this.$element = $(element) - this.$backdrop = - this.isShown = null - this.scrollbarWidth = 0 + this.options = options + this.$body = $(document.body) + this.$element = $(element) + this.$dialog = this.$element.find('.modal-dialog') + this.$backdrop = null + this.isShown = null + this.originalBodyPad = null + this.scrollbarWidth = 0 + this.ignoreBackdropClick = false if (this.options.remote) { this.$element @@ -966,6 +969,12 @@ if (typeof jQuery === 'undefined') { this.$element.on('click.dismiss.bs.modal', '[data-dismiss="modal"]', $.proxy(this.hide, this)) + this.$dialog.on('mousedown.dismiss.bs.modal', function () { + that.$element.one('mouseup.dismiss.bs.modal', function (e) { + if ($(e.target).is(that.$element)) that.ignoreBackdropClick = true + }) + }) + this.backdrop(function () { var transition = $.support.transition && that.$element.hasClass('fade') @@ -977,7 +986,6 @@ if (typeof jQuery === 'undefined') { .show() .scrollTop(0) - if (that.options.backdrop) that.adjustBackdrop() that.adjustDialog() if (transition) { @@ -993,7 +1001,7 @@ if (typeof jQuery === 'undefined') { var e = $.Event('shown.bs.modal', { relatedTarget: _relatedTarget }) transition ? - that.$element.find('.modal-dialog') // wait for modal to slide in + that.$dialog // wait for modal to slide in .one('bsTransitionEnd', function () { that.$element.trigger('focus').trigger(e) }) @@ -1022,6 +1030,9 @@ if (typeof jQuery === 'undefined') { .removeClass('in') .attr('aria-hidden', true) .off('click.dismiss.bs.modal') + .off('mouseup.dismiss.bs.modal') + + this.$dialog.off('mousedown.dismiss.bs.modal') $.support.transition && this.$element.hasClass('fade') ? this.$element @@ -1082,13 +1093,18 @@ if (typeof jQuery === 'undefined') { var doAnimate = $.support.transition && animate this.$backdrop = $('