mirror of
https://github.com/grocy/grocy.git
synced 2025-10-13 00:54:38 +00:00
Applied VSCode JS formatting settings
This commit is contained in:
@@ -1,18 +1,20 @@
|
||||
Grocy.Components.BarcodeScanner = { };
|
||||
Grocy.Components.BarcodeScanner = {};
|
||||
|
||||
Grocy.Components.BarcodeScanner.LiveVideoSizeAdjusted = false;
|
||||
Grocy.Components.BarcodeScanner.CheckCapabilities = async function()
|
||||
{
|
||||
var track = Quagga.CameraAccess.getActiveTrack();
|
||||
var capabilities = {};
|
||||
if (typeof track.getCapabilities === '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) {
|
||||
if (cameraSelect)
|
||||
{
|
||||
cameraSelect.style.display = cameras.length > 1 ? 'inline-block' : 'none';
|
||||
}
|
||||
|
||||
@@ -20,11 +22,13 @@ Grocy.Components.BarcodeScanner.CheckCapabilities = async function()
|
||||
var canTorch = typeof capabilities.torch === 'boolean' && capabilities.torch
|
||||
// Remove the torch button, if either the device can not torch or AutoTorchOn is set.
|
||||
var node = document.querySelector('.torch');
|
||||
if (node) {
|
||||
if (node)
|
||||
{
|
||||
node.style.display = canTorch && !Grocy.FeatureFlags.GROCY_FEATURE_FLAG_AUTO_TORCH_ON_WITH_CAMERA ? 'inline-block' : 'none';
|
||||
}
|
||||
// If AutoTorchOn is set, turn on the torch.
|
||||
if (canTorch && Grocy.FeatureFlags.GROCY_FEATURE_FLAG_AUTO_TORCH_ON_WITH_CAMERA) {
|
||||
if (canTorch && Grocy.FeatureFlags.GROCY_FEATURE_FLAG_AUTO_TORCH_ON_WITH_CAMERA)
|
||||
{
|
||||
Grocy.Components.BarcodeScanner.TorchOn(track);
|
||||
}
|
||||
|
||||
@@ -65,7 +69,7 @@ Grocy.Components.BarcodeScanner.StartScanning = function()
|
||||
target: document.querySelector("#barcodescanner-livestream"),
|
||||
constraints: {
|
||||
facingMode: "environment",
|
||||
...(window.localStorage.getItem('cameraId') && {deviceId : window.localStorage.getItem('cameraId')}) // If preferred cameraId is set, request to use that specific camera
|
||||
...(window.localStorage.getItem('cameraId') && { deviceId: window.localStorage.getItem('cameraId') }) // If preferred cameraId is set, request to use that specific camera
|
||||
}
|
||||
},
|
||||
locator: {
|
||||
@@ -142,7 +146,8 @@ Grocy.Components.BarcodeScanner.StopScanning = function()
|
||||
|
||||
Grocy.Components.BarcodeScanner.TorchOn = function(track)
|
||||
{
|
||||
if (track) {
|
||||
if (track)
|
||||
{
|
||||
track.applyConstraints({
|
||||
advanced: [
|
||||
{
|
||||
@@ -233,7 +238,7 @@ $(document).on("click", "#barcodescanner-start-button", async function(e)
|
||||
{
|
||||
Grocy.Components.BarcodeScanner.TorchOn(Quagga.CameraAccess.getActiveTrack());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
},
|
||||
cancel: {
|
||||
label: __t('Cancel'),
|
||||
@@ -251,7 +256,8 @@ $(document).on("click", "#barcodescanner-start-button", async function(e)
|
||||
var cameraSelect = document.querySelector('.cameraSelect');
|
||||
|
||||
var cameras = await Quagga.CameraAccess.enumerateVideoDevices();
|
||||
cameras.forEach(camera => {
|
||||
cameras.forEach(camera =>
|
||||
{
|
||||
var option = document.createElement("option");
|
||||
option.text = camera.label ? camera.label : camera.deviceId; // Use camera label if it exists, else show device id
|
||||
option.value = camera.deviceId;
|
||||
@@ -261,7 +267,8 @@ $(document).on("click", "#barcodescanner-start-button", async function(e)
|
||||
// Set initial value to preferred camera if one exists - and if not, start out empty
|
||||
cameraSelect.value = window.localStorage.getItem('cameraId');
|
||||
|
||||
cameraSelect.onchange = function(){
|
||||
cameraSelect.onchange = function()
|
||||
{
|
||||
window.localStorage.setItem('cameraId', cameraSelect.value);
|
||||
Quagga.stop();
|
||||
Grocy.Components.BarcodeScanner.StartScanning();
|
||||
|
@@ -1,4 +1,4 @@
|
||||
Grocy.Components.BatteryCard = { };
|
||||
Grocy.Components.BatteryCard = {};
|
||||
|
||||
Grocy.Components.BatteryCard.Refresh = function(batteryId)
|
||||
{
|
||||
|
@@ -1,40 +1,40 @@
|
||||
$('#calendar').datetimepicker(
|
||||
{
|
||||
format: 'L',
|
||||
buttons: {
|
||||
showToday: true,
|
||||
showClose: false
|
||||
},
|
||||
calendarWeeks: true,
|
||||
locale: moment.locale(),
|
||||
icons: {
|
||||
time: 'far fa-clock',
|
||||
date: 'far fa-calendar',
|
||||
up: 'fas fa-arrow-up',
|
||||
down: 'fas fa-arrow-down',
|
||||
previous: 'fas fa-chevron-left',
|
||||
next: 'fas fa-chevron-right',
|
||||
today: 'fas fa-calendar-check',
|
||||
clear: 'far fa-trash-alt',
|
||||
close: 'far fa-times-circle'
|
||||
},
|
||||
keepOpen: true,
|
||||
inline: true,
|
||||
keyBinds: {
|
||||
up: function(widget) { },
|
||||
down: function(widget) { },
|
||||
'control up': function(widget) { },
|
||||
'control down': function(widget) { },
|
||||
left: function(widget) { },
|
||||
right: function(widget) { },
|
||||
pageUp: function(widget) { },
|
||||
pageDown: function(widget) { },
|
||||
enter: function(widget) { },
|
||||
escape: function(widget) { },
|
||||
'control space': function(widget) { },
|
||||
t: function(widget) { },
|
||||
'delete': function(widget) { }
|
||||
}
|
||||
});
|
||||
{
|
||||
format: 'L',
|
||||
buttons: {
|
||||
showToday: true,
|
||||
showClose: false
|
||||
},
|
||||
calendarWeeks: true,
|
||||
locale: moment.locale(),
|
||||
icons: {
|
||||
time: 'far fa-clock',
|
||||
date: 'far fa-calendar',
|
||||
up: 'fas fa-arrow-up',
|
||||
down: 'fas fa-arrow-down',
|
||||
previous: 'fas fa-chevron-left',
|
||||
next: 'fas fa-chevron-right',
|
||||
today: 'fas fa-calendar-check',
|
||||
clear: 'far fa-trash-alt',
|
||||
close: 'far fa-times-circle'
|
||||
},
|
||||
keepOpen: true,
|
||||
inline: true,
|
||||
keyBinds: {
|
||||
up: function(widget) { },
|
||||
down: function(widget) { },
|
||||
'control up': function(widget) { },
|
||||
'control down': function(widget) { },
|
||||
left: function(widget) { },
|
||||
right: function(widget) { },
|
||||
pageUp: function(widget) { },
|
||||
pageDown: function(widget) { },
|
||||
enter: function(widget) { },
|
||||
escape: function(widget) { },
|
||||
'control space': function(widget) { },
|
||||
t: function(widget) { },
|
||||
'delete': function(widget) { }
|
||||
}
|
||||
});
|
||||
|
||||
$('#calendar').datetimepicker('show');
|
||||
|
@@ -1,4 +1,4 @@
|
||||
Grocy.Components.ChoreCard = { };
|
||||
Grocy.Components.ChoreCard = {};
|
||||
|
||||
Grocy.Components.ChoreCard.Refresh = function(choreId)
|
||||
{
|
||||
|
@@ -1,4 +1,4 @@
|
||||
Grocy.Components.DateTimePicker = { };
|
||||
Grocy.Components.DateTimePicker = {};
|
||||
|
||||
Grocy.Components.DateTimePicker.GetInputElement = function()
|
||||
{
|
||||
@@ -80,45 +80,45 @@ if (Grocy.Components.DateTimePicker.GetInputElement().data('limit-end-to-now') =
|
||||
Grocy.Components.DateTimePicker.Init = function()
|
||||
{
|
||||
$('.datetimepicker').datetimepicker(
|
||||
{
|
||||
format: Grocy.Components.DateTimePicker.GetInputElement().data('format'),
|
||||
buttons: {
|
||||
showToday: true,
|
||||
showClose: true
|
||||
},
|
||||
calendarWeeks: Grocy.CalendarShowWeekNumbers,
|
||||
maxDate: limitDate,
|
||||
locale: moment.locale(),
|
||||
defaultDate: startDate,
|
||||
useCurrent: false,
|
||||
icons: {
|
||||
time: 'far fa-clock',
|
||||
date: 'far fa-calendar',
|
||||
up: 'fas fa-arrow-up',
|
||||
down: 'fas fa-arrow-down',
|
||||
previous: 'fas fa-chevron-left',
|
||||
next: 'fas fa-chevron-right',
|
||||
today: 'fas fa-calendar-check',
|
||||
clear: 'far fa-trash-alt',
|
||||
close: 'far fa-times-circle'
|
||||
},
|
||||
sideBySide: true,
|
||||
keyBinds: {
|
||||
up: function(widget) { },
|
||||
down: function(widget) { },
|
||||
'control up': function(widget) { },
|
||||
'control down': function(widget) { },
|
||||
left: function(widget) { },
|
||||
right: function(widget) { },
|
||||
pageUp: function(widget) { },
|
||||
pageDown: function(widget) { },
|
||||
enter: function(widget) { },
|
||||
escape: function(widget) { },
|
||||
'control space': function(widget) { },
|
||||
t: function(widget) { },
|
||||
'delete': function(widget) { }
|
||||
}
|
||||
});
|
||||
{
|
||||
format: Grocy.Components.DateTimePicker.GetInputElement().data('format'),
|
||||
buttons: {
|
||||
showToday: true,
|
||||
showClose: true
|
||||
},
|
||||
calendarWeeks: Grocy.CalendarShowWeekNumbers,
|
||||
maxDate: limitDate,
|
||||
locale: moment.locale(),
|
||||
defaultDate: startDate,
|
||||
useCurrent: false,
|
||||
icons: {
|
||||
time: 'far fa-clock',
|
||||
date: 'far fa-calendar',
|
||||
up: 'fas fa-arrow-up',
|
||||
down: 'fas fa-arrow-down',
|
||||
previous: 'fas fa-chevron-left',
|
||||
next: 'fas fa-chevron-right',
|
||||
today: 'fas fa-calendar-check',
|
||||
clear: 'far fa-trash-alt',
|
||||
close: 'far fa-times-circle'
|
||||
},
|
||||
sideBySide: true,
|
||||
keyBinds: {
|
||||
up: function(widget) { },
|
||||
down: function(widget) { },
|
||||
'control up': function(widget) { },
|
||||
'control down': function(widget) { },
|
||||
left: function(widget) { },
|
||||
right: function(widget) { },
|
||||
pageUp: function(widget) { },
|
||||
pageDown: function(widget) { },
|
||||
enter: function(widget) { },
|
||||
escape: function(widget) { },
|
||||
'control space': function(widget) { },
|
||||
t: function(widget) { },
|
||||
'delete': function(widget) { }
|
||||
}
|
||||
});
|
||||
}
|
||||
Grocy.Components.DateTimePicker.Init();
|
||||
|
||||
|
@@ -1,4 +1,4 @@
|
||||
Grocy.Components.DateTimePicker2 = { };
|
||||
Grocy.Components.DateTimePicker2 = {};
|
||||
|
||||
Grocy.Components.DateTimePicker2.GetInputElement = function()
|
||||
{
|
||||
@@ -80,45 +80,45 @@ if (Grocy.Components.DateTimePicker2.GetInputElement().data('limit-end-to-now')
|
||||
Grocy.Components.DateTimePicker2.Init = function()
|
||||
{
|
||||
$('.datetimepicker2').datetimepicker(
|
||||
{
|
||||
format: Grocy.Components.DateTimePicker2.GetInputElement().data('format'),
|
||||
buttons: {
|
||||
showToday: true,
|
||||
showClose: true
|
||||
},
|
||||
calendarWeeks: Grocy.CalendarShowWeekNumbers,
|
||||
maxDate: limitDate,
|
||||
locale: moment.locale(),
|
||||
defaultDate: startDate,
|
||||
useCurrent: false,
|
||||
icons: {
|
||||
time: 'far fa-clock',
|
||||
date: 'far fa-calendar',
|
||||
up: 'fas fa-arrow-up',
|
||||
down: 'fas fa-arrow-down',
|
||||
previous: 'fas fa-chevron-left',
|
||||
next: 'fas fa-chevron-right',
|
||||
today: 'fas fa-calendar-check',
|
||||
clear: 'far fa-trash-alt',
|
||||
close: 'far fa-times-circle'
|
||||
},
|
||||
sideBySide: true,
|
||||
keyBinds: {
|
||||
up: function(widget) { },
|
||||
down: function(widget) { },
|
||||
'control up': function(widget) { },
|
||||
'control down': function(widget) { },
|
||||
left: function(widget) { },
|
||||
right: function(widget) { },
|
||||
pageUp: function(widget) { },
|
||||
pageDown: function(widget) { },
|
||||
enter: function(widget) { },
|
||||
escape: function(widget) { },
|
||||
'control space': function(widget) { },
|
||||
t: function(widget) { },
|
||||
'delete': function(widget) { }
|
||||
}
|
||||
});
|
||||
{
|
||||
format: Grocy.Components.DateTimePicker2.GetInputElement().data('format'),
|
||||
buttons: {
|
||||
showToday: true,
|
||||
showClose: true
|
||||
},
|
||||
calendarWeeks: Grocy.CalendarShowWeekNumbers,
|
||||
maxDate: limitDate,
|
||||
locale: moment.locale(),
|
||||
defaultDate: startDate,
|
||||
useCurrent: false,
|
||||
icons: {
|
||||
time: 'far fa-clock',
|
||||
date: 'far fa-calendar',
|
||||
up: 'fas fa-arrow-up',
|
||||
down: 'fas fa-arrow-down',
|
||||
previous: 'fas fa-chevron-left',
|
||||
next: 'fas fa-chevron-right',
|
||||
today: 'fas fa-calendar-check',
|
||||
clear: 'far fa-trash-alt',
|
||||
close: 'far fa-times-circle'
|
||||
},
|
||||
sideBySide: true,
|
||||
keyBinds: {
|
||||
up: function(widget) { },
|
||||
down: function(widget) { },
|
||||
'control up': function(widget) { },
|
||||
'control down': function(widget) { },
|
||||
left: function(widget) { },
|
||||
right: function(widget) { },
|
||||
pageUp: function(widget) { },
|
||||
pageDown: function(widget) { },
|
||||
enter: function(widget) { },
|
||||
escape: function(widget) { },
|
||||
'control space': function(widget) { },
|
||||
t: function(widget) { },
|
||||
'delete': function(widget) { }
|
||||
}
|
||||
});
|
||||
}
|
||||
Grocy.Components.DateTimePicker2.Init();
|
||||
|
||||
|
@@ -1,4 +1,4 @@
|
||||
Grocy.Components.LocationPicker = { };
|
||||
Grocy.Components.LocationPicker = {};
|
||||
|
||||
Grocy.Components.LocationPicker.GetPicker = function()
|
||||
{
|
||||
|
@@ -1,4 +1,4 @@
|
||||
$(".numberpicker-down-button").unbind('click').on("click", function ()
|
||||
$(".numberpicker-down-button").unbind('click').on("click", function()
|
||||
{
|
||||
var inputElement = $(this).parent().parent().find('input[type="number"]')[0];
|
||||
inputElement.stepDown();
|
||||
|
@@ -83,7 +83,7 @@ $(".input-group-productamountpicker").on("change", function()
|
||||
$("#qu-conversion-info").text(__t("This equals %1$s %2$s in stock", destinationAmount.toLocaleString(), destinationQuName));
|
||||
}
|
||||
|
||||
$("#amount").val(destinationAmount.toFixed(4).replace(/0*$/g,''));
|
||||
$("#amount").val(destinationAmount.toFixed(4).replace(/0*$/g, ''));
|
||||
});
|
||||
|
||||
$("#display_amount").on("keyup", function()
|
||||
|
@@ -1,4 +1,4 @@
|
||||
Grocy.Components.ProductCard = { };
|
||||
Grocy.Components.ProductCard = {};
|
||||
|
||||
Grocy.Components.ProductCard.Refresh = function(productId)
|
||||
{
|
||||
@@ -95,7 +95,7 @@ Grocy.Components.ProductCard.Refresh = function(productId)
|
||||
{
|
||||
if (productDetails.last_qu_factor_purchase_to_stock > 1)
|
||||
{
|
||||
$('#productcard-product-last-price').text(Number.parseFloat(productDetails.last_price).toLocaleString() + ' ' + Grocy.Currency + ' per 1 ' + productDetails.quantity_unit_purchase.name + ' of ' + productDetails.last_qu_factor_purchase_to_stock + ' ' + productDetails.quantity_unit_stock.name_plural);
|
||||
$('#productcard-product-last-price').text(Number.parseFloat(productDetails.last_price).toLocaleString() + ' ' + Grocy.Currency + ' per 1 ' + productDetails.quantity_unit_purchase.name + ' of ' + productDetails.last_qu_factor_purchase_to_stock + ' ' + productDetails.quantity_unit_stock.name_plural);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -157,14 +157,16 @@ Grocy.Components.ProductCard.Refresh = function(productId)
|
||||
key = dataPoint.shopping_location.name
|
||||
}
|
||||
|
||||
if (!datasets[key]) {
|
||||
if (!datasets[key])
|
||||
{
|
||||
datasets[key] = []
|
||||
}
|
||||
chart.labels.push(moment(dataPoint.date).toDate());
|
||||
datasets[key].push(dataPoint.price);
|
||||
|
||||
});
|
||||
Object.keys(datasets).forEach((key) => {
|
||||
Object.keys(datasets).forEach((key) =>
|
||||
{
|
||||
chart.datasets.push({
|
||||
data: datasets[key],
|
||||
fill: false,
|
||||
|
@@ -1,4 +1,4 @@
|
||||
Grocy.Components.ProductPicker = { };
|
||||
Grocy.Components.ProductPicker = {};
|
||||
|
||||
Grocy.Components.ProductPicker.GetPicker = function()
|
||||
{
|
||||
|
@@ -1,4 +1,4 @@
|
||||
Grocy.Components.RecipePicker = { };
|
||||
Grocy.Components.RecipePicker = {};
|
||||
|
||||
Grocy.Components.RecipePicker.GetPicker = function()
|
||||
{
|
||||
|
@@ -1,4 +1,4 @@
|
||||
Grocy.Components.ShoppingLocationPicker = { };
|
||||
Grocy.Components.ShoppingLocationPicker = {};
|
||||
|
||||
Grocy.Components.ShoppingLocationPicker.GetPicker = function()
|
||||
{
|
||||
|
@@ -1,4 +1,4 @@
|
||||
Grocy.Components.UserfieldsForm = { };
|
||||
Grocy.Components.UserfieldsForm = {};
|
||||
|
||||
Grocy.Components.UserfieldsForm.Save = function(success, error)
|
||||
{
|
||||
@@ -12,7 +12,7 @@ Grocy.Components.UserfieldsForm.Save = function(success, error)
|
||||
return;
|
||||
}
|
||||
|
||||
var jsonData = { };
|
||||
var jsonData = {};
|
||||
|
||||
$("#userfields-form .userfield-input").not("div").each(function()
|
||||
{
|
||||
|
@@ -1,4 +1,4 @@
|
||||
Grocy.Components.UserPicker = { };
|
||||
Grocy.Components.UserPicker = {};
|
||||
|
||||
Grocy.Components.UserPicker.GetPicker = function()
|
||||
{
|
||||
|
Reference in New Issue
Block a user