{I" class:ETI"ProcessedAsset;FI"logical_path;TI"bootstrap-modalmanager.js;FI" pathname;TI"/home/lukas/.rvm/gems/ruby-2.0.0-p247/gems/bootstrap-modal-rails-2.1.1/vendor/assets/javascripts/bootstrap-modalmanager.js;FI"content_type;TI"application/javascript;TI" mtime;Tl+RI" length;Ti)I" digest;TI"%e4bf8f05863329f347f25f374d18ee57;FI" source;TI")/* =========================================================== * bootstrap-modalmanager.js v2.1 * =========================================================== * 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 ($) { "use strict"; // jshint ;_; /* MODAL MANAGER CLASS DEFINITION * ====================== */ var ModalManager = function (element, options) { this.init(element, options); }; ModalManager.prototype = { constructor: ModalManager, init: function (element, options) { this.$element = $(element); this.options = $.extend({}, $.fn.modalmanager.defaults, this.$element.data(), typeof options == 'object' && options); this.stack = []; this.backdropCount = 0; if (this.options.resize) { var resizeTimeout, that = this; $(window).on('resize.modal', function(){ resizeTimeout && clearTimeout(resizeTimeout); resizeTimeout = setTimeout(function(){ for (var i = 0; i < that.stack.length; i++){ that.stack[i].isShown && that.stack[i].layout(); } }, 10); }); } }, createModal: function (element, options) { $(element).modal($.extend({ manager: this }, options)); }, appendModal: function (modal) { this.stack.push(modal); var that = this; modal.$element.on('show.modalmanager', targetIsSelf(function (e) { var showModal = function(){ modal.isShown = true; var transition = $.support.transition && modal.$element.hasClass('fade'); that.$element .toggleClass('modal-open', that.hasOpenModal()) .toggleClass('page-overflow', $(window).height() < that.$element.height()); modal.$parent = modal.$element.parent(); modal.$container = that.createContainer(modal); modal.$element.appendTo(modal.$container); that.backdrop(modal, function () { modal.$element.show(); if (transition) { //modal.$element[0].style.display = 'run-in'; modal.$element[0].offsetWidth; //modal.$element.one($.support.transition.end, function () { modal.$element[0].style.display = 'block' }); } modal.layout(); modal.$element .addClass('in') .attr('aria-hidden', false); var complete = function () { that.setFocus(); modal.$element.trigger('shown'); }; transition ? modal.$element.one($.support.transition.end, complete) : complete(); }); }; modal.options.replace ? that.replace(showModal) : showModal(); })); modal.$element.on('hidden.modalmanager', targetIsSelf(function (e) { that.backdrop(modal); if (modal.$backdrop){ $.support.transition && modal.$element.hasClass('fade') ? modal.$backdrop.one($.support.transition.end, function () { that.destroyModal(modal) }) : that.destroyModal(modal); } else { that.destroyModal(modal); } })); modal.$element.on('destroy.modalmanager', targetIsSelf(function (e) { that.removeModal(modal); })); }, destroyModal: function (modal) { modal.destroy(); var hasOpenModal = this.hasOpenModal(); this.$element.toggleClass('modal-open', hasOpenModal); if (!hasOpenModal){ this.$element.removeClass('page-overflow'); } this.removeContainer(modal); this.setFocus(); }, hasOpenModal: function () { for (var i = 0; i < this.stack.length; i++){ if (this.stack[i].isShown) return true; } return false; }, setFocus: function () { var topModal; for (var i = 0; i < this.stack.length; i++){ if (this.stack[i].isShown) topModal = this.stack[i]; } if (!topModal) return; topModal.focus(); }, removeModal: function (modal) { modal.$element.off('.modalmanager'); if (modal.$backdrop) this.removeBackdrop(modal); this.stack.splice(this.getIndexOfModal(modal), 1); }, getModalAt: function (index) { return this.stack[index]; }, getIndexOfModal: function (modal) { for (var i = 0; i < this.stack.length; i++){ if (modal === this.stack[i]) return i; } }, replace: function (callback) { var topModal; for (var i = 0; i < this.stack.length; i++){ if (this.stack[i].isShown) topModal = this.stack[i]; } if (topModal) { this.$backdropHandle = topModal.$backdrop; topModal.$backdrop = null; callback && topModal.$element.one('hidden', targetIsSelf( $.proxy(callback, this) )); topModal.hide(); } else if (callback) { callback(); } }, removeBackdrop: function (modal) { modal.$backdrop.remove(); modal.$backdrop = null; }, createBackdrop: function (animate) { var $backdrop; if (!this.$backdropHandle) { $backdrop = $('