Fix embeds to include note content where both exists
This commit is contained in:
parent
b586687174
commit
802c9398d5
3 changed files with 46 additions and 35 deletions
|
@ -6,22 +6,30 @@
|
|||
<p class="checkin__meta">{!! render_date_difference($checkin->date) !!}</p>
|
||||
</summary>
|
||||
@if($checkin->note)
|
||||
@if(preg_match("/\[\[([^\]]+)\]\]/", $checkin->note, $filepath))
|
||||
@if(preg_match("/\.webm/", $filepath[1]))
|
||||
<video class="popup__video" controls>
|
||||
<source src="{{ url("/videos/$filepath[1]") }}" type="video/webm">
|
||||
<p>Your browser doesn't support HTML video. Here is a <a href="{{ url("/videos/$filepath[1]") }}">link to the video</a> instead.</p>
|
||||
</video>
|
||||
@elseif(preg_match("/\.ogg/", $filepath[1]))
|
||||
<audio class="popup__audio" controls>
|
||||
<source src="{{ url("/audio/$filepath[1]") }}" type="audio/ogg">
|
||||
<p>Download <a href="{{ url("/audio/$filepath[1]") }}">OGG</a> audio.</p>
|
||||
</audio>
|
||||
@endif
|
||||
@php
|
||||
if (preg_match("/\[\[([^\]]+)\]\]/", $checkin->note, $filepath)) {
|
||||
if (preg_match("/\.webm/", $filepath[1])) {
|
||||
$embed = '<video class="popup__video" controls>';
|
||||
$embed .= '<source src="' . url("/videos/" . $filepath[1]) . '" type="video/webm">';
|
||||
$embed .= '<p>Your browser doesn\'t support HTML video. Here is a <a href="' . url("/videos/" . $filepath[1]) . '">link to the video</a> instead.</p>';
|
||||
$embed .= '</video>';
|
||||
} elseif (preg_match("/\.ogg/", $filepath[1])) {
|
||||
$embed = '<audio class="popup__audio" controls>';
|
||||
$embed .= '<source src="' . url("/audio/" . $filepath[1]) . '" type="audio/ogg">';
|
||||
$embed .= '<p>Download <a href="' . url("/audio/" . $filepath[1]) . '">OGG</a> audio.</p>';
|
||||
$embed .= '</audio>';
|
||||
}
|
||||
$checkin->note = preg_replace("/\[\[[^\]]+\]\]/", $embed, $checkin->note);
|
||||
}
|
||||
@endphp
|
||||
|
||||
@if($checkin->id === 3930)
|
||||
@include('partials.abolition-checkin')
|
||||
@else
|
||||
{!! $checkin->note !!}
|
||||
{!! $checkin->note !!}
|
||||
@endif
|
||||
@endif
|
||||
|
||||
@if($checkin->image_url)
|
||||
<img class="popup__image" loading="lazy" src="{{ $checkin->image_url }}">
|
||||
@endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue