added new functions for random sounds
This commit is contained in:
@@ -144,6 +144,14 @@
|
||||
<label class="form-label">Startverzögerung max (Minuten)</label>
|
||||
<input id="auto-delay-max" type="number" class="form-control" value="12" min="0" max="120">
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<label class="form-label">Max Wiederholungen pro Stunde</label>
|
||||
<input id="auto-limit-ph" type="number" class="form-control" value="2" min="1" max="50">
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<label class="form-label">Limit-Fenster (Minuten)</label>
|
||||
<input id="auto-window-min" type="number" class="form-control" value="60" min="1" max="240">
|
||||
</div>
|
||||
</div>
|
||||
<div class="mt-3 d-flex gap-2 align-items-center">
|
||||
<button id="auto-start" class="btn btn-success" ${!randBtn.disabled ? '' : 'disabled'}>Auto-Start</button>
|
||||
@@ -161,11 +169,17 @@
|
||||
const imax = Math.max(imin, parseInt(document.getElementById('auto-interval-max').value, 10) || 10);
|
||||
const dmin = Math.max(0, parseInt(document.getElementById('auto-delay-min').value, 10) || 3);
|
||||
const dmax = Math.max(dmin, parseInt(document.getElementById('auto-delay-max').value, 10) || 12);
|
||||
const limitPh = Math.max(1, parseInt(document.getElementById('auto-limit-ph').value, 10) || 2);
|
||||
const windowMin = Math.max(1, parseInt(document.getElementById('auto-window-min').value, 10) || 60);
|
||||
|
||||
const res = await fetch('/api/soundboard/auto_start', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ interval_min: imin, interval_max: imax, delay_min: dmin, delay_max: dmax })
|
||||
body: JSON.stringify({
|
||||
interval_min: imin, interval_max: imax,
|
||||
delay_min: dmin, delay_max: dmax,
|
||||
limit_per_hour: limitPh, window_minutes: windowMin
|
||||
})
|
||||
});
|
||||
const data = await res.json();
|
||||
if (data.success) {
|
||||
@@ -212,6 +226,8 @@
|
||||
if (data.interval_max) document.getElementById('auto-interval-max').value = data.interval_max;
|
||||
if (data.delay_min !== undefined && data.delay_min !== null) document.getElementById('auto-delay-min').value = data.delay_min;
|
||||
if (data.delay_max !== undefined && data.delay_max !== null) document.getElementById('auto-delay-max').value = data.delay_max;
|
||||
if (data.limit_per_hour !== undefined && data.limit_per_hour !== null) document.getElementById('auto-limit-ph').value = data.limit_per_hour;
|
||||
if (data.window_minutes !== undefined && data.window_minutes !== null) document.getElementById('auto-window-min').value = data.window_minutes;
|
||||
} else {
|
||||
status.textContent = 'Aus';
|
||||
start.disabled = false;
|
||||
|
||||
Reference in New Issue
Block a user