aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Kavlie <akavlie@gmail.com>2011-11-10 22:43:33 -0700
committerAaron Kavlie <akavlie@gmail.com>2011-11-10 22:43:33 -0700
commit34db1c53b45323c061544a7e0b990940574c36f5 (patch)
treea19d18167e8c40feafd02eb2dd33625f55ace647
parenta72859ea9917de8eae1b80aff98b8269c2ef5b45 (diff)
downloadreevo-webirc-34db1c53b45323c061544a7e0b990940574c36f5.tar.gz
reevo-webirc-34db1c53b45323c061544a7e0b990940574c36f5.zip
Upgrade twitter bootstrap modal JS.
-rw-r--r--js/bootstrap/bootstrap-modal.js56
1 files changed, 36 insertions, 20 deletions
diff --git a/js/bootstrap/bootstrap-modal.js b/js/bootstrap/bootstrap-modal.js
index 2cc9109..b328217 100644
--- a/js/bootstrap/bootstrap-modal.js
+++ b/js/bootstrap/bootstrap-modal.js
@@ -1,5 +1,5 @@
1/* ========================================================= 1/* =========================================================
2 * bootstrap-modal.js v1.3.0 2 * bootstrap-modal.js v1.4.0
3 * http://twitter.github.com/bootstrap/javascript.html#modal 3 * http://twitter.github.com/bootstrap/javascript.html#modal
4 * ========================================================= 4 * =========================================================
5 * Copyright 2011 Twitter, Inc. 5 * Copyright 2011 Twitter, Inc.
@@ -20,6 +20,8 @@
20 20
21!function( $ ){ 21!function( $ ){
22 22
23 "use strict"
24
23 /* CSS TRANSITION SUPPORT (https://gist.github.com/373874) 25 /* CSS TRANSITION SUPPORT (https://gist.github.com/373874)
24 * ======================================================= */ 26 * ======================================================= */
25 27
@@ -87,8 +89,7 @@
87 that.$element[0].offsetWidth // force reflow 89 that.$element[0].offsetWidth // force reflow
88 } 90 }
89 91
90 that.$element 92 that.$element.addClass('in')
91 .addClass('in')
92 93
93 transition ? 94 transition ?
94 that.$element.one(transitionEnd, function () { that.$element.trigger('shown') }) : 95 that.$element.one(transitionEnd, function () { that.$element.trigger('shown') }) :
@@ -115,17 +116,9 @@
115 .trigger('hide') 116 .trigger('hide')
116 .removeClass('in') 117 .removeClass('in')
117 118
118 function removeElement () {
119 that.$element
120 .hide()
121 .trigger('hidden')
122
123 backdrop.call(that)
124 }
125
126 $.support.transition && this.$element.hasClass('fade') ? 119 $.support.transition && this.$element.hasClass('fade') ?
127 this.$element.one(transitionEnd, removeElement) : 120 hideWithTransition.call(this) :
128 removeElement() 121 hideModal.call(this)
129 122
130 return this 123 return this
131 } 124 }
@@ -136,6 +129,28 @@
136 /* MODAL PRIVATE METHODS 129 /* MODAL PRIVATE METHODS
137 * ===================== */ 130 * ===================== */
138 131
132 function hideWithTransition() {
133 // firefox drops transitionEnd events :{o
134 var that = this
135 , timeout = setTimeout(function () {
136 that.$element.unbind(transitionEnd)
137 hideModal.call(that)
138 }, 500)
139
140 this.$element.one(transitionEnd, function () {
141 clearTimeout(timeout)
142 hideModal.call(that)
143 })
144 }
145
146 function hideModal (that) {
147 this.$element
148 .hide()
149 .trigger('hidden')
150
151 backdrop.call(this)
152 }
153
139 function backdrop ( callback ) { 154 function backdrop ( callback ) {
140 var that = this 155 var that = this
141 , animate = this.$element.hasClass('fade') ? 'fade' : '' 156 , animate = this.$element.hasClass('fade') ? 'fade' : ''
@@ -162,19 +177,20 @@
162 } else if ( !this.isShown && this.$backdrop ) { 177 } else if ( !this.isShown && this.$backdrop ) {
163 this.$backdrop.removeClass('in') 178 this.$backdrop.removeClass('in')
164 179
165 function removeElement() {
166 that.$backdrop.remove()
167 that.$backdrop = null
168 }
169
170 $.support.transition && this.$element.hasClass('fade')? 180 $.support.transition && this.$element.hasClass('fade')?
171 this.$backdrop.one(transitionEnd, removeElement) : 181 this.$backdrop.one(transitionEnd, $.proxy(removeBackdrop, this)) :
172 removeElement() 182 removeBackdrop.call(this)
183
173 } else if ( callback ) { 184 } else if ( callback ) {
174 callback() 185 callback()
175 } 186 }
176 } 187 }
177 188
189 function removeBackdrop() {
190 this.$backdrop.remove()
191 this.$backdrop = null
192 }
193
178 function escape() { 194 function escape() {
179 var that = this 195 var that = this
180 if ( this.isShown && this.settings.keyboard ) { 196 if ( this.isShown && this.settings.keyboard ) {