From: Marius Gavrilescu Date: Thu, 26 Mar 2015 17:43:34 +0000 (+0200) Subject: Update 10-bootstrap-modal.js X-Git-Url: http://git.ieval.ro/?a=commitdiff_plain;ds=sidebyside;h=30c4e6d3ecb421e30650768274e55977fb8de0cb;p=gruntmaster-page.git Update 10-bootstrap-modal.js --- diff --git a/js/10-bootstrap-modal.js b/js/10-bootstrap-modal.js index 7381296..920f333 100644 --- a/js/10-bootstrap-modal.js +++ b/js/10-bootstrap-modal.js @@ -1,5 +1,5 @@ /* ======================================================================== - * Bootstrap: modal.js v3.3.2 + * Bootstrap: modal.js v3.3.4 * http://getbootstrap.com/javascript/#modals * ======================================================================== * Copyright 2011-2015 Twitter, Inc. @@ -14,12 +14,15 @@ // ====================== 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 @@ -30,7 +33,7 @@ } } - Modal.VERSION = '3.3.2' + Modal.VERSION = '3.3.4' Modal.TRANSITION_DURATION = 300 Modal.BACKDROP_TRANSITION_DURATION = 150 @@ -64,6 +67,12 @@ 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') @@ -75,7 +84,6 @@ .show() .scrollTop(0) - if (that.options.backdrop) that.adjustBackdrop() that.adjustDialog() if (transition) { @@ -91,7 +99,7 @@ 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) }) @@ -120,6 +128,9 @@ .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 @@ -180,13 +191,18 @@ var doAnimate = $.support.transition && animate this.$backdrop = $('