Optimized form input field navigation delay

This commit is contained in:
Bernd Bestel
2025-01-31 15:35:34 +01:00
parent c8ac094bf4
commit a35db9f1d3
62 changed files with 99 additions and 92 deletions

View File

@@ -52,7 +52,7 @@
### General ### General
- xxx - Optimized than when navigating between form input fields via the keyboard (`TAB`) there was an unwanted delay at some places
### API ### API

View File

@@ -882,3 +882,10 @@ $(document).on("click", '.btn, a, button', function(e)
document.activeElement.blur(); document.activeElement.blur();
$(".tooltip").tooltip("hide"); $(".tooltip").tooltip("hide");
}); });
// Delay only initial field focus
Grocy.FormFocusDelay = 500;
setTimeout(function()
{
Grocy.FormFocusDelay = 0;
}, 1000);

View File

@@ -36,7 +36,7 @@ setTimeout(function()
$("#camerabarcodescanner-start-button").attr("disabled", ""); $("#camerabarcodescanner-start-button").attr("disabled", "");
$("#camerabarcodescanner-start-button").addClass("disabled"); $("#camerabarcodescanner-start-button").addClass("disabled");
$("#expected_barcode").focus(); $("#expected_barcode").focus();
}, 500); }, Grocy.FormFocusDelay);
if (GetUriParam("barcode") !== undefined) if (GetUriParam("barcode") !== undefined)
{ {
@@ -45,7 +45,7 @@ if (GetUriParam("barcode") !== undefined)
{ {
$("#expected_barcode").keyup(); $("#expected_barcode").keyup();
$("#scanned_barcode").focus(); $("#scanned_barcode").focus();
}, 500); }, Grocy.FormFocusDelay);
} }
function OnBarcodeScanned(barcode) function OnBarcodeScanned(barcode)
@@ -82,7 +82,7 @@ function OnBarcodeScanned(barcode)
{ {
$("#scanned_barcode").focus(); $("#scanned_barcode").focus();
} }
}, 500); }, Grocy.FormFocusDelay);
} }
$(document).on("Grocy.BarcodeScanned", function(e, barcode, target) $(document).on("Grocy.BarcodeScanned", function(e, barcode, target)

View File

@@ -18,7 +18,7 @@ $("#search").on("keyup", Delay(function()
} }
batteriesTable.search(value).draw(); batteriesTable.search(value).draw();
}, 500)); }, Grocy.FormFocusDelay));
$("#clear-filter-button").on("click", function() $("#clear-filter-button").on("click", function()
{ {

View File

@@ -32,7 +32,7 @@ $("#search").on("keyup", Delay(function()
} }
batteriesJournalTable.search(value).draw(); batteriesJournalTable.search(value).draw();
}, 500)); }, Grocy.FormFocusDelay));
$("#clear-filter-button").on("click", function() $("#clear-filter-button").on("click", function()
{ {

View File

@@ -19,7 +19,7 @@ $("#search").on("keyup", Delay(function()
} }
batteriesOverviewTable.search(value).draw(); batteriesOverviewTable.search(value).draw();
}, 500)); }, Grocy.FormFocusDelay));
$("#clear-filter-button").on("click", function() $("#clear-filter-button").on("click", function()
{ {

View File

@@ -106,5 +106,5 @@ Grocy.Components.UserfieldsForm.Load();
setTimeout(function() setTimeout(function()
{ {
$('#name').focus(); $('#name').focus();
}, 500); }, Grocy.FormFocusDelay);
Grocy.FrontendHelpers.ValidateForm('battery-form'); Grocy.FrontendHelpers.ValidateForm('battery-form');

View File

@@ -65,7 +65,7 @@ $('#battery_id').on('change', function(e)
setTimeout(function() setTimeout(function()
{ {
$('#tracked_time').find('input').focus(); $('#tracked_time').find('input').focus();
}, 500); }, Grocy.FormFocusDelay);
Grocy.FrontendHelpers.ValidateForm('batterytracking-form'); Grocy.FrontendHelpers.ValidateForm('batterytracking-form');
} }
@@ -85,7 +85,7 @@ Grocy.FrontendHelpers.ValidateForm('batterytracking-form');
setTimeout(function() setTimeout(function()
{ {
$('#battery_id_text_input').focus(); $('#battery_id_text_input').focus();
}, 500); }, Grocy.FormFocusDelay);
$('#batterytracking-form input').keyup(function(event) $('#batterytracking-form input').keyup(function(event)
{ {
@@ -134,7 +134,7 @@ $(document).on("Grocy.BarcodeScanned", function(e, barcode, target)
$("#battery_id_text_input").focus(); $("#battery_id_text_input").focus();
$("#battery_id_text_input").blur(); $("#battery_id_text_input").blur();
$('#tracked_time').find('input').focus(); $('#tracked_time').find('input').focus();
}, 500); }, Grocy.FormFocusDelay);
}); });
function UndoChargeCycle(chargeCycleId) function UndoChargeCycle(chargeCycleId)

