- Audit log: every admin_log entry is also stored permanently in the database (admin/audit.php, audit.view) - Rate limits per account, login throttling per IP (not per account), emergency lock after mass deletions, force logout / lock in user management - Comments under gallery pictures (picture page, report button, owner can disable them) - Moderation: new members, links, reported content and a "moderate everything" switch go to the approval list (moderation.php) - Every uploaded image is re-encoded (strips appended code and EXIF data) - Custom 404 page, also shown for pages without permission Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
86 lines
3.4 KiB
JavaScript
86 lines
3.4 KiB
JavaScript
/**
|
||
* Einfache Grossansicht fuer Bilder: Links mit data-lightbox="gruppe" oeffnen das Bild in
|
||
* einem Overlay, mit Pfeilen / Wischen durch die Bilder derselben Gruppe blaettern.
|
||
*/
|
||
(function () {
|
||
'use strict';
|
||
|
||
var links = Array.prototype.slice.call(document.querySelectorAll('a[data-lightbox]'));
|
||
if (!links.length) return;
|
||
|
||
var overlay = document.createElement('div');
|
||
overlay.className = 'lightbox';
|
||
overlay.hidden = true;
|
||
overlay.innerHTML =
|
||
'<button type="button" class="lightbox-close" aria-label="Schließen">✕</button>' +
|
||
'<button type="button" class="lightbox-prev" aria-label="Vorheriges Bild">‹</button>' +
|
||
'<figure><img alt=""><figcaption></figcaption></figure>' +
|
||
'<button type="button" class="lightbox-next" aria-label="Nächstes Bild">›</button>';
|
||
document.body.appendChild(overlay);
|
||
|
||
var img = overlay.querySelector('img');
|
||
var caption = overlay.querySelector('figcaption');
|
||
var group = [];
|
||
var index = 0;
|
||
var touchX = null;
|
||
|
||
function show(i) {
|
||
index = (i + group.length) % group.length;
|
||
var link = group[index];
|
||
img.src = link.href;
|
||
img.alt = link.dataset.caption || '';
|
||
caption.textContent = link.dataset.caption || '';
|
||
// Galeriebilder mit Kommentaren: Link zur Bildseite
|
||
if (link.dataset.commentsUrl) {
|
||
var count = parseInt(link.dataset.commentsCount || '0', 10);
|
||
var comments = document.createElement('a');
|
||
comments.className = 'lightbox-comments';
|
||
comments.href = link.dataset.commentsUrl;
|
||
comments.textContent = count > 0 ? '💬 ' + count + (count === 1 ? ' Kommentar' : ' Kommentare') : '💬 Kommentieren';
|
||
caption.appendChild(comments);
|
||
}
|
||
overlay.querySelector('.lightbox-prev').hidden = group.length < 2;
|
||
overlay.querySelector('.lightbox-next').hidden = group.length < 2;
|
||
}
|
||
|
||
function open(link) {
|
||
group = links.filter(function (l) { return l.dataset.lightbox === link.dataset.lightbox; });
|
||
overlay.hidden = false;
|
||
document.body.style.overflow = 'hidden';
|
||
show(group.indexOf(link));
|
||
}
|
||
|
||
function close() {
|
||
overlay.hidden = true;
|
||
document.body.style.overflow = '';
|
||
img.src = '';
|
||
}
|
||
|
||
links.forEach(function (link) {
|
||
link.addEventListener('click', function (e) {
|
||
e.preventDefault();
|
||
open(link);
|
||
});
|
||
});
|
||
|
||
overlay.addEventListener('click', function (e) {
|
||
if (e.target === overlay || e.target.classList.contains('lightbox-close')) close();
|
||
else if (e.target.classList.contains('lightbox-prev')) show(index - 1);
|
||
else if (e.target.classList.contains('lightbox-next')) show(index + 1);
|
||
});
|
||
|
||
document.addEventListener('keydown', function (e) {
|
||
if (overlay.hidden) return;
|
||
if (e.key === 'Escape') close();
|
||
else if (e.key === 'ArrowLeft') show(index - 1);
|
||
else if (e.key === 'ArrowRight') show(index + 1);
|
||
});
|
||
|
||
overlay.addEventListener('touchstart', function (e) { touchX = e.touches[0].clientX; }, { passive: true });
|
||
overlay.addEventListener('touchend', function (e) {
|
||
if (touchX === null || group.length < 2) return;
|
||
var dx = e.changedTouches[0].clientX - touchX;
|
||
if (Math.abs(dx) > 50) show(index + (dx < 0 ? 1 : -1));
|
||
touchX = null;
|
||
});
|
||
})();
|