mirror of
https://github.com/grocy/grocy.git
synced 2025-10-15 01:37:13 +00:00
Applied EditorConfig settings to all files
This commit is contained in:
@@ -8,14 +8,14 @@ Grocy.Components.BarcodeScanner.CheckCapabilities = async function()
|
||||
if (typeof track.getCapabilities === 'function') {
|
||||
capabilities = track.getCapabilities();
|
||||
}
|
||||
|
||||
|
||||
// If there is more than 1 camera, show the camera selection
|
||||
var cameras = await Quagga.CameraAccess.enumerateVideoDevices();
|
||||
var cameraSelect = document.querySelector('.cameraSelect-wrapper');
|
||||
if (cameraSelect) {
|
||||
cameraSelect.style.display = cameras.length > 1 ? 'inline-block' : 'none';
|
||||
}
|
||||
|
||||
|
||||
// Check if the camera is capable to turn on a torch.
|
||||
var canTorch = typeof capabilities.torch === 'boolean' && capabilities.torch
|
||||
// Remove the torch button, if either the device can not torch or AutoTorchOn is set.
|
||||
@@ -133,7 +133,7 @@ Grocy.Components.BarcodeScanner.StartScanning = function()
|
||||
Grocy.Components.BarcodeScanner.StopScanning = function()
|
||||
{
|
||||
Quagga.stop();
|
||||
|
||||
|
||||
Grocy.Components.BarcodeScanner.DecodedCodesCount = 0;
|
||||
Grocy.Components.BarcodeScanner.DecodedCodesErrorCount = 0;
|
||||
|
||||
@@ -143,9 +143,9 @@ Grocy.Components.BarcodeScanner.StopScanning = function()
|
||||
Grocy.Components.BarcodeScanner.TorchOn = function(track)
|
||||
{
|
||||
if (track) {
|
||||
track.applyConstraints({
|
||||
track.applyConstraints({
|
||||
advanced: [
|
||||
{
|
||||
{
|
||||
torch: true
|
||||
}
|
||||
]
|
||||
@@ -214,7 +214,7 @@ $(document).on("click", "#barcodescanner-start-button", async function(e)
|
||||
}
|
||||
|
||||
Grocy.Components.BarcodeScanner.CurrentTarget = inputElement.attr("data-target");
|
||||
|
||||
|
||||
var dialog = bootbox.dialog({
|
||||
message: '<div id="barcodescanner-container" class="col"><div id="barcodescanner-livestream"></div></div>',
|
||||
title: __t('Scan a barcode'),
|
||||
@@ -233,8 +233,8 @@ $(document).on("click", "#barcodescanner-start-button", async function(e)
|
||||
{
|
||||
Grocy.Components.BarcodeScanner.TorchOn(Quagga.CameraAccess.getActiveTrack());
|
||||
return false;
|
||||
}
|
||||
},
|
||||
}
|
||||
},
|
||||
cancel: {
|
||||
label: __t('Cancel'),
|
||||
className: 'btn-secondary responsive-button',
|
||||
@@ -245,11 +245,11 @@ $(document).on("click", "#barcodescanner-start-button", async function(e)
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// Add camera select to existing dialog
|
||||
dialog.find('.bootbox-body').append('<div class="form-group py-0 my-1 cameraSelect-wrapper"><select class="form-control cameraSelect"><select class="form-control cameraSelect" style="display: none"></select></div>');
|
||||
var cameraSelect = document.querySelector('.cameraSelect');
|
||||
|
||||
|
||||
var cameras = await Quagga.CameraAccess.enumerateVideoDevices();
|
||||
cameras.forEach(camera => {
|
||||
var option = document.createElement("option");
|
||||
@@ -266,7 +266,7 @@ $(document).on("click", "#barcodescanner-start-button", async function(e)
|
||||
Quagga.stop();
|
||||
Grocy.Components.BarcodeScanner.StartScanning();
|
||||
};
|
||||
|
||||
|
||||
Grocy.Components.BarcodeScanner.StartScanning();
|
||||
});
|
||||
|
||||
|
@@ -132,7 +132,7 @@ Grocy.Components.DateTimePicker.GetInputElement().on('keyup', function(e)
|
||||
var centuryEnd = Number.parseInt(now.getFullYear().toString().substring(0, 2) + '99');
|
||||
var format = Grocy.Components.DateTimePicker.GetInputElement().data('format');
|
||||
var nextInputElement = $(Grocy.Components.DateTimePicker.GetInputElement().data('next-input-selector'));
|
||||
|
||||
|
||||
//If input is empty and any arrow key is pressed, set date to today
|
||||
if (value.length === 0 && (e.keyCode === 38 || e.keyCode === 40 || e.keyCode === 37 || e.keyCode === 39))
|
||||
{
|
||||
@@ -224,7 +224,7 @@ Grocy.Components.DateTimePicker.GetInputElement().on('keyup', function(e)
|
||||
if ($(element).hasAttr("required"))
|
||||
{
|
||||
element.setCustomValidity("error");
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@@ -132,7 +132,7 @@ Grocy.Components.DateTimePicker2.GetInputElement().on('keyup', function(e)
|
||||
var centuryEnd = Number.parseInt(now.getFullYear().toString().substring(0, 2) + '99');
|
||||
var format = Grocy.Components.DateTimePicker2.GetInputElement().data('format');
|
||||
var nextInputElement = $(Grocy.Components.DateTimePicker2.GetInputElement().data('next-input-selector'));
|
||||
|
||||
|
||||
//If input is empty and any arrow key is pressed, set date to today
|
||||
if (value.length === 0 && (e.keyCode === 38 || e.keyCode === 40 || e.keyCode === 37 || e.keyCode === 39))
|
||||
{
|
||||
@@ -224,7 +224,7 @@ Grocy.Components.DateTimePicker2.GetInputElement().on('keyup', function(e)
|
||||
if ($(element).hasAttr("required"))
|
||||
{
|
||||
element.setCustomValidity("error");
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@@ -50,7 +50,7 @@ Grocy.Components.ProductAmountPicker.SetQuantityUnit = function(quId)
|
||||
Grocy.Components.ProductAmountPicker.AllowAnyQu = function(keepInitialQu = false)
|
||||
{
|
||||
Grocy.Components.ProductAmountPicker.AllowAnyQuEnabled = true;
|
||||
|
||||
|
||||
$("#qu_id").find("option").remove().end();
|
||||
Grocy.QuantityUnits.forEach(qu =>
|
||||
{
|
||||
|
@@ -156,7 +156,7 @@ Grocy.Components.ProductCard.Refresh = function(productId)
|
||||
{
|
||||
key = dataPoint.shopping_location.name
|
||||
}
|
||||
|
||||
|
||||
if (!datasets[key]) {
|
||||
datasets[key] = []
|
||||
}
|
||||
|
@@ -130,13 +130,13 @@ $('#product_id_text_input').on('blur', function(e)
|
||||
{
|
||||
if (Grocy.Components.ProductPicker.GetPicker().hasClass("combobox-menu-visible"))
|
||||
{
|
||||
return;
|
||||
return;
|
||||
}
|
||||
$('#product_id').attr("barcode", "null");
|
||||
|
||||
var input = $('#product_id_text_input').val().toString();
|
||||
var possibleOptionElement = $("#product_id option[data-additional-searchdata*=\"" + input + ",\"]").first();
|
||||
|
||||
|
||||
if (GetUriParam('addbarcodetoselection') === undefined && input.length > 0 && possibleOptionElement.length > 0)
|
||||
{
|
||||
$('#product_id').val(possibleOptionElement.val());
|
||||
@@ -235,7 +235,7 @@ $(document).on("Grocy.BarcodeScanned", function(e, barcode, target)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Don't know why the blur event does not fire immediately ... this works...
|
||||
|
||||
Grocy.Components.ProductPicker.GetInputElement().focusout();
|
||||
@@ -243,7 +243,7 @@ $(document).on("Grocy.BarcodeScanned", function(e, barcode, target)
|
||||
Grocy.Components.ProductPicker.GetInputElement().blur();
|
||||
|
||||
Grocy.Components.ProductPicker.GetInputElement().val(barcode);
|
||||
|
||||
|
||||
setTimeout(function()
|
||||
{
|
||||
Grocy.Components.ProductPicker.GetInputElement().focusout();
|
||||
|
@@ -69,7 +69,7 @@ Grocy.Components.UserfieldsForm.Load = function()
|
||||
$.each(result, function(key, value)
|
||||
{
|
||||
var input = $(".userfield-input[data-userfield-name='" + key + "']");
|
||||
|
||||
|
||||
if (input.attr("type") == "checkbox" && value == 1)
|
||||
{
|
||||
input.prop("checked", true);
|
||||
|
Reference in New Issue
Block a user