mirror of
https://github.com/grocy/grocy.git
synced 2025-08-20 04:12:59 +00:00
Lazy load all images to increase page load times (references #275)
This commit is contained in:
@@ -82,7 +82,7 @@ Grocy.Components.ProductCard.Refresh = function(productId)
|
||||
{
|
||||
$("#productcard-no-product-picture").addClass("d-none");
|
||||
$("#productcard-product-picture").removeClass("d-none");
|
||||
$("#productcard-product-picture").attr("src", U('/api/files/productpictures/' + btoa(productDetails.product.picture_file_name) + '?force_serve_as=picture&best_fit_height=400&best_fit_width=400'));
|
||||
$("#productcard-product-picture").attr("src", U('/api/files/productpictures/' + btoa(productDetails.product.picture_file_name) + '?force_serve_as=picture&best_fit_width=400'));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@@ -103,12 +103,13 @@ var calendar = $("#calendar").fullCalendar({
|
||||
|
||||
if (recipe.picture_file_name && !recipe.picture_file_name.isEmpty())
|
||||
{
|
||||
element.html(element.html() + '<img src="' + U("/api/files/recipepictures/") + btoa(recipe.picture_file_name) + '?force_serve_as=picture&best_fit_height=400&best_fit_width=400" class="img-fluid">')
|
||||
element.html(element.html() + '<img data-src="' + U("/api/files/recipepictures/") + btoa(recipe.picture_file_name) + '?force_serve_as=picture&best_fit_width=400" class="img-fluid lazy">')
|
||||
}
|
||||
},
|
||||
"eventAfterAllRender": function(view)
|
||||
{
|
||||
RefreshLocaleNumberDisplay();
|
||||
LoadImagesLazy();
|
||||
|
||||
if (GetUriParam("week") !== undefined)
|
||||
{
|
||||
|
Reference in New Issue
Block a user