pretix_whitelabel/signals.py hinzugefügt

This commit is contained in:
tino committed 2026-11-06 18:19:47 +01:00
1 parent 8134c5daf8
commit d3d31a1689
1 file changed
+134
+134
View File
@@ -0,0 +1,134 @@
from django.dispatch import receiver
from django.templatetags.static import static
from django.utils.safestring import mark_safe
from pretix.control.signals import html_head as control_html_head
from pretix.presale.signals import html_head as presale_html_head
FALKENTHAL_INJECTION = """
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700&family=Space+Grotesk:wght@500;600;700&display=swap" rel="stylesheet">
<link rel="icon" type="image/svg+xml" href="/favicon.svg">
<link rel="stylesheet" type="text/css" href="{css_url}?v=1.8.1">
<style>
/* Veranstalter-Badge im Footer */
.falkenthal-organizer-badge {{
display: inline-block;
font-family: 'Space Grotesk', monospace;
font-size: 11px;
text-transform: uppercase;
letter-spacing: 0.08em;
color: #00d2ff;
background: rgba(0, 210, 255, 0.08);
border: 1px solid rgba(0, 210, 255, 0.2);
border-radius: 4px;
padding: 1px 6px;
margin-right: 6px;
vertical-align: middle;
}}
/* Untere Plattform-Leiste (System-Ebene) */
.falkenthal-platform-bar {{
margin-top: 14px;
padding: 12px 16px;
border-top: 1px solid rgba(0, 210, 255, 0.12);
text-align: center;
font-family: 'Plus Jakarta Sans', sans-serif;
font-size: 12px;
color: #64748b;
line-height: 1.6;
width: 100%;
}}
.falkenthal-platform-bar .ft-brand {{
font-family: 'Space Grotesk', sans-serif;
color: #94a3b8;
font-weight: 600;
letter-spacing: 0.04em;
}}
.falkenthal-platform-bar a {{
color: #94a3b8 !important;
text-decoration: none !important;
transition: color 0.2s ease, text-shadow 0.2s ease;
font-weight: 500;
}}
.falkenthal-platform-bar a:hover {{
color: #00d2ff !important;
text-shadow: 0 0 10px rgba(0, 210, 255, 0.4);
}}
.falkenthal-platform-bar .ft-sep {{
margin: 0 6px;
color: #334155;
}}
</style>
<script>
document.addEventListener("DOMContentLoaded", function() {{
// 1. Vorherige Leisten bereinigen
document.querySelectorAll('.falkenthal-platform-bar').forEach(function(el) {{
el.remove();
}});
var footer = document.querySelector('footer, .footer, #footer');
if (!footer) {{
footer = document.querySelector('body');
}}
if (footer) {{
// 2. Entferne unerwünschte Standard-AGPL-/Pretix-Texte im Footer
footer.querySelectorAll('*').forEach(function(el) {{
if (el.children.length === 0 && (el.textContent.includes('basierend auf pretix') || el.textContent.includes('Theme-Plugin') || el.textContent.includes('Quellcode'))) {{
// Wenn das Element nur dieser Text ist, ausblenden
var p = el.closest('p') || el.closest('li') || el;
if (p !== footer) p.style.display = 'none';
}}
}));
// 3. Veranstalter-Badge bei echten Veranstalter-Links einfügen
var orgLinks = Array.from(footer.querySelectorAll('a')).filter(function(a) {{
return a.offsetParent !== null &&
!a.href.includes('agpl_source') &&
!a.href.includes('pretix.eu') &&
!a.href.includes('falkenthal.me');
}});
if (orgLinks.length > 0 && !footer.querySelector('.falkenthal-organizer-badge')) {{
var badge = document.createElement('span');
badge.className = 'falkenthal-organizer-badge';
badge.textContent = 'Veranstalter';
orgLinks[0].parentNode.insertBefore(badge, orgLinks[0]);
}}
// 4. Saubere Plattform-Leiste anhängen
var bar = document.createElement('div');
bar.className = 'falkenthal-platform-bar';
bar.innerHTML =
'<span>Technischer Plattformbetrieb: <strong class="ft-brand">FALKENTHAL</strong></span>' +
'<span class="ft-sep">·</span>' +
'<a href="https://tickets.falkenthal.me/impressum" target="_blank" rel="noopener">Plattform-Impressum</a>' +
'<span class="ft-sep">·</span>' +
'<a href="https://tickets.falkenthal.me/datenschutz" target="_blank" rel="noopener">Plattform-Datenschutz</a>' +
'<span class="ft-sep">·</span>' +
'<a href="https://tickets.falkenthal.me/agpl_source">Quellcode (AGPLv3)</a>';
footer.appendChild(bar);
}}
}});
</script>
"""
@receiver(presale_html_head, dispatch_uid="falkenthal_presale_html_head")
def html_head_presale(sender, request=None, **kwargs):
css_url = static("pretix_whitelabel/custom.css")
return mark_safe(FALKENTHAL_INJECTION.format(css_url=css_url))
@receiver(control_html_head, dispatch_uid="falkenthal_control_html_head")
def html_head_control(sender, request=None, **kwargs):
css_url = static("pretix_whitelabel/custom.css")
return mark_safe(FALKENTHAL_INJECTION.format(css_url=css_url))