equal
deleted
inserted
replaced
1 /* =========================================================== |
1 /* =========================================================== |
2 * bootstrap-modalmanager.js v2.2.4 |
2 * bootstrap-modalmanager.js v2.2.5 |
3 * =========================================================== |
3 * =========================================================== |
4 * Copyright 2012 Jordan Schroter. |
4 * Copyright 2012 Jordan Schroter. |
5 * |
5 * |
6 * Licensed under the Apache License, Version 2.0 (the "License"); |
6 * Licensed under the Apache License, Version 2.0 (the "License"); |
7 * you may not use this file except in compliance with the License. |
7 * you may not use this file except in compliance with the License. |
114 // handle the case when a modal may have been removed from the dom before this callback executes |
114 // handle the case when a modal may have been removed from the dom before this callback executes |
115 if (!modal.$element.parent().length) { |
115 if (!modal.$element.parent().length) { |
116 that.destroyModal(modal); |
116 that.destroyModal(modal); |
117 } else if (modal.$backdrop) { |
117 } else if (modal.$backdrop) { |
118 var transition = $.support.transition && modal.$element.hasClass('fade'); |
118 var transition = $.support.transition && modal.$element.hasClass('fade'); |
|
119 |
119 // trigger a relayout due to firebox's buggy transition end event |
120 // trigger a relayout due to firebox's buggy transition end event |
120 if (transition) |
121 if (transition) |
121 modal.$element[0].offsetWidth; |
122 modal.$element[0].offsetWidth; |
122 $.support.transition && modal.$element.hasClass('fade') ? |
123 $.support.transition && modal.$element.hasClass('fade') ? |
123 modal.$backdrop.one($.support.transition.end, function () { |
124 modal.$backdrop.one($.support.transition.end, function () { |
125 }) : |
126 }) : |
126 modal.destroy(); |
127 modal.destroy(); |
127 } else { |
128 } else { |
128 modal.destroy(); |
129 modal.destroy(); |
129 } |
130 } |
130 that.removeContainer(modal); |
|
131 |
131 |
132 })); |
132 })); |
133 |
133 |
134 modal.$element.on('destroyed.modalmanager', targetIsSelf(function (e) { |
134 modal.$element.on('destroyed.modalmanager', targetIsSelf(function (e) { |
135 that.destroyModal(modal); |
135 that.destroyModal(modal); |
308 this.$backdropHandle = null; |
308 this.$backdropHandle = null; |
309 this.removeSpinner(); |
309 this.removeSpinner(); |
310 }, |
310 }, |
311 |
311 |
312 loading: function (callback) { |
312 loading: function (callback) { |
313 callback = callback || function () { |
313 callback = callback || function () {}; |
314 }; |
|
315 |
314 |
316 this.$element |
315 this.$element |
317 .toggleClass('modal-open', !this.isLoading || this.hasOpenModal()) |
316 .toggleClass('modal-open', !this.isLoading || this.hasOpenModal()) |
318 .toggleClass('page-overflow', $(window).height() < this.$element.height()); |
317 .toggleClass('page-overflow', $(window).height() < this.$element.height()); |
319 |
318 |
391 // make sure the event target is the modal itself in order to prevent |
390 // make sure the event target is the modal itself in order to prevent |
392 // other components such as tabsfrom triggering the modal manager. |
391 // other components such as tabsfrom triggering the modal manager. |
393 // if Boostsrap namespaced events, this would not be needed. |
392 // if Boostsrap namespaced events, this would not be needed. |
394 function targetIsSelf(callback) { |
393 function targetIsSelf(callback) { |
395 return function (e) { |
394 return function (e) { |
396 if (this === e.target) { |
395 if (e && this === e.target){ |
397 return callback.apply(this, arguments); |
396 return callback.apply(this, arguments); |
398 } |
397 } |
399 } |
398 } |
400 } |
399 } |
401 |
400 |