-/* ===========================================================
- * bootstrap-modal.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 ($) {
-
- "use strict"; // jshint ;_;
-
- /* MODAL CLASS DEFINITION
- * ====================== */
-
- var Modal = function (element, options) {
- this.init(element, options);
- };
-
- Modal.prototype = {
-
- constructor: Modal,
-
- init: function (element, options) {
- var that = this;
-
- this.options = options;
-
- this.$element = $(element)
- .delegate('[data-dismiss="modal"]', 'click.dismiss.modal', $.proxy(this.hide, this));
-
- this.options.remote && this.$element.find('.modal-body').load(this.options.remote, function () {
- var e = $.Event('loaded');
- that.$element.trigger(e);
- });
-
- var manager = typeof this.options.manager === 'function' ?
- this.options.manager.call(this) : this.options.manager;
-
- manager = manager.appendModal ?
- manager : $(manager).modalmanager().data('modalmanager');
-
- manager.appendModal(this);
- },
-
- toggle: function () {
- return this[!this.isShown ? 'show' : 'hide']();
- },
-
- show: function () {
- var e = $.Event('show');
-
- if (this.isShown) return;
-
- this.$element.trigger(e);
-
- if (e.isDefaultPrevented()) return;
-
- this.escape();
-
- this.tab();
-
- this.options.loading && this.loading();
- },
-
- hide: function (e) {
- e && e.preventDefault();
-
- e = $.Event('hide');
-
- this.$element.trigger(e);
-
- if (!this.isShown || e.isDefaultPrevented()) return;
-
- this.isShown = false;
-
- this.escape();
-
- this.tab();
-
- this.isLoading && this.loading();
-
- $(document).off('focusin.modal');
-
- this.$element
- .removeClass('in')
- .removeClass('animated')
- .removeClass(this.options.attentionAnimation)
- .removeClass('modal-overflow')
- .attr('aria-hidden', true);
-
- $.support.transition && this.$element.hasClass('fade') ?
- this.hideWithTransition() :
- this.hideModal();
- },
-
- layout: function () {
- var prop = this.options.height ? 'height' : 'max-height',
- value = this.options.height || this.options.maxHeight;
-
- if (this.options.width){
- this.$element.css('width', this.options.width);
-
- var that = this;
- this.$element.css('margin-left', function () {
- if (/%/ig.test(that.options.width)){
- return -(parseInt(that.options.width) / 2) + '%';
- } else {
- return -($(this).width() / 2) + 'px';
- }
- });
- } else {
- this.$element.css('width', '');
- this.$element.css('margin-left', '');
- }
-
- this.$element.find('.modal-body')
- .css('overflow', '')
- .css(prop, '');
-
- if (value){
- this.$element.find('.modal-body')
- .css('overflow', 'auto')
- .css(prop, value);
- }
-
- var modalOverflow = $(window).height() - 10 < this.$element.height();
-
- if (modalOverflow || this.options.modalOverflow) {
- this.$element
- .css('margin-top', 0)
- .addClass('modal-overflow');
- } else {
- this.$element
- .css('margin-top', 0 - this.$element.height() / 2)
- .removeClass('modal-overflow');
- }
- },
-
- tab: function () {
- var that = this;
-
- if (this.isShown && this.options.consumeTab) {
- this.$element.on('keydown.tabindex.modal', '[data-tabindex]', function (e) {
- if (e.keyCode && e.keyCode == 9){
- var elements = [],
- tabindex = Number($(this).data('tabindex'));
-
- that.$element.find('[data-tabindex]:enabled:visible:not([readonly])').each(function (ev) {
- elements.push(Number($(this).data('tabindex')));
- });
- elements.sort(function(a,b){return a-b});
-
- var arrayPos = $.inArray(tabindex, elements);
- if (!e.shiftKey){
- arrayPos < elements.length-1 ?
- that.$element.find('[data-tabindex='+elements[arrayPos+1]+']').focus() :
- that.$element.find('[data-tabindex='+elements[0]+']').focus();
- } else {
- arrayPos == 0 ?
- that.$element.find('[data-tabindex='+elements[elements.length-1]+']').focus() :
- that.$element.find('[data-tabindex='+elements[arrayPos-1]+']').focus();
- }
-
- e.preventDefault();
- }
- });
- } else if (!this.isShown) {
- this.$element.off('keydown.tabindex.modal');
- }
- },
-
- escape: function () {
- var that = this;
- if (this.isShown && this.options.keyboard) {
- if (!this.$element.attr('tabindex')) this.$element.attr('tabindex', -1);
-
- this.$element.on('keyup.dismiss.modal', function (e) {
- e.which == 27 && that.hide();
- });
- } else if (!this.isShown) {
- this.$element.off('keyup.dismiss.modal')
- }
- },
-
- hideWithTransition: function () {
- var that = this
- , timeout = setTimeout(function () {
- that.$element.off($.support.transition.end);
- that.hideModal();
- }, 500);
-
- this.$element.one($.support.transition.end, function () {
- clearTimeout(timeout);
- that.hideModal();
- });
- },
-
- hideModal: function () {
- var prop = this.options.height ? 'height' : 'max-height';
- var value = this.options.height || this.options.maxHeight;
-
- if (value){
- this.$element.find('.modal-body')
- .css('overflow', '')
- .css(prop, '');
- }
-
- this.$element
- .hide()
- .trigger('hidden');
- },
-
- removeLoading: function () {
- this.$loading.remove();
- this.$loading = null;
- this.isLoading = false;
- },
-
- loading: function (callback) {
- callback = callback || function () {};
-
- var animate = this.$element.hasClass('fade') ? 'fade' : '';
-
- if (!this.isLoading) {
- var doAnimate = $.support.transition && animate;
-
- this.$loading = $('<div class="loading-mask ' + animate + '">')
- .append(this.options.spinner)
- .appendTo(this.$element);
-
- if (doAnimate) this.$loading[0].offsetWidth; // force reflow
-
- this.$loading.addClass('in');
-
- this.isLoading = true;
-
- doAnimate ?
- this.$loading.one($.support.transition.end, callback) :
- callback();
-
- } else if (this.isLoading && this.$loading) {
- this.$loading.removeClass('in');
-
- var that = this;
- $.support.transition && this.$element.hasClass('fade')?
- this.$loading.one($.support.transition.end, function () { that.removeLoading() }) :
- that.removeLoading();
-
- } else if (callback) {
- callback(this.isLoading);
- }
- },
-
- focus: function () {
- var $focusElem = this.$element.find(this.options.focusOn);
-
- $focusElem = $focusElem.length ? $focusElem : this.$element;
-
- $focusElem.focus();
- },
-
- attention: function (){
- // NOTE: transitionEnd with keyframes causes odd behaviour
-
- if (this.options.attentionAnimation){
- this.$element
- .removeClass('animated')
- .removeClass(this.options.attentionAnimation);
-
- var that = this;
-
- setTimeout(function () {
- that.$element
- .addClass('animated')
- .addClass(that.options.attentionAnimation);
- }, 0);
- }
-
-
- this.focus();
- },
-
-
- destroy: function () {
- var e = $.Event('destroy');
-
- this.$element.trigger(e);
-
- if (e.isDefaultPrevented()) return;
-
- this.$element
- .off('.modal')
- .removeData('modal')
- .removeClass('in')
- .attr('aria-hidden', true);
-
- if (this.$parent !== this.$element.parent()) {
- this.$element.appendTo(this.$parent);
- } else if (!this.$parent.length) {
- // modal is not part of the DOM so remove it.
- this.$element.remove();
- this.$element = null;
- }
-
- this.$element.trigger('destroyed');
- }
- };
-
-
- /* MODAL PLUGIN DEFINITION
- * ======================= */
-
- $.fn.modal = function (option, args) {
- return this.each(function () {
- var $this = $(this),
- data = $this.data('modal'),
- options = $.extend({}, $.fn.modal.defaults, $this.data(), typeof option == 'object' && option);
-
- if (!data) $this.data('modal', (data = new Modal(this, options)));
- if (typeof option == 'string') data[option].apply(data, [].concat(args));
- else if (options.show) data.show()
- })
- };
-
- $.fn.modal.defaults = {
- keyboard: true,
- backdrop: true,
- loading: false,
- show: true,
- width: null,
- height: null,
- maxHeight: null,
- modalOverflow: false,
- consumeTab: true,
- focusOn: null,
- replace: false,
- resize: false,
- attentionAnimation: 'shake',
- manager: 'body',
- spinner: '<div class="loading-spinner" style="width: 200px; margin-left: -100px;"><div class="progress progress-striped active"><div class="bar" style="width: 100%;"></div></div></div>',
- backdropTemplate: '<div class="modal-backdrop" />'
- };
-
- $.fn.modal.Constructor = Modal;
-
-
- /* MODAL DATA-API
- * ============== */
-
- $(function () {
- $(document).off('click.modal').on('click.modal.data-api', '[data-toggle="modal"]', function ( e ) {
- var $this = $(this),
- href = $this.attr('href'),
- $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))), //strip for ie7
- option = $target.data('modal') ? 'toggle' : $.extend({ remote: !/#/.test(href) && href }, $target.data(), $this.data());
-
- e.preventDefault();
- $target
- .modal(option)
- .one('hide', function () {
- $this.focus();
- })
- });
- });
-
-}(window.jQuery);
+/* ===========================================================\r
+ * bootstrap-modal.js v2.2.5\r
+ * ===========================================================\r
+ * Copyright 2012 Jordan Schroter\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ * ========================================================== */\r
+\r
+\r
+!function ($) {\r
+\r
+ "use strict"; // jshint ;_;\r
+\r
+ /* MODAL CLASS DEFINITION\r
+ * ====================== */\r
+\r
+ var Modal = function (element, options) {\r
+ this.init(element, options);\r
+ };\r
+\r
+ Modal.prototype = {\r
+\r
+ constructor: Modal,\r
+\r
+ init: function (element, options) {\r
+ var that = this;\r
+\r
+ this.options = options;\r
+\r
+ this.$element = $(element)\r
+ .delegate('[data-dismiss="modal"]', 'click.dismiss.modal', $.proxy(this.hide, this));\r
+\r
+ this.options.remote && this.$element.find('.modal-body').load(this.options.remote, function () {\r
+ var e = $.Event('loaded');\r
+ that.$element.trigger(e);\r
+ });\r
+\r
+ var manager = typeof this.options.manager === 'function' ?\r
+ this.options.manager.call(this) : this.options.manager;\r
+\r
+ manager = manager.appendModal ?\r
+ manager : $(manager).modalmanager().data('modalmanager');\r
+\r
+ manager.appendModal(this);\r
+ },\r
+\r
+ toggle: function () {\r
+ return this[!this.isShown ? 'show' : 'hide']();\r
+ },\r
+\r
+ show: function () {\r
+ var e = $.Event('show');\r
+\r
+ if (this.isShown) return;\r
+\r
+ this.$element.trigger(e);\r
+\r
+ if (e.isDefaultPrevented()) return;\r
+\r
+ this.escape();\r
+\r
+ this.tab();\r
+\r
+ this.options.loading && this.loading();\r
+ },\r
+\r
+ hide: function (e) {\r
+ e && e.preventDefault();\r
+\r
+ e = $.Event('hide');\r
+\r
+ this.$element.trigger(e);\r
+\r
+ if (!this.isShown || e.isDefaultPrevented()) return;\r
+\r
+ this.isShown = false;\r
+\r
+ this.escape();\r
+\r
+ this.tab();\r
+\r
+ this.isLoading && this.loading();\r
+\r
+ $(document).off('focusin.modal');\r
+\r
+ this.$element\r
+ .removeClass('in')\r
+ .removeClass('animated')\r
+ .removeClass(this.options.attentionAnimation)\r
+ .removeClass('modal-overflow')\r
+ .attr('aria-hidden', true);\r
+\r
+ $.support.transition && this.$element.hasClass('fade') ?\r
+ this.hideWithTransition() :\r
+ this.hideModal();\r
+ },\r
+\r
+ layout: function () {\r
+ var prop = this.options.height ? 'height' : 'max-height',\r
+ value = this.options.height || this.options.maxHeight;\r
+\r
+ if (this.options.width){\r
+ this.$element.css('width', this.options.width);\r
+\r
+ var that = this;\r
+ this.$element.css('margin-left', function () {\r
+ if (/%/ig.test(that.options.width)){\r
+ return -(parseInt(that.options.width) / 2) + '%';\r
+ } else {\r
+ return -($(this).width() / 2) + 'px';\r
+ }\r
+ });\r
+ } else {\r
+ this.$element.css('width', '');\r
+ this.$element.css('margin-left', '');\r
+ }\r
+\r
+ this.$element.find('.modal-body')\r
+ .css('overflow', '')\r
+ .css(prop, '');\r
+\r
+ if (value){\r
+ this.$element.find('.modal-body')\r
+ .css('overflow', 'auto')\r
+ .css(prop, value);\r
+ }\r
+\r
+ var modalOverflow = $(window).height() - 10 < this.$element.height();\r
+ \r
+ if (modalOverflow || this.options.modalOverflow) {\r
+ this.$element\r
+ .css('margin-top', 0)\r
+ .addClass('modal-overflow');\r
+ } else {\r
+ this.$element\r
+ .css('margin-top', 0 - this.$element.height() / 2)\r
+ .removeClass('modal-overflow');\r
+ }\r
+ },\r
+\r
+ tab: function () {\r
+ var that = this;\r
+\r
+ if (this.isShown && this.options.consumeTab) {\r
+ this.$element.on('keydown.tabindex.modal', '[data-tabindex]', function (e) {\r
+ if (e.keyCode && e.keyCode == 9){\r
+ var elements = [],\r
+ tabindex = Number($(this).data('tabindex'));\r
+\r
+ that.$element.find('[data-tabindex]:enabled:visible:not([readonly])').each(function (ev) {\r
+ elements.push(Number($(this).data('tabindex')));\r
+ });\r
+ elements.sort(function(a,b){return a-b});\r
+ \r
+ var arrayPos = $.inArray(tabindex, elements);\r
+ if (!e.shiftKey){\r
+ arrayPos < elements.length-1 ?\r
+ that.$element.find('[data-tabindex='+elements[arrayPos+1]+']').focus() :\r
+ that.$element.find('[data-tabindex='+elements[0]+']').focus();\r
+ } else {\r
+ arrayPos == 0 ?\r
+ that.$element.find('[data-tabindex='+elements[elements.length-1]+']').focus() :\r
+ that.$element.find('[data-tabindex='+elements[arrayPos-1]+']').focus();\r
+ }\r
+ \r
+ e.preventDefault();\r
+ }\r
+ });\r
+ } else if (!this.isShown) {\r
+ this.$element.off('keydown.tabindex.modal');\r
+ }\r
+ },\r
+\r
+ escape: function () {\r
+ var that = this;\r
+ if (this.isShown && this.options.keyboard) {\r
+ if (!this.$element.attr('tabindex')) this.$element.attr('tabindex', -1);\r
+\r
+ this.$element.on('keyup.dismiss.modal', function (e) {\r
+ e.which == 27 && that.hide();\r
+ });\r
+ } else if (!this.isShown) {\r
+ this.$element.off('keyup.dismiss.modal')\r
+ }\r
+ },\r
+\r
+ hideWithTransition: function () {\r
+ var that = this\r
+ , timeout = setTimeout(function () {\r
+ that.$element.off($.support.transition.end);\r
+ that.hideModal();\r
+ }, 500);\r
+\r
+ this.$element.one($.support.transition.end, function () {\r
+ clearTimeout(timeout);\r
+ that.hideModal();\r
+ });\r
+ },\r
+\r
+ hideModal: function () {\r
+ var prop = this.options.height ? 'height' : 'max-height';\r
+ var value = this.options.height || this.options.maxHeight;\r
+\r
+ if (value){\r
+ this.$element.find('.modal-body')\r
+ .css('overflow', '')\r
+ .css(prop, '');\r
+ }\r
+\r
+ this.$element\r
+ .hide()\r
+ .trigger('hidden');\r
+ },\r
+\r
+ removeLoading: function () {\r
+ this.$loading.remove();\r
+ this.$loading = null;\r
+ this.isLoading = false;\r
+ },\r
+\r
+ loading: function (callback) {\r
+ callback = callback || function () {};\r
+\r
+ var animate = this.$element.hasClass('fade') ? 'fade' : '';\r
+\r
+ if (!this.isLoading) {\r
+ var doAnimate = $.support.transition && animate;\r
+\r
+ this.$loading = $('<div class="loading-mask ' + animate + '">')\r
+ .append(this.options.spinner)\r
+ .appendTo(this.$element);\r
+\r
+ if (doAnimate) this.$loading[0].offsetWidth; // force reflow\r
+\r
+ this.$loading.addClass('in');\r
+\r
+ this.isLoading = true;\r
+\r
+ doAnimate ?\r
+ this.$loading.one($.support.transition.end, callback) :\r
+ callback();\r
+\r
+ } else if (this.isLoading && this.$loading) {\r
+ this.$loading.removeClass('in');\r
+\r
+ var that = this;\r
+ $.support.transition && this.$element.hasClass('fade')?\r
+ this.$loading.one($.support.transition.end, function () { that.removeLoading() }) :\r
+ that.removeLoading();\r
+\r
+ } else if (callback) {\r
+ callback(this.isLoading);\r
+ }\r
+ },\r
+\r
+ focus: function () {\r
+ var $focusElem = this.$element.find(this.options.focusOn);\r
+\r
+ $focusElem = $focusElem.length ? $focusElem : this.$element;\r
+\r
+ $focusElem.focus();\r
+ },\r
+\r
+ attention: function (){\r
+ // NOTE: transitionEnd with keyframes causes odd behaviour\r
+\r
+ if (this.options.attentionAnimation){\r
+ this.$element\r
+ .removeClass('animated')\r
+ .removeClass(this.options.attentionAnimation);\r
+\r
+ var that = this;\r
+\r
+ setTimeout(function () {\r
+ that.$element\r
+ .addClass('animated')\r
+ .addClass(that.options.attentionAnimation);\r
+ }, 0);\r
+ }\r
+\r
+\r
+ this.focus();\r
+ },\r
+\r
+\r
+ destroy: function () {\r
+ var e = $.Event('destroy');\r
+\r
+ this.$element.trigger(e);\r
+\r
+ if (e.isDefaultPrevented()) return;\r
+\r
+ this.$element\r
+ .off('.modal')\r
+ .removeData('modal')\r
+ .removeClass('in')\r
+ .attr('aria-hidden', true);\r
+ \r
+ if (this.$parent !== this.$element.parent()) {\r
+ this.$element.appendTo(this.$parent);\r
+ } else if (!this.$parent.length) {\r
+ // modal is not part of the DOM so remove it.\r
+ this.$element.remove();\r
+ this.$element = null;\r
+ }\r
+\r
+ this.$element.trigger('destroyed');\r
+ }\r
+ };\r
+\r
+\r
+ /* MODAL PLUGIN DEFINITION\r
+ * ======================= */\r
+\r
+ $.fn.modal = function (option, args) {\r
+ return this.each(function () {\r
+ var $this = $(this),\r
+ data = $this.data('modal'),\r
+ options = $.extend({}, $.fn.modal.defaults, $this.data(), typeof option == 'object' && option);\r
+\r
+ if (!data) $this.data('modal', (data = new Modal(this, options)));\r
+ if (typeof option == 'string') data[option].apply(data, [].concat(args));\r
+ else if (options.show) data.show()\r
+ })\r
+ };\r
+\r
+ $.fn.modal.defaults = {\r
+ keyboard: true,\r
+ backdrop: true,\r
+ loading: false,\r
+ show: true,\r
+ width: null,\r
+ height: null,\r
+ maxHeight: null,\r
+ modalOverflow: false,\r
+ consumeTab: true,\r
+ focusOn: null,\r
+ replace: false,\r
+ resize: false,\r
+ attentionAnimation: 'shake',\r
+ manager: 'body',\r
+ spinner: '<div class="loading-spinner" style="width: 200px; margin-left: -100px;"><div class="progress progress-striped active"><div class="bar" style="width: 100%;"></div></div></div>',\r
+ backdropTemplate: '<div class="modal-backdrop" />'\r
+ };\r
+\r
+ $.fn.modal.Constructor = Modal;\r
+\r
+\r
+ /* MODAL DATA-API\r
+ * ============== */\r
+\r
+ $(function () {\r
+ $(document).off('click.modal').on('click.modal.data-api', '[data-toggle="modal"]', function ( e ) {\r
+ var $this = $(this),\r
+ href = $this.attr('href'),\r
+ $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))), //strip for ie7\r
+ option = $target.data('modal') ? 'toggle' : $.extend({ remote: !/#/.test(href) && href }, $target.data(), $this.data());\r
+\r
+ e.preventDefault();\r
+ $target\r
+ .modal(option)\r
+ .one('hide', function () {\r
+ $this.focus();\r
+ })\r
+ });\r
+ });\r
+\r
+}(window.jQuery);\r