Separate bot filter settings
This commit is contained in:
+10
-4
@@ -183,8 +183,6 @@
|
|||||||
<fieldset class="effect-settings presence-settings">
|
<fieldset class="effect-settings presence-settings">
|
||||||
<legend>Signalizace navstevniku</legend>
|
<legend>Signalizace navstevniku</legend>
|
||||||
<p class="ai-help">Zelena znamena aktivni. Po necinosti se prepne na oranzovou a po dalsim limitu na sedou.</p>
|
<p class="ai-help">Zelena znamena aktivni. Po necinosti se prepne na oranzovou a po dalsim limitu na sedou.</p>
|
||||||
<label class="setting-switch full-row">Skryt boty <input id="hideBotsToggle" type="checkbox"></label>
|
|
||||||
<label class="setting-switch full-row">Hromadny bot filtr <input id="clusterBotFilterEnabled" type="checkbox"></label>
|
|
||||||
<div class="settings-top-row">
|
<div class="settings-top-row">
|
||||||
<label>Zelena do
|
<label>Zelena do
|
||||||
<span class="seconds-field"><input id="presenceActiveSeconds" type="number" min="10" max="3600" step="5"><span>s</span></span>
|
<span class="seconds-field"><input id="presenceActiveSeconds" type="number" min="10" max="3600" step="5"><span>s</span></span>
|
||||||
@@ -193,6 +191,14 @@
|
|||||||
<span class="seconds-field"><input id="presenceOfflineSeconds" type="number" min="20" max="7200" step="5"><span>s</span></span>
|
<span class="seconds-field"><input id="presenceOfflineSeconds" type="number" min="20" max="7200" step="5"><span>s</span></span>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
<small id="presenceStatus" class="full-row">Oranzova je cas mezi zelenou a sedou.</small>
|
||||||
|
<button id="savePresenceSettings" class="full-row" type="button">Ulozit signalizaci</button>
|
||||||
|
</fieldset>
|
||||||
|
<fieldset class="effect-settings bot-filter-settings">
|
||||||
|
<legend>Bot filtr</legend>
|
||||||
|
<p class="ai-help">Filtr skryje roboticke navstevy jen v BO panelu. Web ani chat zakaznikum neblokuje.</p>
|
||||||
|
<label class="setting-switch full-row">Skryt boty <input id="hideBotsToggle" type="checkbox"></label>
|
||||||
|
<label class="setting-switch full-row">Hromadny bot filtr <input id="clusterBotFilterEnabled" type="checkbox"></label>
|
||||||
<div class="settings-top-row">
|
<div class="settings-top-row">
|
||||||
<label>Pocet navstev
|
<label>Pocet navstev
|
||||||
<input id="clusterBotCount" type="number" min="3" max="500" step="1">
|
<input id="clusterBotCount" type="number" min="3" max="500" step="1">
|
||||||
@@ -201,8 +207,8 @@
|
|||||||
<span class="seconds-field"><input id="clusterBotWindowSeconds" type="number" min="10" max="3600" step="10"><span>s</span></span>
|
<span class="seconds-field"><input id="clusterBotWindowSeconds" type="number" min="10" max="3600" step="10"><span>s</span></span>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<small id="presenceStatus" class="full-row">Oranzova je cas mezi zelenou a sedou.</small>
|
<small id="botFilterStatus" class="full-row">Hromadny filtr: stejna IP, zeme, zarizeni a direct vstup.</small>
|
||||||
<button id="savePresenceSettings" class="full-row" type="button">Ulozit signalizaci</button>
|
<button id="saveBotFilterSettings" class="full-row" type="button">Ulozit bot filtr</button>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
<fieldset class="effect-settings sound-settings">
|
<fieldset class="effect-settings sound-settings">
|
||||||
<legend>BO zvuk</legend>
|
<legend>BO zvuk</legend>
|
||||||
|
|||||||
+13
-6
@@ -78,6 +78,7 @@ $("#clusterBotFilterEnabled").addEventListener("change", markPresenceSettingsDir
|
|||||||
$("#clusterBotCount").addEventListener("input", markPresenceSettingsDirty);
|
$("#clusterBotCount").addEventListener("input", markPresenceSettingsDirty);
|
||||||
$("#clusterBotWindowSeconds").addEventListener("input", markPresenceSettingsDirty);
|
$("#clusterBotWindowSeconds").addEventListener("input", markPresenceSettingsDirty);
|
||||||
$("#savePresenceSettings").addEventListener("click", savePresenceSettings);
|
$("#savePresenceSettings").addEventListener("click", savePresenceSettings);
|
||||||
|
$("#saveBotFilterSettings").addEventListener("click", savePresenceSettings);
|
||||||
$("#adminSoundToggle").addEventListener("click", () => {
|
$("#adminSoundToggle").addEventListener("click", () => {
|
||||||
setAdminSoundMuted(!state.soundMuted);
|
setAdminSoundMuted(!state.soundMuted);
|
||||||
});
|
});
|
||||||
@@ -772,12 +773,14 @@ function renderPresenceSettings(settings) {
|
|||||||
$("#clusterBotFilterEnabled").checked = normalized.clusterBotFilterEnabled;
|
$("#clusterBotFilterEnabled").checked = normalized.clusterBotFilterEnabled;
|
||||||
$("#clusterBotCount").value = normalized.clusterBotCount;
|
$("#clusterBotCount").value = normalized.clusterBotCount;
|
||||||
$("#clusterBotWindowSeconds").value = normalized.clusterBotWindowSeconds;
|
$("#clusterBotWindowSeconds").value = normalized.clusterBotWindowSeconds;
|
||||||
setPresenceStatus(presenceStatusText(normalized, "Oranzova"));
|
setPresenceStatus(`Oranzova: ${normalized.activeSeconds}-${normalized.offlineSeconds} s necinosti.`);
|
||||||
|
setBotFilterStatus(botFilterStatusText(normalized));
|
||||||
}
|
}
|
||||||
|
|
||||||
function markPresenceSettingsDirty() {
|
function markPresenceSettingsDirty() {
|
||||||
const normalized = currentPresenceSettingsFromForm();
|
const normalized = currentPresenceSettingsFromForm();
|
||||||
setPresenceStatus(presenceStatusText(normalized, "Neulozeno. Oranzova"));
|
setPresenceStatus(`Neulozeno. Oranzova bude ${normalized.activeSeconds}-${normalized.offlineSeconds} s.`);
|
||||||
|
setBotFilterStatus(`Neulozeno. ${botFilterStatusText(normalized)}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function savePresenceSettings() {
|
async function savePresenceSettings() {
|
||||||
@@ -790,7 +793,8 @@ async function savePresenceSettings() {
|
|||||||
renderPresenceSettings(state.site.settings.adminPresence || normalized);
|
renderPresenceSettings(state.site.settings.adminPresence || normalized);
|
||||||
state.visitorRenderKey = "";
|
state.visitorRenderKey = "";
|
||||||
await Promise.all([loadConversations(), loadVisitors()]);
|
await Promise.all([loadConversations(), loadVisitors()]);
|
||||||
setPresenceStatus(presenceStatusText(normalized, "Ulozeno. Oranzova"));
|
setPresenceStatus(`Ulozeno. Oranzova: ${normalized.activeSeconds}-${normalized.offlineSeconds} s necinosti.`);
|
||||||
|
setBotFilterStatus(`Ulozeno. ${botFilterStatusText(normalized)}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
function normalizePresenceSettings(value = {}) {
|
function normalizePresenceSettings(value = {}) {
|
||||||
@@ -815,11 +819,10 @@ function currentPresenceSettingsFromForm() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function presenceStatusText(settings, prefix) {
|
function botFilterStatusText(settings) {
|
||||||
const cluster = settings.clusterBotFilterEnabled
|
return settings.clusterBotFilterEnabled
|
||||||
? `Hromadny filtr: ${settings.clusterBotCount} navstev / ${settings.clusterBotWindowSeconds} s.`
|
? `Hromadny filtr: ${settings.clusterBotCount} navstev / ${settings.clusterBotWindowSeconds} s.`
|
||||||
: "Hromadny filtr vypnuty.";
|
: "Hromadny filtr vypnuty.";
|
||||||
return `${prefix}: ${settings.activeSeconds}-${settings.offlineSeconds} s necinosti.${cluster}`;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function clampNumber(value, min, max, fallback) {
|
function clampNumber(value, min, max, fallback) {
|
||||||
@@ -832,6 +835,10 @@ function setPresenceStatus(message) {
|
|||||||
$("#presenceStatus").textContent = message;
|
$("#presenceStatus").textContent = message;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setBotFilterStatus(message) {
|
||||||
|
$("#botFilterStatus").textContent = message;
|
||||||
|
}
|
||||||
|
|
||||||
function renderTelegramSettings(settings) {
|
function renderTelegramSettings(settings) {
|
||||||
$("#telegramEnabled").checked = Boolean(settings.enabled);
|
$("#telegramEnabled").checked = Boolean(settings.enabled);
|
||||||
$("#telegramOperatorName").value = settings.operatorName || "Alex";
|
$("#telegramOperatorName").value = settings.operatorName || "Alex";
|
||||||
|
|||||||
Reference in New Issue
Block a user