View File

@@ -115,7 +115,7 @@ Grocy.FrontendHelpers.ValidateForm('chore-form');
setTimeout(function() setTimeout(function()
{ {
$('#name').focus(); $('#name').focus();
}, 500); }, Grocy.FormFocusDelay);
if (Grocy.EditMode == "edit") if (Grocy.EditMode == "edit")
{ {
@@ -144,7 +144,7 @@ setTimeout(function()
$("#consume_product_on_execution").click(); $("#consume_product_on_execution").click();
Grocy.Components.ProductPicker.GetPicker().trigger('change'); Grocy.Components.ProductPicker.GetPicker().trigger('change');
}, 500); }, Grocy.FormFocusDelay);
$('.input-group-chore-period-type').on('change keyup', function(e) $('.input-group-chore-period-type').on('change keyup', function(e)
{ {

View File

@@ -17,7 +17,7 @@ $("#search").on("keyup", Delay(function()
} }
choresTable.search(value).draw(); choresTable.search(value).draw();
}, 500)); }, Grocy.FormFocusDelay));
$("#clear-filter-button").on("click", function() $("#clear-filter-button").on("click", function()
{ {

View File

@@ -39,7 +39,7 @@ $("#search").on("keyup", Delay(function()
} }
choresJournalTable.search(value).draw(); choresJournalTable.search(value).draw();
}, 500)); }, Grocy.FormFocusDelay));
$("#clear-filter-button").on("click", function() $("#clear-filter-button").on("click", function()
{ {

View File

@@ -20,7 +20,7 @@ $("#search").on("keyup", Delay(function()
} }
choresOverviewTable.search(value).draw(); choresOverviewTable.search(value).draw();
}, 500)); }, Grocy.FormFocusDelay));
$("#status-filter").on("change", function() $("#status-filter").on("change", function()
{ {
@@ -184,7 +184,7 @@ $(document).on('click', '.track-chore-button', function(e)
// Refresh the DataTable to re-apply filters // Refresh the DataTable to re-apply filters
choresOverviewTable.rows().invalidate().draw(false); choresOverviewTable.rows().invalidate().draw(false);
$(".input-group-filter").trigger("change"); $(".input-group-filter").trigger("change");
}, 500); }, Grocy.FormFocusDelay);
}, },
function(xhr) function(xhr)
{ {

View File

@@ -99,7 +99,7 @@ $('#chore_id').on('change', function(e)
setTimeout(function() setTimeout(function()
{ {
Grocy.Components.DateTimePicker.GetInputElement().focus(); Grocy.Components.DateTimePicker.GetInputElement().focus();
}, 500); }, Grocy.FormFocusDelay);
Grocy.FrontendHelpers.ValidateForm('choretracking-form'); Grocy.FrontendHelpers.ValidateForm('choretracking-form');
} }
@@ -117,7 +117,7 @@ Grocy.FrontendHelpers.ValidateForm('choretracking-form');
setTimeout(function() setTimeout(function()
{ {
$('#chore_id_text_input').focus(); $('#chore_id_text_input').focus();
}, 500); }, Grocy.FormFocusDelay);
$('#choretracking-form input').keyup(function(event) $('#choretracking-form input').keyup(function(event)
{ {
@@ -161,7 +161,7 @@ $(document).on("Grocy.BarcodeScanned", function(e, barcode, target)
$("#chore_id_text_input").focus(); $("#chore_id_text_input").focus();
$("#chore_id_text_input").blur(); $("#chore_id_text_input").blur();
$('#tracked_time').find('input').focus(); $('#tracked_time').find('input').focus();
}, 500); }, Grocy.FormFocusDelay);
}); });
Grocy.Components.DateTimePicker.GetInputElement().on('keypress', function(e) Grocy.Components.DateTimePicker.GetInputElement().on('keypress', function(e)

View File

@@ -139,7 +139,7 @@ Grocy.Components.CameraBarcodeScanner.StartScanning = function()
setTimeout(function() setTimeout(function()
{ {
$(".modal").last().modal("hide"); $(".modal").last().modal("hide");
}, 500); }, Grocy.FormFocusDelay);
return; return;
} }

View File

@@ -218,7 +218,7 @@ $('#product_id_text_input').on('blur', function(e)
{ {
Grocy.Components.ProductPicker.GetInputElement().focus(); Grocy.Components.ProductPicker.GetInputElement().focus();
Grocy.Components.ProductPicker.GetInputElement().select(); Grocy.Components.ProductPicker.GetInputElement().select();
}, 500); }, Grocy.FormFocusDelay);
} }
}, },
addnewproduct: { addnewproduct: {
@@ -278,7 +278,7 @@ $('#product_id_text_input').on('blur', function(e)
{ {
Grocy.Components.ProductPicker.GetInputElement().focus(); Grocy.Components.ProductPicker.GetInputElement().focus();
Grocy.Components.ProductPicker.GetInputElement().select(); Grocy.Components.ProductPicker.GetInputElement().select();
}, 500); }, Grocy.FormFocusDelay);
} }
else else
{ {
@@ -379,7 +379,7 @@ $('#product_id_text_input').on('blur', function(e)
setTimeout(function() setTimeout(function()
{ {
Grocy.Components.ProductPicker.GetInputElement().focus(); Grocy.Components.ProductPicker.GetInputElement().focus();
}, 500); }, Grocy.FormFocusDelay);
} }
}, },
function(xhr) function(xhr)
@@ -416,7 +416,7 @@ $(document).on("Grocy.BarcodeScanned", function(e, barcode, target)
Grocy.Components.ProductPicker.GetInputElement().focusout(); Grocy.Components.ProductPicker.GetInputElement().focusout();
Grocy.Components.ProductPicker.GetInputElement().focus(); Grocy.Components.ProductPicker.GetInputElement().focus();
Grocy.Components.ProductPicker.GetInputElement().blur(); Grocy.Components.ProductPicker.GetInputElement().blur();
}, 500); }, Grocy.FormFocusDelay);
}); });
$(document).on("shown.bs.modal", function(e) $(document).on("shown.bs.modal", function(e)

View File

@@ -121,5 +121,5 @@ $(document).on("Grocy.BarcodeScanned", function(e, barcode, target)
Grocy.Components.RecipePicker.GetInputElement().focusout(); Grocy.Components.RecipePicker.GetInputElement().focusout();
Grocy.Components.RecipePicker.GetInputElement().focus(); Grocy.Components.RecipePicker.GetInputElement().focus();
Grocy.Components.RecipePicker.GetInputElement().blur(); Grocy.Components.RecipePicker.GetInputElement().blur();
}, 500); }, Grocy.FormFocusDelay);
}); });

View File

@@ -492,7 +492,7 @@ Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
setTimeout(function() setTimeout(function()
{ {
$('#display_amount').focus(); $('#display_amount').focus();
}, 500); }, Grocy.FormFocusDelay);
if (productDetails.stock_amount == productDetails.stock_amount_opened || productDetails.product.enable_tare_weight_handling == 1 || productDetails.product.disable_open == 1) if (productDetails.stock_amount == productDetails.stock_amount_opened || productDetails.product.enable_tare_weight_handling == 1 || productDetails.product.disable_open == 1)
{ {
@@ -660,7 +660,7 @@ if (GetUriParam("embedded") !== undefined)
setTimeout(function() setTimeout(function()
{ {
Grocy.Components.ProductPicker.GetInputElement().focus(); Grocy.Components.ProductPicker.GetInputElement().focus();
}, 500); }, Grocy.FormFocusDelay);
$(document).on("change", "#scan-mode", function(e) $(document).on("change", "#scan-mode", function(e)
{ {

View File

@@ -105,7 +105,7 @@ $("#search").on("keyup", Delay(function()
} }
equipmentTable.search(value).draw(); equipmentTable.search(value).draw();
}, 500)); }, Grocy.FormFocusDelay));
$("#clear-filter-button").on("click", function() $("#clear-filter-button").on("click", function()
{ {

View File

@@ -150,7 +150,7 @@ Grocy.FrontendHelpers.ValidateForm('equipment-form');
setTimeout(function() setTimeout(function()
{ {
$('#name').focus(); $('#name').focus();
}, 500); }, Grocy.FormFocusDelay);
$("#instruction-manual").on("change", function(e) $("#instruction-manual").on("change", function(e)
{ {

View File

@@ -314,7 +314,7 @@ Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
setTimeout(function() setTimeout(function()
{ {
$('#display_amount').focus(); $('#display_amount').focus();
}, 500); }, Grocy.FormFocusDelay);
$('#display_amount').trigger('keyup'); $('#display_amount').trigger('keyup');
RefreshPriceHint(); RefreshPriceHint();
}, },
@@ -361,7 +361,7 @@ if (Grocy.Components.ProductPicker.InAnyFlow() === false && GetUriParam("embedde
{ {
Grocy.Components.ProductPicker.GetInputElement().focus(); Grocy.Components.ProductPicker.GetInputElement().focus();
}, 500); }, Grocy.FormFocusDelay);
} }
else else
{ {
@@ -373,7 +373,7 @@ else
{ {
Grocy.Components.ProductPicker.GetInputElement().focus(); Grocy.Components.ProductPicker.GetInputElement().focus();
}, 500); }, Grocy.FormFocusDelay);
} }
} }
@@ -385,7 +385,7 @@ $('#display_amount').on('focus', function(e)
{ {
Grocy.Components.ProductPicker.GetInputElement().focus(); Grocy.Components.ProductPicker.GetInputElement().focus();
}, 500); }, Grocy.FormFocusDelay);
} }
else else
{ {

View File

@@ -93,4 +93,4 @@ Grocy.FrontendHelpers.ValidateForm('location-form');
setTimeout(function() setTimeout(function()
{ {
$('#name').focus(); $('#name').focus();
}, 500); }, Grocy.FormFocusDelay);

View File

@@ -17,7 +17,7 @@ $("#search").on("keyup", Delay(function()
} }
locationsTable.search(value).draw(); locationsTable.search(value).draw();
}, 500)); }, Grocy.FormFocusDelay));
$("#clear-filter-button").on("click", function() $("#clear-filter-button").on("click", function()
{ {

View File

@@ -1,7 +1,7 @@
setTimeout(function() setTimeout(function()
{ {
$('#username').focus(); $('#username').focus();
}, 500); }, Grocy.FormFocusDelay);
if (GetUriParam('invalid') === 'true') if (GetUriParam('invalid') === 'true')
{ {

View File

@@ -17,7 +17,7 @@ $("#search").on("keyup", Delay(function()
} }
apiKeysTable.search(value).draw(); apiKeysTable.search(value).draw();
}, 500)); }, Grocy.FormFocusDelay));
$("#clear-filter-button").on("click", function() $("#clear-filter-button").on("click", function()
{ {
@@ -99,7 +99,7 @@ $("#add-api-key-modal").on("shown.bs.modal", function(e)
setTimeout(function() setTimeout(function()
{ {
$("#description").focus(); $("#description").focus();
}, 500); }, Grocy.FormFocusDelay);
}); });
$("#new-api-key-button").on("click", function(e) $("#new-api-key-button").on("click", function(e)

View File

@@ -80,4 +80,4 @@ Grocy.FrontendHelpers.ValidateForm('mealplansection-form');
setTimeout(function() setTimeout(function()
{ {
$('#name').focus(); $('#name').focus();
}, 500); }, Grocy.FormFocusDelay);

View File

@@ -17,7 +17,7 @@ $("#search").on("keyup", Delay(function()
} }
mealplanSectionsTable.search(value).draw(); mealplanSectionsTable.search(value).draw();
}, 500)); }, Grocy.FormFocusDelay));
$("#clear-filter-button").on("click", function() $("#clear-filter-button").on("click", function()
{ {

View File

@@ -103,7 +103,7 @@ Grocy.FrontendHelpers.ValidateForm('barcode-form');
setTimeout(function() setTimeout(function()
{ {
$('#barcode').focus(); $('#barcode').focus();
}, 500); }, Grocy.FormFocusDelay);
RefreshLocaleNumberInput(); RefreshLocaleNumberInput();
Grocy.Components.UserfieldsForm.Load() Grocy.Components.UserfieldsForm.Load()

View File

@@ -262,7 +262,7 @@ Grocy.FrontendHelpers.ValidateForm('product-form');
setTimeout(function() setTimeout(function()
{ {
$('#name').focus(); $('#name').focus();
}, 500); }, Grocy.FormFocusDelay);
$(document).on('click', '.product-grocycode-label-print', function(e) $(document).on('click', '.product-grocycode-label-print', function(e)
{ {

View File

@@ -78,5 +78,5 @@ Grocy.Components.UserfieldsForm.Load();
setTimeout(function() setTimeout(function()
{ {
$('#name').focus(); $('#name').focus();
}, 500); }, Grocy.FormFocusDelay);
Grocy.FrontendHelpers.ValidateForm('product-group-form'); Grocy.FrontendHelpers.ValidateForm('product-group-form');

View File

@@ -17,7 +17,7 @@ $("#search").on("keyup", Delay(function()
} }
groupsTable.search(value).draw(); groupsTable.search(value).draw();
}, 500)); }, Grocy.FormFocusDelay));
$("#clear-filter-button").on("click", function() $("#clear-filter-button").on("click", function()
{ {

View File

@@ -21,7 +21,7 @@ $("#search").on("keyup", Delay(function()
} }
productsTable.search(value).draw(); productsTable.search(value).draw();
}, 500)); }, Grocy.FormFocusDelay));
$("#product-group-filter").on("change", function() $("#product-group-filter").on("change", function()
{ {

View File

@@ -355,7 +355,7 @@ if (Grocy.Components.ProductPicker !== undefined)
setTimeout(function() setTimeout(function()
{ {
$('#display_amount').focus(); $('#display_amount').focus();
}, 500); }, Grocy.FormFocusDelay);
Grocy.FrontendHelpers.ValidateForm('purchase-form'); Grocy.FrontendHelpers.ValidateForm('purchase-form');
if (GetUriParam("flow") === "shoppinglistitemtostock" && BoolVal(Grocy.UserSettings.shopping_list_to_stock_workflow_auto_submit_when_prefilled) && Grocy.FrontendHelpers.ValidateForm("purchase-form")) if (GetUriParam("flow") === "shoppinglistitemtostock" && BoolVal(Grocy.UserSettings.shopping_list_to_stock_workflow_auto_submit_when_prefilled) && Grocy.FrontendHelpers.ValidateForm("purchase-form"))
@@ -501,7 +501,7 @@ if (Grocy.Components.ProductPicker)
setTimeout(function() setTimeout(function()
{ {
Grocy.Components.ProductPicker.GetInputElement().focus(); Grocy.Components.ProductPicker.GetInputElement().focus();
}, 500); }, Grocy.FormFocusDelay);
} }
else else
{ {
@@ -512,7 +512,7 @@ if (Grocy.Components.ProductPicker)
setTimeout(function() setTimeout(function()
{ {
Grocy.Components.ProductPicker.GetInputElement().focus(); Grocy.Components.ProductPicker.GetInputElement().focus();
}, 500); }, Grocy.FormFocusDelay);
} }
} }
} }
@@ -524,7 +524,7 @@ $('#display_amount').on('focus', function(e)
setTimeout(function() setTimeout(function()
{ {
Grocy.Components.ProductPicker.GetInputElement().focus(); Grocy.Components.ProductPicker.GetInputElement().focus();
}, 500); }, Grocy.FormFocusDelay);
} }
else else
{ {

View File

@@ -145,7 +145,7 @@ Grocy.FrontendHelpers.ValidateForm('quconversion-form');
setTimeout(function() setTimeout(function()
{ {
$('#from_qu_id').focus(); $('#from_qu_id').focus();
}, 500); }, Grocy.FormFocusDelay);
if (GetUriParam("qu-unit") !== undefined) if (GetUriParam("qu-unit") !== undefined)
{ {

View File

@@ -155,7 +155,7 @@ Grocy.FrontendHelpers.ValidateForm('quantityunit-form');
setTimeout(function() setTimeout(function()
{ {
$('#name').focus(); $('#name').focus();
}, 500); }, Grocy.FormFocusDelay);
$(document).on('click', '.qu-conversion-delete-button', function(e) $(document).on('click', '.qu-conversion-delete-button', function(e)
{ {

View File

@@ -37,4 +37,4 @@ if (GetUriParam("qu") !== undefined)
setTimeout(function() setTimeout(function()
{ {
$("#amount").focus(); $("#amount").focus();
}, 500); }, Grocy.FormFocusDelay);

View File

@@ -17,7 +17,7 @@ $("#search").on("keyup", Delay(function()
} }
quantityUnitsTable.search(value).draw(); quantityUnitsTable.search(value).draw();
}, 500)); }, Grocy.FormFocusDelay));
$("#clear-filter-button").on("click", function() $("#clear-filter-button").on("click", function()
{ {

View File

@@ -109,7 +109,7 @@ Grocy.FrontendHelpers.ValidateForm('recipe-form');
setTimeout(function() setTimeout(function()
{ {
$("#name").focus(); $("#name").focus();
}, 500); }, Grocy.FormFocusDelay);
$('#recipe-form input').keyup(function(event) $('#recipe-form input').keyup(function(event)
{ {

View File

@@ -124,14 +124,14 @@ if (!Grocy.Components.ProductPicker.InAnyFlow())
setTimeout(function() setTimeout(function()
{ {
$("#display_amount").focus(); $("#display_amount").focus();
}, 500); }, Grocy.FormFocusDelay);
} }
else else
{ {
setTimeout(function() setTimeout(function()
{ {
Grocy.Components.ProductPicker.GetInputElement().focus(); Grocy.Components.ProductPicker.GetInputElement().focus();
}, 500); }, Grocy.FormFocusDelay);
} }
} }
else else
@@ -143,7 +143,7 @@ else
setTimeout(function() setTimeout(function()
{ {
Grocy.Components.ProductPicker.GetInputElement().focus(); Grocy.Components.ProductPicker.GetInputElement().focus();
}, 500); }, Grocy.FormFocusDelay);
} }
} }
@@ -159,7 +159,7 @@ $('#display_amount').on('focus', function(e)
setTimeout(function() setTimeout(function()
{ {
Grocy.Components.ProductPicker.GetInputElement().focus(); Grocy.Components.ProductPicker.GetInputElement().focus();
}, 500); }, Grocy.FormFocusDelay);
} }
else else
{ {

View File

@@ -82,7 +82,7 @@ $("#search").on("keyup", Delay(function()
$(".recipe-gallery-item").removeClass("d-none"); $(".recipe-gallery-item").removeClass("d-none");
$(".recipe-gallery-item .card-title-search:not(:contains_case_insensitive(" + value + "))").parent().parent().parent().addClass("d-none"); $(".recipe-gallery-item .card-title-search:not(:contains_case_insensitive(" + value + "))").parent().parent().parent().addClass("d-none");
}, 500)); }, Grocy.FormFocusDelay));
$("#clear-filter-button").on("click", function() $("#clear-filter-button").on("click", function()
{ {

View File

@@ -43,7 +43,7 @@ $("#search").on("keyup", Delay(function()
} }
shoppingListTable.search(value).draw(); shoppingListTable.search(value).draw();
}, 500)); }, Grocy.FormFocusDelay));
$("#clear-filter-button").on("click", function() $("#clear-filter-button").on("click", function()
{ {

View File

@@ -82,5 +82,5 @@ Grocy.Components.UserfieldsForm.Load();
setTimeout(function() setTimeout(function()
{ {
$('#name').focus(); $('#name').focus();
}, 500); }, Grocy.FormFocusDelay);
Grocy.FrontendHelpers.ValidateForm('shopping-list-form'); Grocy.FrontendHelpers.ValidateForm('shopping-list-form');

View File

@@ -213,7 +213,7 @@ Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
setTimeout(function() setTimeout(function()
{ {
$('#display_amount').focus(); $('#display_amount').focus();
}, 500); }, Grocy.FormFocusDelay);
Grocy.FrontendHelpers.ValidateForm('shoppinglist-form'); Grocy.FrontendHelpers.ValidateForm('shoppinglist-form');
Grocy.ShoppingListItemFormInitialLoadDone = true; Grocy.ShoppingListItemFormInitialLoadDone = true;
}, },
@@ -292,14 +292,14 @@ if (!Grocy.Components.ProductPicker.InAnyFlow())
setTimeout(function() setTimeout(function()
{ {
$("#display_amount").focus(); $("#display_amount").focus();
}, 500); }, Grocy.FormFocusDelay);
} }
else else
{ {
setTimeout(function() setTimeout(function()
{ {
Grocy.Components.ProductPicker.GetInputElement().focus(); Grocy.Components.ProductPicker.GetInputElement().focus();
}, 500); }, Grocy.FormFocusDelay);
} }
} }
else else
@@ -311,7 +311,7 @@ else
setTimeout(function() setTimeout(function()
{ {
Grocy.Components.ProductPicker.GetInputElement().focus(); Grocy.Components.ProductPicker.GetInputElement().focus();
}, 500); }, Grocy.FormFocusDelay);
} }
} }

View File

@@ -92,5 +92,5 @@ Grocy.Components.UserfieldsForm.Load();
setTimeout(function() setTimeout(function()
{ {
$('#name').focus(); $('#name').focus();
}, 500); }, Grocy.FormFocusDelay);
Grocy.FrontendHelpers.ValidateForm('shoppinglocation-form'); Grocy.FrontendHelpers.ValidateForm('shoppinglocation-form');

View File

@@ -17,7 +17,7 @@ $("#search").on("keyup", Delay(function()
} }
locationsTable.search(value).draw(); locationsTable.search(value).draw();
}, 500)); }, Grocy.FormFocusDelay));
$("#clear-filter-button").on("click", function() $("#clear-filter-button").on("click", function()
{ {

View File

@@ -302,7 +302,7 @@ function RefreshStockEntryRow(stockRowId)
{ {
RefreshContextualTimeago("#stock-" + stockRowId + "-row"); RefreshContextualTimeago("#stock-" + stockRowId + "-row");
RefreshLocaleNumberDisplay("#stock-" + stockRowId + "-row"); RefreshLocaleNumberDisplay("#stock-" + stockRowId + "-row");
}, 500); }, Grocy.FormFocusDelay);
}, },
function(xhr) function(xhr)
{ {

View File

@@ -148,5 +148,5 @@ Grocy.Components.UserfieldsForm.Load();
setTimeout(function() setTimeout(function()
{ {
$('#amount').focus(); $('#amount').focus();
}, 500); }, Grocy.FormFocusDelay);
Grocy.FrontendHelpers.ValidateForm("stockentry-form"); Grocy.FrontendHelpers.ValidateForm("stockentry-form");

View File

@@ -74,7 +74,7 @@ $("#search").on("keyup", Delay(function()
} }
stockJournalTable.search(value).draw(); stockJournalTable.search(value).draw();
}, 500)); }, Grocy.FormFocusDelay));
$("#clear-filter-button").on("click", function() $("#clear-filter-button").on("click", function()
{ {

View File

@@ -55,7 +55,7 @@ $("#search").on("keyup", Delay(function()
} }
journalSummaryTable.search(value).draw(); journalSummaryTable.search(value).draw();
}, 500)); }, Grocy.FormFocusDelay));
$("#clear-filter-button").on("click", function() $("#clear-filter-button").on("click", function()
{ {

View File

@@ -108,7 +108,7 @@ $("#search").on("keyup", Delay(function()
} }
stockOverviewTable.search(value).draw(); stockOverviewTable.search(value).draw();
}, 500)); }, Grocy.FormFocusDelay));
$(document).on('click', '.product-grocycode-label-print', function(e) $(document).on('click', '.product-grocycode-label-print', function(e)
{ {
@@ -397,7 +397,7 @@ function RefreshProductRow(productId)
{ {
RefreshContextualTimeago("#product-" + productId + "-row"); RefreshContextualTimeago("#product-" + productId + "-row");
RefreshLocaleNumberDisplay("#product-" + productId + "-row"); RefreshLocaleNumberDisplay("#product-" + productId + "-row");
}, 500); }, Grocy.FormFocusDelay);
}, },
function(xhr) function(xhr)
{ {

View File

@@ -17,7 +17,7 @@ $("#search").on("keyup", Delay(function()
} }
categoriesTable.search(value).draw(); categoriesTable.search(value).draw();
}, 500)); }, Grocy.FormFocusDelay));
$("#clear-filter-button").on("click", function() $("#clear-filter-button").on("click", function()
{ {

View File

@@ -92,5 +92,5 @@ Grocy.Components.UserfieldsForm.Load();
setTimeout(function() setTimeout(function()
{ {
$('#name').focus(); $('#name').focus();
}, 500); }, Grocy.FormFocusDelay);
Grocy.FrontendHelpers.ValidateForm('task-category-form'); Grocy.FrontendHelpers.ValidateForm('task-category-form');

View File

@@ -112,6 +112,6 @@ Grocy.Components.UserfieldsForm.Load();
setTimeout(function() setTimeout(function()
{ {
$('#name').focus(); $('#name').focus();
}, 500); }, Grocy.FormFocusDelay);
Grocy.Components.DateTimePicker.GetInputElement().trigger('input'); Grocy.Components.DateTimePicker.GetInputElement().trigger('input');
Grocy.FrontendHelpers.ValidateForm('task-form'); Grocy.FrontendHelpers.ValidateForm('task-form');

View File

@@ -18,7 +18,7 @@ $("#search").on("keyup", Delay(function()
} }
tasksTable.search(value).draw(); tasksTable.search(value).draw();
}, 500)); }, Grocy.FormFocusDelay));
$("#status-filter").on("change", function() $("#status-filter").on("change", function()
{ {

View File

@@ -283,7 +283,7 @@ Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
setTimeout(function() setTimeout(function()
{ {
$('#display_amount').focus(); $('#display_amount').focus();
}, 500); }, Grocy.FormFocusDelay);
}, },
function(xhr) function(xhr)
{ {
@@ -521,7 +521,7 @@ if (GetUriParam("embedded") !== undefined)
setTimeout(function() setTimeout(function()
{ {
Grocy.Components.ProductPicker.GetInputElement().focus(); Grocy.Components.ProductPicker.GetInputElement().focus();
}, 500); }, Grocy.FormFocusDelay);
} }
else else
{ {
@@ -538,4 +538,4 @@ if (GetUriParam("embedded") !== undefined)
setTimeout(function() setTimeout(function()
{ {
Grocy.Components.ProductPicker.GetInputElement().focus(); Grocy.Components.ProductPicker.GetInputElement().focus();
}, 500); }, Grocy.FormFocusDelay);

View File

@@ -17,7 +17,7 @@ $("#search").on("keyup", Delay(function()
} }
userentitiesTable.search(value).draw(); userentitiesTable.search(value).draw();
}, 500)); }, Grocy.FormFocusDelay));
$("#clear-filter-button").on("click", function() $("#clear-filter-button").on("click", function()
{ {

View File

@@ -104,7 +104,7 @@ Grocy.FrontendHelpers.ValidateForm('userentity-form');
setTimeout(function() setTimeout(function()
{ {
$('#name').focus(); $('#name').focus();
}, 500); }, Grocy.FormFocusDelay);
// Click twice to trigger on-click but not change the actual checked state // Click twice to trigger on-click but not change the actual checked state
$("#show_in_sidebar_menu").click(); $("#show_in_sidebar_menu").click();

View File

@@ -118,14 +118,14 @@ if (GetUriParam("entity"))
setTimeout(function() setTimeout(function()
{ {
$('#name').focus(); $('#name').focus();
}, 500); }, Grocy.FormFocusDelay);
} }
else else
{ {
setTimeout(function() setTimeout(function()
{ {
$('#entity').focus(); $('#entity').focus();
}, 500); }, Grocy.FormFocusDelay);
} }
$("#type").trigger("change"); $("#type").trigger("change");

View File

@@ -17,7 +17,7 @@ $("#search").on("keyup", Delay(function()
} }
userfieldsTable.search(value).draw(); userfieldsTable.search(value).draw();
}, 500)); }, Grocy.FormFocusDelay));
$("#entity-filter").on("change", function() $("#entity-filter").on("change", function()
{ {
@@ -83,5 +83,5 @@ if (GetUriParam("entity"))
setTimeout(function() setTimeout(function()
{ {
$("#name").focus(); $("#name").focus();
}, 500); }, Grocy.FormFocusDelay);
} }

View File

@@ -146,7 +146,7 @@ $("#change_password").click(function()
setTimeout(function() setTimeout(function()
{ {
$("#password").focus(); $("#password").focus();
}, 500); }, Grocy.FormFocusDelay);
}); });
if (GetUriParam("changepw") === "true") if (GetUriParam("changepw") === "true")
@@ -158,7 +158,7 @@ else
setTimeout(function() setTimeout(function()
{ {
$('#username').focus(); $('#username').focus();
}, 500); }, Grocy.FormFocusDelay);
} }
Grocy.Components.UserfieldsForm.Load(); Grocy.Components.UserfieldsForm.Load();

View File

@@ -74,4 +74,4 @@ $("#userfields-form").removeClass("border").removeClass("border-info").removeCla
setTimeout(function() setTimeout(function()
{ {
$(".userfield-input").first().focus(); $(".userfield-input").first().focus();
}, 500); }, Grocy.FormFocusDelay);

View File

@@ -17,7 +17,7 @@ $("#search").on("keyup", Delay(function()
} }
userobjectsTable.search(value).draw(); userobjectsTable.search(value).draw();
}, 500)); }, Grocy.FormFocusDelay));
$("#clear-filter-button").on("click", function() $("#clear-filter-button").on("click", function()
{ {

View File

@@ -17,7 +17,7 @@ $("#search").on("keyup", Delay(function()
} }
usersTable.search(value).draw(); usersTable.search(value).draw();
}, 500)); }, Grocy.FormFocusDelay));
$("#clear-filter-button").on("click", function() $("#clear-filter-button").on("click", function()
{ {