mirror of
https://github.com/Laxilef/OTGateway.git
synced 2025-12-12 03:04:27 +05:00
refactor: cosmetic changes
This commit is contained in:
@@ -796,6 +796,10 @@
|
||||
maxTemp: null
|
||||
};
|
||||
|
||||
const hasNeedDecimationChart = () => {
|
||||
return window.innerWidth <= 800;
|
||||
}
|
||||
|
||||
const makeEquithermChart = () => {
|
||||
if (etChart == null) {
|
||||
const ctx = document.getElementById('etChart').getContext('2d');
|
||||
@@ -830,6 +834,7 @@
|
||||
},
|
||||
options: {
|
||||
responsive: true,
|
||||
resizeDelay: 500,
|
||||
parsing: false,
|
||||
interaction: {
|
||||
mode: 'nearest',
|
||||
@@ -850,7 +855,7 @@
|
||||
display: false
|
||||
},
|
||||
decimation: {
|
||||
enabled: false,
|
||||
enabled: hasNeedDecimationChart(),
|
||||
algorithm: 'lttb',
|
||||
samples: 30,
|
||||
threshold: 30
|
||||
@@ -1202,9 +1207,8 @@
|
||||
if (etChart) {
|
||||
etChart.resize();
|
||||
|
||||
const decimation = window.innerWidth <= 800;
|
||||
if (etChart.options.plugins.decimation.enabled != decimation) {
|
||||
etChart.options.plugins.decimation.enabled = decimation;
|
||||
if (etChart.options.plugins.decimation.enabled != hasNeedDecimationChart()) {
|
||||
etChart.options.plugins.decimation.enabled = hasNeedDecimationChart();
|
||||
etChart.update();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,8 +5,13 @@ const setupForm = (formSelector, onResultCallback = null, noCastItems = []) => {
|
||||
}
|
||||
|
||||
form.querySelectorAll('input').forEach(item => {
|
||||
item.addEventListener('change', (e) => {
|
||||
e.target.setAttribute('aria-invalid', !e.target.checkValidity());
|
||||
item.addEventListener('change', (event) => {
|
||||
if (!event.target.checkValidity()) {
|
||||
event.target.setAttribute('aria-invalid', true);
|
||||
|
||||
} else if (event.target.hasAttribute('aria-invalid')) {
|
||||
event.target.removeAttribute('aria-invalid');
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
@@ -650,7 +655,7 @@ const setRadioValue = (selector, value, parent = undefined) => {
|
||||
const checked = item.value == value;
|
||||
if (item.checked != checked) {
|
||||
item.checked = checked;
|
||||
|
||||
|
||||
setTimeout(() => {
|
||||
item.dispatchEvent(new Event("change"));
|
||||
}, 10);
|
||||
|
||||
Reference in New Issue
Block a user