Fix popup embed

This commit is contained in:
Ben Goldsworthy 2022-11-28 15:05:41 -06:00
parent 008c08e6cf
commit 672a440593

View file

@ -91,15 +91,23 @@
@php $popupContent = null; @endphp
@if(preg_match("/\[\[([^\]]+)\]\]/", $checkin->note, $filepath))
@if(preg_match("/\.webm/", $filepath[1]))
@php $popupContent = `<video controls>
<source src="/{{ $filepath[1] }}" type="video/webm">
<p>Your browser doesn't support HTML video. Here is a <a href="/{{ $filepath[1] }}">link to the video</a> instead.</p>
</video>`; @endphp
@php
$popupContent = '<video controls><source src="/';
$popupContent .= $filepath[1];
$popupContent .= '" type="video/webm">';
$popupContent .= '<p>Your browser doesn\'t support HTML video. Here is a <a href="/';
$popupContent .= $filepath[1];
$popupContent .= '">link to the video</a> instead.</p></video>';
@endphp
@elseif(preg_match("/\.ogg/", $filepath[1]))
@php $popupContent = `<audio controls>
<source src="/{{ $filepath[1] }}" type="audio/off">
<p>Download <a href="/{{ $filepath[1] }}">OGG</a> audio.</p>
</audio>`; @endphp
@php
$popupContent = '<audio controls><source src="/';
$popupContent .= $filepath[1];
$popupContent .= '" type="audio/ogg">';
$popupContent .= '<p>Download <a href="/';
$popupContent .= $filepath[1];
$popupContent .= '">OGG</a> audio.</p></audio>';
@endphp
@endif
@else
@php $popupContent ='<p class="popup__note">' . $checkin->note . '</p>'; @endphp