summaryrefslogtreecommitdiff
path: root/assets/js/bootstrap-modal.js
diff options
context:
space:
mode:
authorThomas Park <thomas@thomaspark.me>2012-05-03 13:48:57 -0400
committerThomas Park <thomas@thomaspark.me>2012-05-03 13:48:57 -0400
commit0f0a0f9f8a57dc9e22839b2706ced578755518ef (patch)
tree9f6f2a702f46602a438a280ace67b268a0ed1911 /assets/js/bootstrap-modal.js
parent1e104e46ac4ac608705cc4b81fa092d178de3b91 (diff)
index: updated site itself to 2.0.3
Diffstat (limited to 'assets/js/bootstrap-modal.js')
-rwxr-xr-xassets/js/bootstrap-modal.js42
1 files changed, 25 insertions, 17 deletions
diff --git a/assets/js/bootstrap-modal.js b/assets/js/bootstrap-modal.js
index e9297062..c831de6b 100755
--- a/assets/js/bootstrap-modal.js
+++ b/assets/js/bootstrap-modal.js
@@ -1,5 +1,5 @@
/* =========================================================
- * bootstrap-modal.js v2.0.2
+ * bootstrap-modal.js v2.0.3
* http://twitter.github.com/bootstrap/javascript.html#modals
* =========================================================
* Copyright 2012 Twitter, Inc.
@@ -18,14 +18,15 @@
* ========================================================= */
-!function( $ ){
+!function ($) {
+
+ "use strict"; // jshint ;_;
- "use strict"
/* MODAL CLASS DEFINITION
* ====================== */
- var Modal = function ( content, options ) {
+ var Modal = function (content, options) {
this.options = options
this.$element = $(content)
.delegate('[data-dismiss="modal"]', 'click.dismiss.modal', $.proxy(this.hide, this))
@@ -41,19 +42,23 @@
, show: function () {
var that = this
+ , e = $.Event('show')
+
+ this.$element.trigger(e)
- if (this.isShown) return
+ if (this.isShown || e.isDefaultPrevented()) return
$('body').addClass('modal-open')
this.isShown = true
- this.$element.trigger('show')
escape.call(this)
backdrop.call(this, function () {
var transition = $.support.transition && that.$element.hasClass('fade')
- !that.$element.parent().length && that.$element.appendTo(document.body) //don't move modals dom position
+ if (!that.$element.parent().length) {
+ that.$element.appendTo(document.body) //don't move modals dom position
+ }
that.$element
.show()
@@ -71,21 +76,24 @@
})
}
- , hide: function ( e ) {
+ , hide: function (e) {
e && e.preventDefault()
- if (!this.isShown) return
-
var that = this
+
+ e = $.Event('hide')
+
+ this.$element.trigger(e)
+
+ if (!this.isShown || e.isDefaultPrevented()) return
+
this.isShown = false
$('body').removeClass('modal-open')
escape.call(this)
- this.$element
- .trigger('hide')
- .removeClass('in')
+ this.$element.removeClass('in')
$.support.transition && this.$element.hasClass('fade') ?
hideWithTransition.call(this) :
@@ -111,7 +119,7 @@
})
}
- function hideModal( that ) {
+ function hideModal(that) {
this.$element
.hide()
.trigger('hidden')
@@ -119,7 +127,7 @@
backdrop.call(this)
}
- function backdrop( callback ) {
+ function backdrop(callback) {
var that = this
, animate = this.$element.hasClass('fade') ? 'fade' : ''
@@ -173,7 +181,7 @@
/* MODAL PLUGIN DEFINITION
* ======================= */
- $.fn.modal = function ( option ) {
+ $.fn.modal = function (option) {
return this.each(function () {
var $this = $(this)
, data = $this.data('modal')
@@ -207,4 +215,4 @@
})
})
-}( window.jQuery ); \ No newline at end of file
+}(window.jQuery); \ No newline at end of file