diff --git a/motorradig/src/helpers.php b/motorradig/src/helpers.php index a4b18da..2953c4c 100644 --- a/motorradig/src/helpers.php +++ b/motorradig/src/helpers.php @@ -579,18 +579,34 @@ function validate(array $rules): array /** * Erzeugt einen datenschutzfreundlichen Platzhalter für externe Inhalte. - * Der eigentliche iframe wird erst nach einem Klick (und nur mit Freigabe - * für externe Inhalte) von public/js/privacy.js eingefügt. + * + * Liegt eine Freigabe für externe Inhalte vor und ist das automatische Laden + * erlaubt (Standard bei Karten), wird der iframe direkt ausgegeben. Sonst + * erscheint ein Platzhalter, den public/js/privacy.js erst nach einem Klick + * durch den iframe ersetzt. */ -function privacy_embed(string $src, string $title, string $description = '', string $kind = 'external'): string +function privacy_embed(string $src, string $title, string $description = '', string $kind = 'external', ?bool $autoLoad = null): string { $kind = preg_replace('/[^a-z0-9-]/', '', strtolower($kind)) ?: 'external'; $allowed = \App\Core\Privacy::externalMediaAllowed(); + $autoLoad ??= $kind === 'map'; if ($description === '') { $description = 'Dieser Inhalt wird von einem externen Anbieter geladen.'; } + if ($allowed && $autoLoad) { + $allow = $kind === 'video' + ? ' allow="accelerometer; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"' + : ''; + + return '
' + . '' + . '
'; + } + $action = $allowed ? '' : 'Externe Inhalte erlauben'; @@ -655,7 +671,7 @@ function privacy_filter_embeds(string $html): string } elseif (preg_match('#google\.[a-z.]+/maps#i', $src)) { $kind = 'map'; $title = $title !== 'Externer Inhalt' ? $title : 'Google Maps'; - $description = 'Die Karte wird erst nach deinem Klick von Google geladen.'; + $description = 'Die Karte wird erst nach deiner Freigabe für externe Inhalte von Google geladen.'; } return privacy_embed($src, $title, $description, $kind); diff --git a/motorradig/views/activities.php b/motorradig/views/activities.php index afc80cd..145f8b9 100644 --- a/motorradig/views/activities.php +++ b/motorradig/views/activities.php @@ -24,7 +24,7 @@

diff --git a/motorradig/views/partials/privacy_consent_modal.php b/motorradig/views/partials/privacy_consent_modal.php index bfcae76..4236edb 100644 --- a/motorradig/views/partials/privacy_consent_modal.php +++ b/motorradig/views/partials/privacy_consent_modal.php @@ -18,7 +18,7 @@

diff --git a/motorradig/views/privacy.php b/motorradig/views/privacy.php index 53cbc6c..40be6e9 100644 --- a/motorradig/views/privacy.php +++ b/motorradig/views/privacy.php @@ -46,7 +46,11 @@

Externe Inhalte: . - Google Maps und YouTube werden in jedem Fall erst nach einem Klick geladen. + + Google Maps wird direkt geladen, YouTube-Videos erst nach einem Klick. + + Google Maps und YouTube bleiben blockiert, bis du sie hier freigibst. +