--- a/src/pyams_skin/resources/js/ext/bootstrap-modalmanager.js Thu Oct 15 15:44:38 2015 +0200
+++ b/src/pyams_skin/resources/js/ext/bootstrap-modalmanager.js Mon Jan 04 13:30:37 2016 +0100
@@ -18,7 +18,7 @@
!function ($) {
- "use strict"; // jshint ;_;
+ "use strict"; // jshint ;_;
/* MODAL MANAGER CLASS DEFINITION
* ====================== */
@@ -33,7 +33,7 @@
init: function (element, options) {
this.$element = $(element);
- this.options = $.extend({}, $.fn.modalmanager.defaults, this.$element.data(), typeof options == 'object' && options);
+ this.options = $.extend({}, $.fn.modalmanager.defaults, this.$element.data(), typeof options === 'object' && options);
this.stack = [];
this.backdropCount = 0;
@@ -42,10 +42,14 @@
that = this;
$(window).on('resize.modal', function () {
- resizeTimeout && clearTimeout(resizeTimeout);
+ if (resizeTimeout) {
+ clearTimeout(resizeTimeout);
+ }
resizeTimeout = setTimeout(function () {
for (var i = 0; i < that.stack.length; i++) {
- that.stack[i].isShown && that.stack[i].layout();
+ if (that.stack[i].isShown) {
+ that.stack[i].layout();
+ }
}
}, 10);
});
@@ -82,9 +86,9 @@
modal.$element.show();
if (transition) {
- //modal.$element[0].style.display = 'run-in';
+ //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.$element.one($.support.transition.end, function () { modal.$element[0].style.display = 'block' });
}
modal.layout();
@@ -98,15 +102,19 @@
modal.$element.trigger('shown');
};
- transition ?
- modal.$element.one($.support.transition.end, complete) :
+ if (transition) {
+ modal.$element.one($.support.transition.end, complete);
+ } else {
complete();
+ }
});
};
- modal.options.replace ?
- that.replace(showModal) :
+ if (modal.options.replace) {
+ that.replace(showModal);
+ } else {
showModal();
+ }
}));
modal.$element.on('hidden.modalmanager', targetIsSelf(function (e) {
@@ -117,14 +125,17 @@
} else if (modal.$backdrop) {
var transition = $.support.transition && modal.$element.hasClass('fade');
- // trigger a relayout due to firebox's buggy transition end event
- if (transition)
+ // trigger a relayout due to firefox's buggy transition end event
+ if (transition) {
modal.$element[0].offsetWidth;
- $.support.transition && modal.$element.hasClass('fade') ?
+ }
+ if ($.support.transition && modal.$element.hasClass('fade')) {
modal.$backdrop.one($.support.transition.end, function () {
modal.destroy();
- }) :
+ });
+ } else {
modal.destroy();
+ }
} else {
modal.destroy();
}
@@ -139,7 +150,9 @@
getOpenModals: function () {
var openModals = [];
for (var i = 0; i < this.stack.length; i++) {
- if (this.stack[i].isShown) openModals.push(this.stack[i]);
+ if (this.stack[i].isShown) {
+ openModals.push(this.stack[i]);
+ }
}
return openModals;
@@ -153,17 +166,23 @@
var topModal;
for (var i = 0; i < this.stack.length; i++) {
- if (this.stack[i].isShown) topModal = this.stack[i];
+ if (this.stack[i].isShown) {
+ topModal = this.stack[i];
+ }
}
- if (!topModal) return;
+ if (!topModal) {
+ return;
+ }
topModal.focus();
},
destroyModal: function (modal) {
modal.$element.off('.modalmanager');
- if (modal.$backdrop) this.removeBackdrop(modal);
+ if (modal.$backdrop) {
+ this.removeBackdrop(modal);
+ }
this.stack.splice(this.getIndexOfModal(modal), 1);
var hasOpenModal = this.hasOpenModal();
@@ -185,7 +204,9 @@
getIndexOfModal: function (modal) {
for (var i = 0; i < this.stack.length; i++) {
- if (modal === this.stack[i]) return i;
+ if (modal === this.stack[i]) {
+ return i;
+ }
}
},
@@ -193,15 +214,19 @@
var topModal;
for (var i = 0; i < this.stack.length; i++) {
- if (this.stack[i].isShown) topModal = this.stack[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)));
+ if (callback) {
+ topModal.$element.one('hidden',
+ targetIsSelf($.proxy(callback, this)));
+ }
topModal.hide();
} else if (callback) {
@@ -225,7 +250,9 @@
$backdrop = this.$backdropHandle;
$backdrop.off('.modalmanager');
this.$backdropHandle = null;
- this.isLoading && this.removeSpinner();
+ if (this.isLoading) {
+ this.removeSpinner();
+ }
}
return $backdrop;
@@ -243,11 +270,11 @@
.css('z-index', getzIndex('modal', this.getOpenModals().length))
.appendTo(this.$element);
- if (modal && modal.options.backdrop != 'static') {
+ if (modal && modal.options.backdrop === 'hide') {
$container.on('click.modal', targetIsSelf(function (e) {
modal.hide();
}));
- } else if (modal) {
+ } else if (modal && modal.options.backdrop === 'attention') {
$container.on('click.modal', targetIsSelf(function (e) {
modal.attention();
}));
@@ -269,15 +296,19 @@
modal.$backdrop.css('z-index', getzIndex('backdrop', this.getOpenModals().length));
- if (doAnimate) modal.$backdrop[0].offsetWidth; // force reflow
+ if (doAnimate) {
+ modal.$backdrop[0].offsetWidth;
+ } // force reflow
modal.$backdrop.addClass('in');
this.backdropCount += 1;
- doAnimate ?
- modal.$backdrop.one($.support.transition.end, callback) :
+ if (doAnimate) {
+ modal.$backdrop.one($.support.transition.end, callback);
+ } else {
callback();
+ }
} else if (!modal.isShown && modal.$backdrop) {
modal.$backdrop.removeClass('in');
@@ -286,11 +317,13 @@
var that = this;
- $.support.transition && modal.$element.hasClass('fade') ?
+ if ($.support.transition && modal.$element.hasClass('fade')) {
modal.$backdrop.one($.support.transition.end, function () {
- that.removeBackdrop(modal)
- }) :
+ that.removeBackdrop(modal);
+ });
+ } else {
that.removeBackdrop(modal);
+ }
} else if (callback) {
callback();
@@ -298,13 +331,17 @@
},
removeSpinner: function () {
- this.$spinner && this.$spinner.remove();
+ if (this.$spinner) {
+ this.$spinner.remove();
+ }
this.$spinner = null;
this.isLoading = false;
},
removeLoading: function () {
- this.$backdropHandle && this.$backdropHandle.remove();
+ if (this.$backdropHandle) {
+ this.$backdropHandle.remove();
+ }
this.$backdropHandle = null;
this.removeSpinner();
},
@@ -339,19 +376,23 @@
this.isLoading = true;
- $.support.transition ?
- this.$backdropHandle.one($.support.transition.end, callback) :
+ if ($.support.transition) {
+ this.$backdropHandle.one($.support.transition.end, callback);
+ } else {
callback();
+ }
} else if (this.isLoading && this.$backdropHandle) {
this.$backdropHandle.removeClass('in');
var that = this;
- $.support.transition ?
+ if ($.support.transition) {
this.$backdropHandle.one($.support.transition.end, function () {
- that.removeLoading()
- }) :
+ that.removeLoading();
+ });
+ } else {
that.removeLoading();
+ }
} else if (callback) {
callback(this.isLoading);
@@ -373,9 +414,9 @@
var $baseModal = $('<div class="modal hide" />').appendTo('body'),
$baseBackdrop = $('<div class="modal-backdrop hide" />').appendTo('body');
- baseIndex['modal'] = +$baseModal.css('z-index');
- baseIndex['backdrop'] = +$baseBackdrop.css('z-index');
- zIndexFactor = baseIndex['modal'] - baseIndex['backdrop'];
+ baseIndex.modal = +$baseModal.css('z-index');
+ baseIndex.backdrop = +$baseBackdrop.css('z-index');
+ zIndexFactor = baseIndex.modal - baseIndex.backdrop;
$baseModal.remove();
$baseBackdrop.remove();
@@ -384,7 +425,7 @@
return baseIndex[type] + (zIndexFactor * pos);
- }
+ };
}());
// make sure the event target is the modal itself in order to prevent
@@ -407,9 +448,13 @@
var $this = $(this),
data = $this.data('modalmanager');
- if (!data) $this.data('modalmanager', (data = new ModalManager(this, option)));
- if (typeof option === 'string') data[option].apply(data, [].concat(args))
- })
+ if (!data) {
+ $this.data('modalmanager', (data = new ModalManager(this, option)));
+ }
+ if (typeof option === 'string') {
+ data[option].apply(data, [].concat(args));
+ }
+ });
};
$.fn.modalmanager.defaults = {
@@ -419,7 +464,7 @@
backdropTemplate: '<div class="modal-backdrop" />'
};
- $.fn.modalmanager.Constructor = ModalManager
+ $.fn.modalmanager.Constructor = ModalManager;
// ModalManager handles the modal-open class so we need
// to remove conflicting bootstrap 3 event handlers
--- a/src/pyams_skin/resources/js/ext/bootstrap-modalmanager.min.js Thu Oct 15 15:44:38 2015 +0200
+++ b/src/pyams_skin/resources/js/ext/bootstrap-modalmanager.min.js Mon Jan 04 13:30:37 2016 +0100
@@ -1,1 +1,1 @@
-!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('<div class="modal-scrollable">').css("z-index",d("modal",this.getOpenModals().length)).appendTo(this.$element);if(e&&e.options.backdrop!="static"){f.on("click.modal",b(function(g){e.hide()}))}else{if(e){f.on("click.modal",b(function(g){e.attention()}))}}return f},backdrop:function(h,j){var f=h.$element.hasClass("fade")?"fade":"",i=h.options.backdrop&&this.backdropCount<this.options.backdropLimit;if(h.isShown&&i){var e=c.support.transition&&f&&!this.$backdropHandle;h.$backdrop=this.createBackdrop(f,h.options.backdropTemplate);h.$backdrop.css("z-index",d("backdrop",this.getOpenModals().length));if(e){h.$backdrop[0].offsetWidth}h.$backdrop.addClass("in");this.backdropCount+=1;e?h.$backdrop.one(c.support.transition.end,j):j()}else{if(!h.isShown&&h.$backdrop){h.$backdrop.removeClass("in");this.backdropCount-=1;var g=this;c.support.transition&&h.$element.hasClass("fade")?h.$backdrop.one(c.support.transition.end,function(){g.removeBackdrop(h)}):g.removeBackdrop(h)}else{if(j){j()}}}},removeSpinner:function(){this.$spinner&&this.$spinner.remove();this.$spinner=null;this.isLoading=false},removeLoading:function(){this.$backdropHandle&&this.$backdropHandle.remove();this.$backdropHandle=null;this.removeSpinner()},loading:function(h){h=h||function(){};this.$element.toggleClass("modal-open",!this.isLoading||this.hasOpenModal()).toggleClass("page-overflow",c(window).height()<this.$element.height());if(!this.isLoading){this.$backdropHandle=this.createBackdrop("fade",this.options.backdropTemplate);this.$backdropHandle[0].offsetWidth;var e=this.getOpenModals();this.$backdropHandle.css("z-index",d("backdrop",e.length+1)).addClass("in");var g=c(this.options.spinner).css("z-index",d("modal",e.length+1)).appendTo(this.$element).addClass("in");this.$spinner=c(this.createContainer()).append(g).on("click.modalmanager",c.proxy(this.loading,this));this.isLoading=true;c.support.transition?this.$backdropHandle.one(c.support.transition.end,h):h()}else{if(this.isLoading&&this.$backdropHandle){this.$backdropHandle.removeClass("in");var f=this;c.support.transition?this.$backdropHandle.one(c.support.transition.end,function(){f.removeLoading()}):f.removeLoading()}else{if(h){h(this.isLoading)}}}}};var d=(function(){var f,e={};return function(g,j){if(typeof f==="undefined"){var i=c('<div class="modal hide" />').appendTo("body"),h=c('<div class="modal-backdrop hide" />').appendTo("body");e.modal=+i.css("z-index");e.backdrop=+h.css("z-index");f=e.modal-e.backdrop;i.remove();h.remove();h=i=null}return e[g]+(f*j)}}());function b(e){return function(f){if(f&&this===f.target){return e.apply(this,arguments)}}}c.fn.modalmanager=function(f,e){return this.each(function(){var h=c(this),g=h.data("modalmanager");if(!g){h.data("modalmanager",(g=new a(this,f)))}if(typeof f==="string"){g[f].apply(g,[].concat(e))}})};c.fn.modalmanager.defaults={backdropLimit:999,resize:true,spinner:'<div class="loading-spinner fade" 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" />'};c.fn.modalmanager.Constructor=a;c(function(){c(document).off("show.bs.modal").off("hidden.bs.modal")})}(jQuery);
\ No newline at end of file
+!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(){if(h){clearTimeout(h)}h=setTimeout(function(){for(var j=0;j<g.stack.length;j++){if(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")};if(i){f.$element.one(c.support.transition.end,j)}else{j()}})};if(f.options.replace){e.replace(g)}else{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}if(c.support.transition&&f.$element.hasClass("fade")){f.$backdrop.one(c.support.transition.end,function(){f.destroy()})}else{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;if(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;if(this.isLoading){this.removeSpinner()}}return e},removeContainer:function(e){e.$container.remove();e.$container=null},createContainer:function(e){var f;f=c('<div class="modal-scrollable">').css("z-index",d("modal",this.getOpenModals().length)).appendTo(this.$element);if(e&&e.options.backdrop==="hide"){f.on("click.modal",b(function(g){e.hide()}))}else{if(e&&e.options.backdrop==="attention"){f.on("click.modal",b(function(g){e.attention()}))}}return f},backdrop:function(h,j){var f=h.$element.hasClass("fade")?"fade":"",i=h.options.backdrop&&this.backdropCount<this.options.backdropLimit;if(h.isShown&&i){var e=c.support.transition&&f&&!this.$backdropHandle;h.$backdrop=this.createBackdrop(f,h.options.backdropTemplate);h.$backdrop.css("z-index",d("backdrop",this.getOpenModals().length));if(e){h.$backdrop[0].offsetWidth}h.$backdrop.addClass("in");this.backdropCount+=1;if(e){h.$backdrop.one(c.support.transition.end,j)}else{j()}}else{if(!h.isShown&&h.$backdrop){h.$backdrop.removeClass("in");this.backdropCount-=1;var g=this;if(c.support.transition&&h.$element.hasClass("fade")){h.$backdrop.one(c.support.transition.end,function(){g.removeBackdrop(h)})}else{g.removeBackdrop(h)}}else{if(j){j()}}}},removeSpinner:function(){if(this.$spinner){this.$spinner.remove()}this.$spinner=null;this.isLoading=false},removeLoading:function(){if(this.$backdropHandle){this.$backdropHandle.remove()}this.$backdropHandle=null;this.removeSpinner()},loading:function(h){h=h||function(){};this.$element.toggleClass("modal-open",!this.isLoading||this.hasOpenModal()).toggleClass("page-overflow",c(window).height()<this.$element.height());if(!this.isLoading){this.$backdropHandle=this.createBackdrop("fade",this.options.backdropTemplate);this.$backdropHandle[0].offsetWidth;var e=this.getOpenModals();this.$backdropHandle.css("z-index",d("backdrop",e.length+1)).addClass("in");var g=c(this.options.spinner).css("z-index",d("modal",e.length+1)).appendTo(this.$element).addClass("in");this.$spinner=c(this.createContainer()).append(g).on("click.modalmanager",c.proxy(this.loading,this));this.isLoading=true;if(c.support.transition){this.$backdropHandle.one(c.support.transition.end,h)}else{h()}}else{if(this.isLoading&&this.$backdropHandle){this.$backdropHandle.removeClass("in");var f=this;if(c.support.transition){this.$backdropHandle.one(c.support.transition.end,function(){f.removeLoading()})}else{f.removeLoading()}}else{if(h){h(this.isLoading)}}}}};var d=(function(){var f,e={};return function(g,j){if(typeof f==="undefined"){var i=c('<div class="modal hide" />').appendTo("body"),h=c('<div class="modal-backdrop hide" />').appendTo("body");e.modal=+i.css("z-index");e.backdrop=+h.css("z-index");f=e.modal-e.backdrop;i.remove();h.remove();h=i=null}return e[g]+(f*j)}}());function b(e){return function(f){if(f&&this===f.target){return e.apply(this,arguments)}}}c.fn.modalmanager=function(f,e){return this.each(function(){var h=c(this),g=h.data("modalmanager");if(!g){h.data("modalmanager",(g=new a(this,f)))}if(typeof f==="string"){g[f].apply(g,[].concat(e))}})};c.fn.modalmanager.defaults={backdropLimit:999,resize:true,spinner:'<div class="loading-spinner fade" 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" />'};c.fn.modalmanager.Constructor=a;c(function(){c(document).off("show.bs.modal").off("hidden.bs.modal")})}(jQuery);
\ No newline at end of file