diff options
author | Thomas Park <thomas@thomaspark.me> | 2014-02-02 22:34:20 -0500 |
---|---|---|
committer | Thomas Park <thomas@thomaspark.me> | 2014-02-02 22:34:20 -0500 |
commit | 303ba425d14820c93528555c60b355fcc9e67df8 (patch) | |
tree | 2e277027cb9a929fefa84d87b621d3a3940ba863 /bower_components/bootstrap/js/modal.js | |
parent | 9fdf7a68d3f4f89e9ea9aea74c485ed31d767ee4 (diff) |
upgrade bootstrap to 3.1.0
Diffstat (limited to 'bower_components/bootstrap/js/modal.js')
-rw-r--r-- | bower_components/bootstrap/js/modal.js | 53 |
1 files changed, 25 insertions, 28 deletions
diff --git a/bower_components/bootstrap/js/modal.js b/bower_components/bootstrap/js/modal.js index 3ead5ee8..24506ea2 100644 --- a/bower_components/bootstrap/js/modal.js +++ b/bower_components/bootstrap/js/modal.js @@ -1,24 +1,14 @@ /* ======================================================================== - * Bootstrap: modal.js v3.0.3 + * Bootstrap: modal.js v3.1.0 * http://getbootstrap.com/javascript/#modals * ======================================================================== - * Copyright 2013 Twitter, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Copyright 2011-2014 Twitter, Inc. + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * ======================================================================== */ -+function ($) { "use strict"; ++function ($) { + 'use strict'; // MODAL CLASS DEFINITION // ====================== @@ -29,13 +19,19 @@ this.$backdrop = this.isShown = null - if (this.options.remote) this.$element.load(this.options.remote) + if (this.options.remote) { + this.$element + .find('.modal-content') + .load(this.options.remote, $.proxy(function () { + this.$element.trigger('loaded.bs.modal') + }, this)) + } } Modal.DEFAULTS = { - backdrop: true - , keyboard: true - , show: true + backdrop: true, + keyboard: true, + show: true } Modal.prototype.toggle = function (_relatedTarget) { @@ -54,7 +50,7 @@ this.escape() - this.$element.on('click.dismiss.modal', '[data-dismiss="modal"]', $.proxy(this.hide, this)) + this.$element.on('click.dismiss.bs.modal', '[data-dismiss="modal"]', $.proxy(this.hide, this)) this.backdrop(function () { var transition = $.support.transition && that.$element.hasClass('fade') @@ -63,7 +59,9 @@ that.$element.appendTo(document.body) // don't move modals dom position } - that.$element.show() + that.$element + .show() + .scrollTop(0) if (transition) { that.$element[0].offsetWidth // force reflow @@ -105,7 +103,7 @@ this.$element .removeClass('in') .attr('aria-hidden', true) - .off('click.dismiss.modal') + .off('click.dismiss.bs.modal') $.support.transition && this.$element.hasClass('fade') ? this.$element @@ -149,7 +147,6 @@ } Modal.prototype.backdrop = function (callback) { - var that = this var animate = this.$element.hasClass('fade') ? 'fade' : '' if (this.isShown && this.options.backdrop) { @@ -158,7 +155,7 @@ this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />') .appendTo(document.body) - this.$element.on('click.dismiss.modal', $.proxy(function (e) { + this.$element.on('click.dismiss.bs.modal', $.proxy(function (e) { if (e.target !== e.currentTarget) return this.options.backdrop == 'static' ? this.$element[0].focus.call(this.$element[0]) @@ -180,7 +177,7 @@ } else if (!this.isShown && this.$backdrop) { this.$backdrop.removeClass('in') - $.support.transition && this.$element.hasClass('fade')? + $.support.transition && this.$element.hasClass('fade') ? this.$backdrop .one($.support.transition.end, callback) .emulateTransitionEnd(150) : @@ -228,9 +225,9 @@ var $this = $(this) var href = $this.attr('href') var $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) //strip for ie7 - var option = $target.data('modal') ? 'toggle' : $.extend({ remote: !/#/.test(href) && href }, $target.data(), $this.data()) + var option = $target.data('bs.modal') ? 'toggle' : $.extend({ remote: !/#/.test(href) && href }, $target.data(), $this.data()) - e.preventDefault() + if ($this.is('a')) e.preventDefault() $target .modal(option, this) @@ -240,7 +237,7 @@ }) $(document) - .on('show.bs.modal', '.modal', function () { $(document.body).addClass('modal-open') }) + .on('show.bs.modal', '.modal', function () { $(document.body).addClass('modal-open') }) .on('hidden.bs.modal', '.modal', function () { $(document.body).removeClass('modal-open') }) }(jQuery); |