From 80bd1c1308ad63d1348fca78c51ab3220e080cb8 Mon Sep 17 00:00:00 2001
From: Jan-Hendrik Willms <tleilax+studip@gmail.com>
Date: Mon, 30 Sep 2024 09:16:38 +0000
Subject: [PATCH] remove remains of flash player, fixes #4643

Closes #4643

Merge request studip/studip!3463
---
 .../assets/javascripts/bootstrap/opengraph.js |  6 -----
 .../assets/stylesheets/scss/opengraph.scss    | 23 ----------------
 templates/shared/opengraphinfo_wide.php       | 27 +++++--------------
 3 files changed, 7 insertions(+), 49 deletions(-)

diff --git a/resources/assets/javascripts/bootstrap/opengraph.js b/resources/assets/javascripts/bootstrap/opengraph.js
index 9b4ce3caa10..a72e2c231b9 100644
--- a/resources/assets/javascripts/bootstrap/opengraph.js
+++ b/resources/assets/javascripts/bootstrap/opengraph.js
@@ -45,11 +45,5 @@ $(document).on('click', '.opengraph-area .switcher button', function (event) {
         buttons.right.attr('disabled', current.next('.opengraph').length === 0);
     }
 
-    event.preventDefault();
-}).on('click', '.opengraph a.flash-embedder', function (event) {
-    let url = $(this).attr('href');
-    let template = _.template('<iframe width="100%" height="200px" frameborder="0" src="<%= url %>" allowfullscreen></iframe>');
-    $(this).replaceWith(template({ url: url }));
-
     event.preventDefault();
 });
diff --git a/resources/assets/stylesheets/scss/opengraph.scss b/resources/assets/stylesheets/scss/opengraph.scss
index 2e529df86ba..727f6dac524 100644
--- a/resources/assets/stylesheets/scss/opengraph.scss
+++ b/resources/assets/stylesheets/scss/opengraph.scss
@@ -62,29 +62,6 @@
     padding: $padding;
     min-height: $height;
 
-    .flash-embedder {
-        display: flex;
-        justify-content: center;
-        align-items: center;
-        width: 100%;
-        height: 100px;
-        background-position: center center;
-        background-repeat: no-repeat;
-        background-size: 100% auto;
-        .play {
-            border-radius: 100px;
-            transition: background-color var(--transition-duration);
-            background-color: rgba(0, 0, 0, 0.7);
-            padding: 10px;
-        }
-        &:hover .play {
-            background-color: rgba(0, 0, 0, 1);
-        }
-    }
-    .video .flash-embedder {
-        height: 200px;
-    }
-
     a.info {
         box-sizing: border-box;
         color: var(--black);
diff --git a/templates/shared/opengraphinfo_wide.php b/templates/shared/opengraphinfo_wide.php
index 44ce918a7c2..0637232808e 100644
--- a/templates/shared/opengraphinfo_wide.php
+++ b/templates/shared/opengraphinfo_wide.php
@@ -1,4 +1,9 @@
 <?php
+/**
+ * @var OpenGraphURL $og
+ */
+?>
+<?php
 $videofiles = $og->getVideoFiles();
 $audiofiles = $og->getAudioFiles();
 $og['image'] = filter_var($og['image'], FILTER_VALIDATE_URL) ? $og['image'] : '';
@@ -32,38 +37,20 @@ if (Config::get()->LOAD_EXTERNAL_MEDIA === "proxy" && Seminar_Session::is_curren
     </a>
 <? if (count($videofiles)) : ?>
     <div class="video">
-    <? if (in_array($videofiles[0][1], ["text/html", "application/x-shockwave-flash"])) : ?>
-        <a href="<?= htmlReady($videofiles[0][0]) ?>"
-           class="flash-embedder"
-           style="background-image: url('<?= htmlReady($media_url_func($og['image'])) ?>');"
-           title="<?= _("Video abspielen") ?>">
-            <?= Icon::create('play', 'clickable')->asImg(80, ["class" => "play"])?>
-        </a>
-    <? else : ?>
         <video width="100%" height="200px" controls>
         <? foreach ($videofiles as $file) : ?>
-            <source src="<?= htmlReady($media_url_func($file[0])) ?>"<?= $file[1] ? ' type="'.htmlReady($file[1]).'"' : "" ?>></source>
+            <source src="<?= htmlReady($media_url_func($file[0])) ?>"<?= $file[1] ? ' type="'.htmlReady($file[1]).'"' : "" ?>>
         <? endforeach ?>
         </video>
-    <? endif ?>
     </div>
 <? endif ?>
 <? if (count($audiofiles)) : ?>
     <div class="audio">
-    <? if (in_array($audiofiles[0][1], ["text/html", "application/x-shockwave-flash"])) : ?>
-        <a href="<?= htmlReady($audiofiles[0][0]) ?>"
-           class="flash-embedder"
-           style="background-image: url('<?= htmlReady($media_url_func($og['image'])) ?>');"
-           title="<?= _("Audio abspielen") ?>">
-            <?= Icon::create('play', 'clickable')->asImg(100)?>
-        </a>
-    <? else : ?>
         <audio width="100%" height="50px" controls>
         <? foreach ($audiofiles as $file) : ?>
-            <source src="<?= htmlReady($media_url_func($file[0])) ?>"<?= $file[1] ? ' type="'.htmlReady($file[1]).'"' : "" ?>></source>
+            <source src="<?= htmlReady($media_url_func($file[0])) ?>"<?= $file[1] ? ' type="'.htmlReady($file[1]).'"' : "" ?>>
         <? endforeach ?>
         </audio>
-    <? endif ?>
     </div>
 <? endif ?>
 </div>
-- 
GitLab