diff --git a/package.json b/package.json index d22cc4d3..e5c3d3ff 100644 --- a/package.json +++ b/package.json @@ -27,6 +27,7 @@ "daterangepicker": "^3.1.0", "fullcalendar": "^3.10.1", "gettext-translator": "3.0.1", + "iframe-resizer": "^4.3.9", "jquery": "^3.6.0", "jquery-serializejson": "^2.9.0", "moment": "^2.27.0", diff --git a/public/css/grocy.css b/public/css/grocy.css index 5edda896..604f7acd 100755 --- a/public/css/grocy.css +++ b/public/css/grocy.css @@ -107,8 +107,10 @@ button.disabled { margin-left: 0; } -iframe { +iframe.embed-responsive { border: 0; + width: 1px; + min-width: 100%; } /* Hide the default up/down arrow buttons for number inputs because we use our own buttons in numberpicker */ diff --git a/public/js/grocy.js b/public/js/grocy.js index fe64b9c5..9aeb7ef9 100644 --- a/public/js/grocy.js +++ b/public/js/grocy.js @@ -552,41 +552,19 @@ ResizeResponsiveEmbeds = function(fillEntireViewport = false) { var maxHeight = $("body").height(); } + $("embed.embed-responsive").attr("height", maxHeight.toString() + "px"); - - ResizeIframes(); -} -ResizeIframes = function() -{ - $("iframe.embed-responsive").each(function() - { - if (!$(this).isVisibleInViewport()) - { - return; - } - - var desiredHeight = $(this)[0].contentWindow.document.body.scrollHeight; - if (desiredHeight == 0) - { - // The corresponding frame should be loaded after the "onload" event fired, - // this seems to be sometimes (not really reproducible) not the case in Chrome based Browsers... - // => So if that happens, just try this again later - setTimeout(function() - { - ResizeIframes(); - }, 200); - } - else - { - $(this).attr("height", desiredHeight.toString() + "px"); - } - }); } $(window).on('resize', function() { ResizeResponsiveEmbeds($("body").hasClass("fullscreen-card")); }); +if (GetUriParam("embedded")) +{ + window.parent.iFrameResize({ "checkOrigin": false, "warningTimeout": 0 }, "iframe.embed-responsive"); +} + function WindowMessageBag(message, payload = null) { var obj = {}; @@ -726,7 +704,7 @@ $(document).on("click", ".show-as-dialog-link", function(e) var link = $(e.currentTarget).attr("href"); bootbox.dialog({ - message: '', + message: '', size: 'large', backdrop: true, closeButton: false, diff --git a/public/viewjs/mealplan.js b/public/viewjs/mealplan.js index 1a8edb73..dd3dbec2 100644 --- a/public/viewjs/mealplan.js +++ b/public/viewjs/mealplan.js @@ -927,7 +927,7 @@ $(document).on("click", ".display-recipe-button", function(e) function(result) { bootbox.dialog({ - message: '', + message: '', size: 'extra-large', backdrop: true, closeButton: false, diff --git a/public/viewjs/quantityunitform.js b/public/viewjs/quantityunitform.js index 5c636723..76959b26 100644 --- a/public/viewjs/quantityunitform.js +++ b/public/viewjs/quantityunitform.js @@ -198,7 +198,7 @@ $("#test-quantityunit-plural-forms-button").on("click", function(e) $("#save-quantityunit-button").click(); bootbox.alert({ - message: '', + message: '', closeButton: false, size: "large", callback: function(result) diff --git a/public/viewjs/recipeform.js b/public/viewjs/recipeform.js index 301fceaf..f10a90d0 100644 --- a/public/viewjs/recipeform.js +++ b/public/viewjs/recipeform.js @@ -220,7 +220,7 @@ $(document).on('click', '.recipe-pos-edit-button', function(e) var recipePosId = $(e.currentTarget).attr('data-recipe-pos-id'); bootbox.dialog({ - message: '', + message: '', size: 'large', backdrop: true, closeButton: false, @@ -266,7 +266,7 @@ $("#recipe-pos-add-button").on("click", function(e) e.preventDefault(); bootbox.dialog({ - message: '', + message: '', size: 'large', backdrop: true, closeButton: false, diff --git a/public/viewjs/recipes.js b/public/viewjs/recipes.js index 1e42577a..c927e7cc 100644 --- a/public/viewjs/recipes.js +++ b/public/viewjs/recipes.js @@ -291,7 +291,7 @@ recipesTables.on('select', function(e, dt, type, indexes) else { bootbox.dialog({ - message: '', + message: '', size: 'extra-large', backdrop: true, closeButton: false, @@ -323,7 +323,7 @@ $(".recipe-gallery-item").on("click", function(e) else { bootbox.dialog({ - message: '', + message: '', size: 'extra-large', backdrop: true, closeButton: false, diff --git a/public/viewjs/shoppinglist.js b/public/viewjs/shoppinglist.js index 02314886..96912269 100644 --- a/public/viewjs/shoppinglist.js +++ b/public/viewjs/shoppinglist.js @@ -624,8 +624,3 @@ if ($(window).width() < 768 || !Grocy.FeatureFlags.GROCY_FEATURE_FLAG_STOCK) { $("#filter-container").removeClass("border-bottom"); } - -$("#shopping-list-stock-add-workflow-purchase-form-frame").on("load", function() -{ - ResizeResponsiveEmbeds(); -}); diff --git a/views/layout/default.blade.php b/views/layout/default.blade.php index 4ce4dfaa..79bcb8b1 100644 --- a/views/layout/default.blade.php +++ b/views/layout/default.blade.php @@ -124,7 +124,7 @@
- @if(!($embedded)) + @if(!$embedded)