/* ======================================================================== * bootstrap: modal.js v3.2.0 * http://getbootstrap.com/javascript/#modals * ======================================================================== * copyright 2011-2014 twitter, inc. * licensed under mit (https://github.com/twbs/bootstrap/blob/master/license) * ======================================================================== */ +function ($) { 'use strict'; // modal class definition // ====================== var modal = function (element, options) { this.options = options this.$body = $(document.body) this.$element = $(element) this.$backdrop = this.isshown = null this.scrollbarwidth = 0 if (this.options.remote) { this.$element .find('.modal-content') .load(this.options.remote, $.proxy(function () { this.$element.trigger('loaded.bs.modal') }, this)) } } modal.version = '3.2.0' modal.defaults = { backdrop: true, keyboard: true, show: true } modal.prototype.toggle = function (_relatedtarget) { return this.isshown ? this.hide() : this.show(_relatedtarget) } modal.prototype.show = function (_relatedtarget) { var that = this var e = $.event('show.bs.modal', { relatedtarget: _relatedtarget }) this.$element.trigger(e) if (this.isshown || e.isdefaultprevented()) return this.isshown = true this.checkscrollbar() this.$body.addclass('modal-open') this.setscrollbar() this.escape() this.$element.on('click.dismiss.bs.modal', '[data-dismiss="modal"]', $.proxy(this.hide, this)) this.backdrop(function () { var transition = $.support.transition && that.$element.hasclass('fade') if (!that.$element.parent().length) { that.$element.appendto(that.$body) // don't move modals dom position } that.$element .show() .scrolltop(0) if (transition) { that.$element[0].offsetwidth // force reflow } that.$element .addclass('in') .attr('aria-hidden', false) that.enforcefocus() var e = $.event('shown.bs.modal', { relatedtarget: _relatedtarget }) transition ? that.$element.find('.modal-dialog') // wait for modal to slide in .one('bstransitionend', function () { that.$element.trigger('focus').trigger(e) }) .emulatetransitionend(300) : that.$element.trigger('focus').trigger(e) }) } modal.prototype.hide = function (e) { if (e) e.preventdefault() e = $.event('hide.bs.modal') this.$element.trigger(e) if (!this.isshown || e.isdefaultprevented()) return this.isshown = false this.$body.removeclass('modal-open') this.resetscrollbar() this.escape() $(document).off('focusin.bs.modal') this.$element .removeclass('in') .attr('aria-hidden', true) .off('click.dismiss.bs.modal') $.support.transition && this.$element.hasclass('fade') ? this.$element .one('bstransitionend', $.proxy(this.hidemodal, this)) .emulatetransitionend(300) : this.hidemodal() } modal.prototype.enforcefocus = function () { $(document) .off('focusin.bs.modal') // guard against infinite focus loop .on('focusin.bs.modal', $.proxy(function (e) { if (this.$element[0] !== e.target && !this.$element.has(e.target).length) { this.$element.trigger('focus') } }, this)) } modal.prototype.escape = function () { if (this.isshown && this.options.keyboard) { this.$element.on('keyup.dismiss.bs.modal', $.proxy(function (e) { e.which == 27 && this.hide() }, this)) } else if (!this.isshown) { this.$element.off('keyup.dismiss.bs.modal') } } modal.prototype.hidemodal = function () { var that = this this.$element.hide() this.backdrop(function () { that.$element.trigger('hidden.bs.modal') }) } modal.prototype.removebackdrop = function () { this.$backdrop && this.$backdrop.remove() this.$backdrop = null } modal.prototype.backdrop = function (callback) { var that = this var animate = this.$element.hasclass('fade') ? 'fade' : '' if (this.isshown && this.options.backdrop) { var doanimate = $.support.transition && animate this.$backdrop = $('