mirror of
https://github.com/grocy/grocy.git
synced 2025-08-18 03:25:50 +00:00
Support camera barcode scanning in recipepicker (references #1562)
This commit is contained in:
@@ -101,3 +101,25 @@ $('#recipe_id_text_input').on('blur', function(e)
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$(document).on("Grocy.BarcodeScanned", function(e, barcode, target)
|
||||
{
|
||||
if (!(target == "@recipepicker" || target == "undefined" || target == undefined)) // Default target
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Don't know why the blur event does not fire immediately ... this works...
|
||||
Grocy.Components.RecipePicker.GetInputElement().focusout();
|
||||
Grocy.Components.RecipePicker.GetInputElement().focus();
|
||||
Grocy.Components.RecipePicker.GetInputElement().blur();
|
||||
|
||||
Grocy.Components.RecipePicker.GetInputElement().val(barcode);
|
||||
|
||||
setTimeout(function()
|
||||
{
|
||||
Grocy.Components.RecipePicker.GetInputElement().focusout();
|
||||
Grocy.Components.RecipePicker.GetInputElement().focus();
|
||||
Grocy.Components.RecipePicker.GetInputElement().blur();
|
||||
}, 200);
|
||||
});
|
||||
|
Reference in New Issue
Block a user