src/ztfy/myams/resources/js/ext/bootstrap-modalmanager.js
changeset 118 c87d242a1176
parent 0 8a19e25e39e4
child 155 e0fb6fd568eb
equal deleted inserted replaced
117:23c0c267b970 118:c87d242a1176
     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