/* =========================================================== * bootstrap-modalmanager.min.js v2.2.5 * =========================================================== * Copyright 2012 Jordan Schroter * * 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. * ========================================================== */ !function(c) { var a = function(f, e) { this.init(f, e) }; a.prototype = { constructor : a, init : function(f, e) { this.$element = c(f); this.options = c.extend({}, c.fn.modalmanager.defaults, this.$element.data(), typeof e == "object" && e); this.stack = []; this.backdropCount = 0; if (this.options.resize) { var h, g = this; c(window).on("resize.modal", function() { h && clearTimeout(h); h = setTimeout(function() { for (var j = 0; j < g.stack.length; j++) { g.stack[j].isShown && g.stack[j].layout() } }, 10) }) } }, createModal : function(f, e) { c(f).modal(c.extend({ manager : this }, e)) }, appendModal : function(f) { this.stack.push(f); var e = this; f.$element.on("show.modalmanager", b(function(h) { var g = function() { f.isShown = true; var i = c.support.transition && f.$element.hasClass("fade"); e.$element.toggleClass("modal-open", e.hasOpenModal()).toggleClass( "page-overflow", c(window).height() < e.$element.height()); f.$parent = f.$element.parent(); f.$container = e.createContainer(f); f.$element.appendTo(f.$container); e.backdrop(f, function() { f.$element.show(); if (i) { f.$element[0].offsetWidth } f.layout(); f.$element.addClass("in").attr("aria-hidden", false); var j = function() { e.setFocus(); f.$element.trigger("shown") }; i ? f.$element.one(c.support.transition.end, j) : j() }) }; f.options.replace ? e.replace(g) : g() })); f.$element .on( "hidden.modalmanager", b(function(g) { e.backdrop(f); if (!f.$element.parent().length) { e.destroyModal(f) } else { if (f.$backdrop) { var h = c.support.transition && f.$element.hasClass("fade"); if (h) { f.$element[0].offsetWidth } c.support.transition && f.$element.hasClass("fade") ? f.$backdrop .one(c.support.transition.end, function() { f.destroy() }) : f.destroy() } else { f.destroy() } } })); f.$element.on("destroyed.modalmanager", b(function(g) { e.destroyModal(f) })) }, getOpenModals : function() { var f = []; for (var e = 0; e < this.stack.length; e++) { if (this.stack[e].isShown) { f.push(this.stack[e]) } } return f }, hasOpenModal : function() { return this.getOpenModals().length > 0 }, setFocus : function() { var f; for (var e = 0; e < this.stack.length; e++) { if (this.stack[e].isShown) { f = this.stack[e] } } if (!f) { return } f.focus() }, destroyModal : function(f) { f.$element.off(".modalmanager"); if (f.$backdrop) { this.removeBackdrop(f) } this.stack.splice(this.getIndexOfModal(f), 1); var e = this.hasOpenModal(); this.$element.toggleClass("modal-open", e); if (!e) { this.$element.removeClass("page-overflow") } this.removeContainer(f); this.setFocus() }, getModalAt : function(e) { return this.stack[e] }, getIndexOfModal : function(f) { for (var e = 0; e < this.stack.length; e++) { if (f === this.stack[e]) { return e } } }, replace : function(g) { var f; for (var e = 0; e < this.stack.length; e++) { if (this.stack[e].isShown) { f = this.stack[e] } } if (f) { this.$backdropHandle = f.$backdrop; f.$backdrop = null; g && f.$element.one("hidden", b(c.proxy(g, this))); f.hide() } else { if (g) { g() } } }, removeBackdrop : function(e) { e.$backdrop.remove(); e.$backdrop = null }, createBackdrop : function(g, f) { var e; if (!this.$backdropHandle) { e = c(f).addClass(g).appendTo(this.$element) } else { e = this.$backdropHandle; e.off(".modalmanager"); this.$backdropHandle = null; this.isLoading && this.removeSpinner() } return e }, removeContainer : function(e) { e.$container.remove(); e.$container = null }, createContainer : function(e) { var f; f = c('