# HG changeset patch # User Thierry Florac # Date 1545987975 -3600 # Node ID a50637baf022139d63fddbceb3795d638ccc3377 # Parent 403751b04d8e85404e5e191504733320faadd76c Updated dialog "max-height" CSS property computing diff -r 403751b04d8e -r a50637baf022 src/pyams_skin/resources/js/myams-dialog.js --- a/src/pyams_skin/resources/js/myams-dialog.js Fri Dec 28 10:05:11 2018 +0100 +++ b/src/pyams_skin/resources/js/myams-dialog.js Fri Dec 28 10:06:15 2018 +0100 @@ -138,9 +138,12 @@ overflow: dialogData.amsModalOverflow || '.modal-viewport', maxHeight: dialogData.amsModalMaxHeight === undefined ? function() { - return $(window).height() - + var win_height = $(window).height(), + top_margin = parseInt(dialog.css('margin-top')), + top_padding = Math.round(win_height / 10); + return win_height - $('.modal-header', content).outerHeight(true) - - $('footer', content).outerHeight(true) - 85; + $('footer', content).outerHeight(true) - top_margin - top_padding; } : ams.getFunctionByName(dialogData.amsModalMaxHeight) }; diff -r 403751b04d8e -r a50637baf022 src/pyams_skin/resources/js/myams-dialog.min.js --- a/src/pyams_skin/resources/js/myams-dialog.min.js Fri Dec 28 10:05:11 2018 +0100 +++ b/src/pyams_skin/resources/js/myams-dialog.min.js Fri Dec 28 10:06:15 2018 +0100 @@ -1,1 +1,1 @@ -!function(a,e){var o=e.MyAMS;o.dialog={_shown_callbacks:[],registerShownCallback:function(a,e){var t;e&&(t=e.objectOrParentWithClass("modal-dialog"));var l;t&&t.exists()?void 0===(l=t.data("shown-callbacks"))&&(l=[],t.data("shown-callbacks",l)):l=o.dialog._shown_callbacks,l.indexOf(a)<0&&l.push(a)},_hide_callbacks:[],registerHideCallback:function(a,e){var t;e&&(t=e.objectOrParentWithClass("modal-dialog"));var l;t&&t.exists()?void 0===(l=t.data("hide-callbacks"))&&(l=[],t.data("hide-callbacks",l)):l=o.dialog._hide_callbacks,l.indexOf(a)<0&&l.push(a)},open:function(e,t,l){o.ajax&&o.ajax.check(a.fn.modalmanager,o.baseURL+"ext/bootstrap-modalmanager"+o.devext+".js",function(){o.ajax.check(a.fn.modal.defaults,o.baseURL+"ext/bootstrap-modal"+o.devext+".js",function(s){s&&(a(document).off("click.modal"),a.fn.modal.defaults.spinner=a.fn.modalmanager.defaults.spinner='
');var d,i;if("string"==typeof e)d={},i=e;else{d=e.data(),i=e.attr("href")||d.amsUrl;var n=o.getFunctionByName(i);"function"==typeof n&&(i=n.call(e))}i&&(a("body").modalmanager("loading"),0===i.indexOf("#")?a(i).modal("show"):a.ajax({url:i,type:"get",cache:void 0!==d.amsAllowCache&&d.amsAllowCache,data:t,success:function(t,s,n){a("body").modalmanager("removeLoading");var c=o.ajax.getResponse(n),r=c.contentType,h=c.data;switch(r){case"json":o.ajax.handleJSON(h,a(a(e).data("ams-json-target")||"#content"));break;case"script":case"xml":break;case"html":case"text":default:var m=a(h),g=a(".modal-dialog",m.wrap("
").parent()),f=g.data()||{},v={backdrop:"static",overflow:f.amsModalOverflow||".modal-viewport",maxHeight:void 0===f.amsModalMaxHeight?function(){return a(window).height()-a(".modal-header",m).outerHeight(!0)-a("footer",m).outerHeight(!0)-85}:o.getFunctionByName(f.amsModalMaxHeight)},p=a.extend({},v,f.amsModalOptions);p=o.executeFunctionByName(f.amsModalInitCallback,g,p)||p,l&&(l.shown&&o.dialog.registerShownCallback(l.shown,m),l.hide&&o.dialog.registerHideCallback(l.hide,m)),a("
").addClass("modal fade").append(m).modal(p).on("shown",o.dialog.shown).on("hidden",o.dialog.hidden),o.initContent&&o.initContent(m),!1!==d.amsLogEvent&&o.stats&&o.stats.logPageview(i)}}}))})})},shown:function(e){function t(e){var o=a(".scrollmarker.top",s),t=s.scrollTop();t>0?o.show():o.hide();var l=a(".scrollmarker.bottom",s);d+t>=s.get(0).scrollHeight?l.hide():l.show()}var l=e.target,s=a(".modal-viewport",l);if(s.exists()){var d=parseInt(s.css("max-height")),i=a.scrollbarWidth();"hidden"!==s.css("overflow")&&s.height()===d?(a("
").addClass("scrollmarker").addClass("top").css("top",0).css("width",s.width()-i).hide().appendTo(s),a("
").addClass("scrollmarker").addClass("bottom").css("top",d-20).css("width",s.width()-i).appendTo(s),s.scroll(t),s.off("resize").on("resize",t)):a(".scrollmarker",s).remove()}a("[data-ams-shown-callback]",l).each(function(){var e=o.getFunctionByName(a(this).data("ams-shown-callback"));e&&e.call(l,this)});var n,c=a(".modal-dialog",l).data("shown-callbacks");if(c)for(n=0;n=0&&o.hide()}},hidden:function(e){var t=e.target;o.skin&&o.skin.cleanContainer(t),a("[data-ams-hidden-callback]",t).each(function(){var e=o.getFunctionByName(a(this).data("ams-hidden-callback"));e&&e.call(t,this)});var l,s=a(".modal-dialog",t).data("hide-callbacks");if(s)for(l=0;l
');var d,i;if("string"==typeof e)d={},i=e;else{d=e.data(),i=e.attr("href")||d.amsUrl;var n=o.getFunctionByName(i);"function"==typeof n&&(i=n.call(e))}i&&(a("body").modalmanager("loading"),0===i.indexOf("#")?a(i).modal("show"):a.ajax({url:i,type:"get",cache:void 0!==d.amsAllowCache&&d.amsAllowCache,data:t,success:function(t,s,n){a("body").modalmanager("removeLoading");var c=o.ajax.getResponse(n),r=c.contentType,h=c.data;switch(r){case"json":o.ajax.handleJSON(h,a(a(e).data("ams-json-target")||"#content"));break;case"script":case"xml":break;case"html":case"text":default:var m=a(h),g=a(".modal-dialog",m.wrap("
").parent()),f=g.data()||{},v={backdrop:"static",overflow:f.amsModalOverflow||".modal-viewport",maxHeight:void 0===f.amsModalMaxHeight?function(){var e=a(window).height(),o=parseInt(g.css("margin-top")),t=Math.round(e/10);return e-a(".modal-header",m).outerHeight(!0)-a("footer",m).outerHeight(!0)-o-t}:o.getFunctionByName(f.amsModalMaxHeight)},p=a.extend({},v,f.amsModalOptions);p=o.executeFunctionByName(f.amsModalInitCallback,g,p)||p,l&&(l.shown&&o.dialog.registerShownCallback(l.shown,m),l.hide&&o.dialog.registerHideCallback(l.hide,m)),a("
").addClass("modal fade").append(m).modal(p).on("shown",o.dialog.shown).on("hidden",o.dialog.hidden),o.initContent&&o.initContent(m),!1!==d.amsLogEvent&&o.stats&&o.stats.logPageview(i)}}}))})})},shown:function(e){function t(e){var o=a(".scrollmarker.top",s),t=s.scrollTop();t>0?o.show():o.hide();var l=a(".scrollmarker.bottom",s);d+t>=s.get(0).scrollHeight?l.hide():l.show()}var l=e.target,s=a(".modal-viewport",l);if(s.exists()){var d=parseInt(s.css("max-height")),i=a.scrollbarWidth();"hidden"!==s.css("overflow")&&s.height()===d?(a("
").addClass("scrollmarker").addClass("top").css("top",0).css("width",s.width()-i).hide().appendTo(s),a("
").addClass("scrollmarker").addClass("bottom").css("top",d-20).css("width",s.width()-i).appendTo(s),s.scroll(t),s.off("resize").on("resize",t)):a(".scrollmarker",s).remove()}a("[data-ams-shown-callback]",l).each(function(){var e=o.getFunctionByName(a(this).data("ams-shown-callback"));e&&e.call(l,this)});var n,c=a(".modal-dialog",l).data("shown-callbacks");if(c)for(n=0;n=0&&o.hide()}},hidden:function(e){var t=e.target;o.skin&&o.skin.cleanContainer(t),a("[data-ams-hidden-callback]",t).each(function(){var e=o.getFunctionByName(a(this).data("ams-hidden-callback"));e&&e.call(t,this)});var l,s=a(".modal-dialog",t).data("hide-callbacks");if(s)for(l=0;l