Spaces:
Running
Running
Update nutri_call.html
Browse files- nutri_call.html +26 -0
nutri_call.html
CHANGED
@@ -692,7 +692,33 @@ function data_out(response) {
|
|
692 |
}
|
693 |
|
694 |
|
|
|
|
|
|
|
695 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
696 |
</script>
|
697 |
|
698 |
|
|
|
692 |
}
|
693 |
|
694 |
|
695 |
+
<!-- Вместо PNotify -->
|
696 |
+
<link href="https://cdn.jsdelivr.net/npm/notyf@3/notyf.min.css" rel="stylesheet">
|
697 |
+
<script src="https://cdn.jsdelivr.net/npm/notyf@3/notyf.min.js"></script>
|
698 |
|
699 |
+
<script>
|
700 |
+
// Инициализация
|
701 |
+
const notyf = new Notyf({
|
702 |
+
duration: 5000,
|
703 |
+
position: {x: 'right', y: 'top'},
|
704 |
+
types: [
|
705 |
+
{type: 'success', background: '#4CAF50'},
|
706 |
+
{type: 'error', background: '#F44336'}
|
707 |
+
]
|
708 |
+
});
|
709 |
+
|
710 |
+
// Модифицированная функция
|
711 |
+
function showCalculationStatus(response) {
|
712 |
+
if (Object.keys(response.deficits || {}).length === 0) {
|
713 |
+
notyf.success('Расчёт успешен! Все элементы сбалансированы');
|
714 |
+
} else {
|
715 |
+
notyf.error('Дефициты: ' +
|
716 |
+
Object.entries(response.deficits)
|
717 |
+
.map(([el, val]) => `${el}: ${val.toFixed(2)} ppm`)
|
718 |
+
.join(', '));
|
719 |
+
}
|
720 |
+
}
|
721 |
+
</script>
|
722 |
</script>
|
723 |
|
724 |
|