Календарь: настройки первого дня и времени отображения, кружок сегодня
This commit is contained in:
+19
-2
@@ -1,6 +1,6 @@
|
||||
const DIRTY_FIELDS = ['systemName', 'timezone', 'timeFormat', 'spamInterval', 'footerLeft', 'footerRight', 'aiPrompt', 'aiAutoCheck', 'lessonAiPrompt', 'lessonAiEnabled', 'notesAiEnabled', 'shareShowMessage', 'shareShowDate', 'shareShowNames', 'shareShowPhotos', 'cookieNoticeText', 'photoResolution', 'photoQuality', 'photoEngine', 'camEnabled', 'photoAiFaceMode', 'photoAiFaceModel', 'photoAiDevicePref', 'trashPurgeDays', 'notifyEnabled', 'notifyRetentionDays', 'imgbbUrl', 'imgbbKey', 'facesBrokenScanEnabled', 'facesBrokenScanInterval'];
|
||||
const DIRTY_FIELDS = ['systemName', 'timezone', 'timeFormat', 'calWeekStart', 'calDayStart', 'calDayEnd', 'spamInterval', 'footerLeft', 'footerRight', 'aiPrompt', 'aiAutoCheck', 'lessonAiPrompt', 'lessonAiEnabled', 'notesAiEnabled', 'shareShowMessage', 'shareShowDate', 'shareShowNames', 'shareShowPhotos', 'cookieNoticeText', 'photoResolution', 'photoQuality', 'photoEngine', 'camEnabled', 'photoAiFaceMode', 'photoAiFaceModel', 'photoAiDevicePref', 'trashPurgeDays', 'notifyEnabled', 'notifyRetentionDays', 'imgbbUrl', 'imgbbKey', 'facesBrokenScanEnabled', 'facesBrokenScanInterval'];
|
||||
const NOTIFY_IDS = [];
|
||||
const SECTION_IDS = ['sec-system', 'sec-stack', 'sec-brand', 'sec-datetime', 'sec-antispam', 'sec-share', 'sec-ai', 'sec-lesson-ai', 'sec-notes-ai', 'sec-achievements', 'sec-tls', 'sec-backup', 'sec-trash', 'sec-form', 'sec-notify', 'sec-photo', 'sec-photo-ai', 'sec-external-services', 'sec-bans', 'sec-face-broken'];
|
||||
const SECTION_IDS = ['sec-system', 'sec-stack', 'sec-brand', 'sec-datetime', 'sec-calendar', 'sec-antispam', 'sec-share', 'sec-ai', 'sec-lesson-ai', 'sec-notes-ai', 'sec-achievements', 'sec-tls', 'sec-backup', 'sec-trash', 'sec-form', 'sec-notify', 'sec-photo', 'sec-photo-ai', 'sec-external-services', 'sec-bans', 'sec-face-broken'];
|
||||
const SPAM_MAX = 10080;
|
||||
const BAN_REASONS = {
|
||||
'honeypot': 'Антиспам-поле',
|
||||
@@ -297,6 +297,13 @@ async function loadSettings() {
|
||||
const storedTz = String(s.timezone || '');
|
||||
tzSel.value = Array.from(tzSel.options).some(o => o.value === storedTz) ? storedTz : DateTime.tz;
|
||||
document.getElementById('timeFormat').value = ['24h', '12h'].includes(s.time_format) ? s.time_format : '24h';
|
||||
const calWeekStart = String(s.calendar_week_start ?? '');
|
||||
document.getElementById('calWeekStart').value = /^[0-6]$/.test(calWeekStart) ? calWeekStart : '1';
|
||||
const calTimeRe = /^([01]\d|2[0-3]):[0-5]\d$/;
|
||||
const calStart = String(s.calendar_day_start ?? '');
|
||||
const calEnd = String(s.calendar_day_end ?? '');
|
||||
document.getElementById('calDayStart').value = calTimeRe.test(calStart) ? calStart : '08:00';
|
||||
document.getElementById('calDayEnd').value = calTimeRe.test(calEnd) ? calEnd : '21:00';
|
||||
renderTimePreview();
|
||||
document.getElementById('footerLeft').value = s.footer_left || '';
|
||||
document.getElementById('footerRight').value = s.footer_right || '';
|
||||
@@ -914,6 +921,13 @@ async function saveSettings() {
|
||||
showError('Проверьте поле «Хранение уведомлений» (от 1 до 365 дней)');
|
||||
return;
|
||||
}
|
||||
const calStart = document.getElementById('calDayStart').value;
|
||||
const calEnd = document.getElementById('calDayEnd').value;
|
||||
const calTimeRe = /^([01]\d|2[0-3]):[0-5]\d$/;
|
||||
if (!calTimeRe.test(calStart) || !calTimeRe.test(calEnd) || calStart >= calEnd) {
|
||||
showError('Проверьте время отображения календаря: начало должно быть раньше окончания');
|
||||
return;
|
||||
}
|
||||
const fbInterval = document.getElementById('facesBrokenScanInterval').value;
|
||||
const fbIntervalHours = Math.round(Number(fbInterval));
|
||||
if (fbInterval === '' || !Number.isFinite(fbIntervalHours) || fbIntervalHours < 1 || fbIntervalHours > 168) {
|
||||
@@ -931,6 +945,9 @@ async function saveSettings() {
|
||||
system_name: document.getElementById('systemName').value.trim(),
|
||||
timezone: document.getElementById('timezone').value,
|
||||
time_format: document.getElementById('timeFormat').value,
|
||||
calendar_week_start: document.getElementById('calWeekStart').value,
|
||||
calendar_day_start: calStart,
|
||||
calendar_day_end: calEnd,
|
||||
spam_interval_min: String(Math.round(Number(v))),
|
||||
footer_left: document.getElementById('footerLeft').value.trim(),
|
||||
footer_right: document.getElementById('footerRight').value.trim(),
|
||||
|
||||
Reference in New Issue
Block a user