-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdonation.html
More file actions
195 lines (169 loc) · 7.35 KB
/
donation.html
File metadata and controls
195 lines (169 loc) · 7.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
<!doctype html>
<html lang="de">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Unterstützung – FPP Weihnachtssteuerung</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css" integrity="sha512-DTOQO9RWCH3ppGqcWaEA1BIZOC6xxalwEsw9c2QQeAIftl+Vegovlnee1c9QX4TctnWMn13TZye+giMm8e2LwA==" crossorigin="anonymous" referrerpolicy="no-referrer" />
<link rel="stylesheet" href="styles.css">
</head>
<body class="festive subpage">
<div class="scene-decor" aria-hidden="true">
<div class="tree"></div>
<div class="ornament ornament-star star-bright"></div>
<div class="ornament ornament-star star-soft"></div>
<div class="ornament ornament-star star-twinkle"></div>
<div class="snowflake snowflake-main"></div>
<div class="snowflake snowflake-mid"></div>
<div class="snowflake snowflake-small"></div>
</div>
<div class="card">
<header>
<h1 id="headline"></h1>
<p class="subtitle" id="subtitle">Unterstütze die Lichtershow</p>
<p class="campaign-title" id="campaign-name"></p>
</header>
<div class="donation-content">
<p id="donation-text" class="note"></p>
<div class="donation-links" id="donation-links"></div>
<button class="link-like" id="back-home">Zurück zur Startseite</button>
</div>
<footer class="social-footer hidden" id="social-footer">
<h3 class="social-footer-title">Unsere Kanäle:</h3>
<div class="social-icons" id="social-icons"></div>
</footer>
</div>
<script src="config.js"></script>
<script>
const config = window.FPP_CONFIG || {};
const headline = document.getElementById('headline');
const donationText = document.getElementById('donation-text');
const donationLinks = document.getElementById('donation-links');
const subtitle = document.getElementById('subtitle');
const campaignName = document.getElementById('campaign-name');
const backHome = document.getElementById('back-home');
const accessCode = (config.accessCode || '').trim();
const accessKey = 'fpp-access-granted';
if (accessCode && localStorage.getItem(accessKey) !== 'yes') {
window.location.href = '/';
}
const poolId = (config.donationPoolId || '').trim();
const campaignTitle = (config.donationCampaignName || '').trim();
headline.textContent = config.siteName || 'FPP Lichtershow';
subtitle.textContent = config.donationSubtitle || 'Unterstütze die Lichtershow';
campaignName.textContent = campaignTitle || '';
const donationMessage = (config.donationText || '').trim();
if (donationMessage) {
donationText.textContent = donationMessage;
} else {
donationText.remove();
}
if (poolId) {
const link = document.createElement('a');
link.className = 'donation-link';
link.href = `https://www.paypal.com/pool/${poolId}`;
link.target = '_blank';
link.rel = 'noopener noreferrer';
const icon = document.createElement('span');
icon.className = 'paypal-icon';
icon.setAttribute('aria-hidden', 'true');
const label = document.createElement('span');
label.className = 'donation-label';
label.textContent = 'Hier für eine Spende klicken';
link.appendChild(icon);
link.appendChild(label);
donationLinks.appendChild(link);
}
// Buy Me a Coffee Button
const bmcUsername = (config.buyMeACoffeeUsername || '').trim();
// Validate username: only alphanumeric characters, underscores and hyphens allowed
const isValidBmcUsername = bmcUsername && /^[a-zA-Z0-9_-]+$/.test(bmcUsername);
if (isValidBmcUsername) {
const bmcLink = document.createElement('a');
bmcLink.className = 'donation-link bmc-link';
bmcLink.href = `https://buymeacoffee.com/${encodeURIComponent(bmcUsername)}`;
bmcLink.target = '_blank';
bmcLink.rel = 'noopener noreferrer';
const bmcIcon = document.createElement('span');
bmcIcon.className = 'bmc-icon';
bmcIcon.setAttribute('aria-hidden', 'true');
const bmcLabel = document.createElement('span');
bmcLabel.className = 'donation-label';
bmcLabel.textContent = 'Buy me a Coffee';
bmcLink.appendChild(bmcIcon);
bmcLink.appendChild(bmcLabel);
donationLinks.appendChild(bmcLink);
// Add hint text for Buy Me a Coffee
const bmcHint = document.createElement('p');
bmcHint.className = 'bmc-hint note';
bmcHint.textContent = 'Hinweis: Spenden über „Buy me a Coffee" kommen mir persönlich und direkt zugute – sie werden nicht an andere Vereine oder Organisationen weitergeleitet.';
donationLinks.parentNode.insertBefore(bmcHint, donationLinks.nextSibling);
}
if (!poolId && !isValidBmcUsername) {
donationLinks.innerHTML = '<p>Keine Spendenmöglichkeit konfiguriert.</p>';
}
backHome.addEventListener('click', () => {
window.location.href = '/';
});
// Social Media Footer
function renderSocialFooter() {
const socialFooter = document.getElementById('social-footer');
const socialIcons = document.getElementById('social-icons');
const socialLinks = [
{ key: 'socialFacebook', icon: 'fa-brands fa-facebook-f', label: 'Facebook' },
{ key: 'socialInstagram', icon: 'fa-brands fa-instagram', label: 'Instagram' },
{ key: 'socialTiktok', icon: 'fa-brands fa-tiktok', label: 'TikTok' },
{ key: 'socialWhatsapp', icon: 'fa-brands fa-whatsapp', label: 'WhatsApp' },
{ key: 'socialYoutube', icon: 'fa-brands fa-youtube', label: 'YouTube' },
{ key: 'socialWebsite', icon: 'fa-solid fa-globe', label: 'Website' },
{ key: 'socialEmail', icon: 'fa-solid fa-envelope', label: 'E-Mail', isEmail: true }
];
function isValidUrl(url) {
try {
const parsed = new URL(url);
return ['http:', 'https:'].includes(parsed.protocol);
} catch {
return false;
}
}
let hasAny = false;
socialLinks.forEach(({ key, icon, label, isEmail }) => {
const value = (config[key] || '').trim();
if (value) {
if (isEmail) {
hasAny = true;
const link = document.createElement('a');
link.className = 'social-icon';
link.href = `mailto:${value}`;
link.setAttribute('aria-label', label);
link.title = label;
const iconEl = document.createElement('i');
iconEl.className = icon;
iconEl.setAttribute('aria-hidden', 'true');
link.appendChild(iconEl);
socialIcons.appendChild(link);
} else if (isValidUrl(value)) {
hasAny = true;
const link = document.createElement('a');
link.className = 'social-icon';
link.href = value;
link.target = '_blank';
link.rel = 'noopener noreferrer';
link.setAttribute('aria-label', label);
link.title = label;
const iconEl = document.createElement('i');
iconEl.className = icon;
iconEl.setAttribute('aria-hidden', 'true');
link.appendChild(iconEl);
socialIcons.appendChild(link);
}
}
});
if (hasAny) {
socialFooter.classList.remove('hidden');
}
}
renderSocialFooter();
</script>
</body>
</html>