- Raids: "Max. Spieler" only whole numbers up to groups x 5 (max. 10 groups / 50), gearscore only a number; fixed +1 Lumipunkt per participation, other values only with the new raids.points permission; pick an existing premade per group when creating a raid; unchanged legacy values no longer block editing - Raid page updates itself every 15 s while visible (raids_live.php, cards rendered by includes/raid_card.php), open editors and confirm dialogs are kept - Restore takes the new raid_id from the bot (archived messages are now deleted in Discord) and moves settings, attendance and awards; website signups send the server display name - Premades: dissolve by leadership needs a reason, lead gets DMs on join/assign/decline/remove (source/actor_id sent to the bot), transfer picker skips players who already lead a group, website accept keeps the one-group rule, no commas in names - Site-wide Lumina dialog (assets/js/confirm-dialog.js) replaces confirm/prompt/alert via data-confirm; error flashes are a dialog you confirm with OK - Calendar: audience per entry (all / leadership takes part / internal) with the new calendar.leadership permission; day cells list all entries and scroll - Gear planner: main-hand picker filtered by the set's class, mismatches marked, "keine Klasse" option, link to an external skill/Daevanion plan per set - Map: correct kisk icons (Elyos on Verteron/Abyss, Altgard fixed), per-map max zoom and bounded panning, German texts, data source note - Tactics: toolbar as a uniform grid, whole-tactic copy, automatic versions with restore and a 90-day trash, official tactics protected - Global thin gold scrollbars, readable hover colours, "Sedes Luminis" spelling, patch notes and README, schema version 34 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
97 lines
4.3 KiB
JavaScript
97 lines
4.3 KiB
JavaScript
/**
|
|
* Aktivitaetscheck anlegen: Formular ein-/ausblenden und Live-Vorschau, wie die Nachricht im
|
|
* Discord aussehen wird (Farbe, Titel, Text, Bild, Knoepfe, Frist).
|
|
*/
|
|
(function () {
|
|
'use strict';
|
|
|
|
var panel = document.getElementById('activity-create');
|
|
var form = document.getElementById('activity-form');
|
|
if (!panel || !form) return;
|
|
|
|
document.querySelectorAll('[data-toggle-activity-form]').forEach(function (button) {
|
|
button.addEventListener('click', function () {
|
|
panel.hidden = !panel.hidden;
|
|
if (!panel.hidden) {
|
|
panel.scrollIntoView({ behavior: 'smooth', block: 'start' });
|
|
f.title.focus();
|
|
}
|
|
});
|
|
});
|
|
|
|
var f = form.elements; // form.title waere das title-Attribut des Formulars, nicht das Feld
|
|
var dmToggle = form.querySelector('[data-toggle-dm]');
|
|
var dmField = form.querySelector('.activity-dm');
|
|
dmToggle.addEventListener('change', function () { dmField.hidden = !dmToggle.checked; });
|
|
|
|
function out(name) { return form.querySelector('[data-out="' + name + '"]'); }
|
|
|
|
// Discord-Formatierung grob nachbilden: **fett**, *kursiv*, Zeilenumbrueche (Text sicher als Text)
|
|
function discordText(text) {
|
|
var div = document.createElement('div');
|
|
div.textContent = text;
|
|
return div.innerHTML
|
|
.replace(/\*\*(.+?)\*\*/g, '<strong>$1</strong>')
|
|
.replace(/(^|[^*])\*([^*\n]+)\*/g, '$1<em>$2</em>')
|
|
.replace(/\n/g, '<br>');
|
|
}
|
|
|
|
function color() {
|
|
var custom = f.color_custom.value;
|
|
var picked = form.querySelector('input[name="color"]:checked');
|
|
return custom && custom.toLowerCase() !== '#206694' ? custom : (picked ? picked.value : '#206694');
|
|
}
|
|
|
|
function update() {
|
|
out('title').textContent = f.title.value || 'Aktivitätscheck';
|
|
out('message').innerHTML = discordText(f.message.value);
|
|
out('embed').style.borderLeftColor = color();
|
|
|
|
var role = f.target_role_id.options[f.target_role_id.selectedIndex];
|
|
out('role').textContent = role && role.value ? role.textContent.replace(/^@/, '') : 'Rolle';
|
|
out('ping').hidden = !f.ping_role.checked;
|
|
|
|
out('yes').textContent = f.yes_label.value.trim() || 'Ich bin da';
|
|
out('no').textContent = f.no_label.value.trim() || 'Ich bin nicht da';
|
|
|
|
var value = Math.max(1, parseInt(f.duration_value.value, 10) || 1);
|
|
var ms = value * (f.duration_unit.value === 'hours' ? 3600e3 : 86400e3);
|
|
var end = new Date(Date.now() + ms);
|
|
out('deadline').textContent = end.toLocaleString('de-DE', { weekday: 'long', day: '2-digit', month: 'long', hour: '2-digit', minute: '2-digit' })
|
|
+ ' (in ' + value + (f.duration_unit.value === 'hours' ? (value === 1 ? ' Stunde' : ' Stunden') : (value === 1 ? ' Tag' : ' Tagen')) + ')';
|
|
|
|
var image = f.image_url.value.trim();
|
|
var img = out('image');
|
|
if (/^https:\/\/\S+$/.test(image)) {
|
|
img.src = image;
|
|
img.hidden = false;
|
|
} else {
|
|
img.hidden = true;
|
|
}
|
|
}
|
|
|
|
form.addEventListener('input', update);
|
|
form.addEventListener('change', update);
|
|
// Eigene Farbe gewaehlt -> Auswahlkreise abwaehlen, Kreis gewaehlt -> eigene Farbe zuruecksetzen
|
|
f.color_custom.addEventListener('input', function () {
|
|
form.querySelectorAll('input[name="color"]').forEach(function (r) { r.checked = false; });
|
|
});
|
|
form.querySelectorAll('input[name="color"]').forEach(function (radio) {
|
|
radio.addEventListener('change', function () { f.color_custom.value = '#206694'; });
|
|
});
|
|
|
|
// Rueckfrage vor dem Posten (assets/js/confirm-dialog.js liest data-confirm beim Absenden)
|
|
function updateConfirm() {
|
|
var consequences = [];
|
|
if (dmToggle.checked) consequences.push('PN');
|
|
if (f.remove_role_id.value) consequences.push('Rolle entfernen');
|
|
if (f.add_role_id.value) consequences.push('Rolle geben');
|
|
form.setAttribute('data-confirm', 'Folgen ohne Rückmeldung: ' + (consequences.length ? consequences.join(', ') : 'keine (nur Liste im Log-Kanal)'));
|
|
}
|
|
form.setAttribute('data-confirm-title', 'Check jetzt im Discord posten?');
|
|
form.setAttribute('data-confirm-ok', 'Posten');
|
|
form.addEventListener('change', updateConfirm);
|
|
updateConfirm();
|
|
|
|
update();
|
|
})();
|