remotes/1693045480750635534/spooky-22
Aevann1 2021-12-18 05:13:46 +02:00
parent efdc3b67fa
commit 6594777e0f
6 changed files with 22 additions and 35 deletions

View File

@ -397,6 +397,11 @@ class Submission(Base):
return title
@property
@lazy
def is_video(self):
return self.url and any((self.url.lower().endswith(x) for x in ('.mp4','.webm','.mov')))
@property
@lazy
def is_image(self):

View File

@ -304,6 +304,8 @@
{% if p.is_image %}
<span class="flex-shrink-0">(image post)</span>
{% elif p.is_video %}
<span class="flex-shrink-0">(video post)</span>
{% elif p.realurl(v) %}
<a class="flex-shrink-0 text-gray-500 hover:underline" href="/search/posts/?q=domain%3A{{p.domain}}&sort=new&t=all" {% if not v or v.newtabexternal %}target="_blank"{% endif %}>
({{p.domain}})
@ -352,13 +354,13 @@
{% endif %}
<div id="post-text" class="text-black {% if p.award_count("candycane") %}candycane{% endif %}">
{% if p.is_image %}
<a {% if not v or v.newtabexternal %}target="_blank"{% endif %} rel="nofollow noopener noreferrer" href="{{p.realurl(v)}}">
<img loading="lazy" src="{{p.realurl(v)}}" class="img-fluid" style="max-height:500px;" alt="Unable to load image">
</a>
{% elif p.url and p.url.lower().endswith('.mp4') %}
<video controls loop preload="metadata" style="max-width: 100%">
<source src="{{ p.realurl(v) }}" type="video/mp4"/>
</video>
<a {% if not v or v.newtabexternal %}target="_blank"{% endif %} rel="nofollow noopener noreferrer" href="{{p.realurl(v)}}">
<img loading="lazy" src="{{p.realurl(v)}}" class="img-fluid" style="max-height:500px;" alt="Unable to load image">
</a>
{% elif p.is_video %}
<video controls loop preload="metadata" style="max-width: 100%">
<source src="{{ p.realurl(v) }}" type="video/mp4"/>
</video>
{% endif %}
{{p.realbody(v) | safe}}

View File

@ -149,6 +149,8 @@
{% if p.is_image %}
<span>(image post)</span>
{% if p.is_video %}
<span>(video post)</span>
{% elif p.realurl(v) %}
<a class="flex-shrink-0" class="text-gray-500 hover:underline" href="/search/posts/?q=domain%3A{{p.domain}}&sort=new&t=all" {% if not v or v.newtabexternal %}target="_blank"{% endif %}>
({{p.domain}})
@ -285,7 +287,7 @@
{% endif %}
{% if not p.club or v and (v.paid_dues or v.id == p.author_id) %}
{% if p.url and p.url.lower().endswith('.mp4') %}
{% if p.is_video %}
<div id="video-{{p.id}}" style="text-align: center" class="{% if p.over_18 or not ((v and v.cardview) or (not v and environ.get('CARD_VIEW') == '1')) %}hidden{% endif %} md:ml-[4.5rem] mt-3">
<video controls loop preload="metadata" class="w-full max-h-[20rem]">
<source src="{{p.realurl(v)}}" type="video/mp4">

View File

@ -62,15 +62,10 @@ You can use Markdown formatting:
<td><lite-youtube videoid="3Hecr51ByE4" params="controls=0&modestbranding=1"></lite-youtube></td>
</tr>
<tr>
<td>MP4 Files</td>
<td>Video Files</td>
<td>https://files.catbox.moe/v4om92.mp4</td>
<td><video controls preload="none" class="embedvid"><source src="https://files.catbox.moe/v4om92.mp4" type="video/mp4"></video></td>
</tr>
<tr>
<td>WEBM Files</td>
<td>https://files.catbox.moe/v4om92.mp4</td>
<td><video controls preload="none" class="embedvid"><source src="https://files.catbox.moe/nr9joo.webm" type="video/webm"></video></td>
</tr>
<tr>
<td>Emojis</td>
<td>:marseylove:</td>

View File

@ -339,7 +339,7 @@
{% endif %}
<a class="user-name text-decoration-none" onclick='popclick({{p.author.json_popover(v) | tojson}})' data-bs-placement="bottom" data-bs-toggle="popover" data-bs-trigger="focus" data-content-id="popover" href="javascript:void(0)" tabindex="0" style="color: #{{p.author.namecolor}}; font-weight: bold;" class="user-name"><img loading="lazy" src="{{p.author.profile_url}}" class="profile-pic-25 mr-2"><span {% if p.author.patron and not p.distinguish_level %}class="patron" style="background-color:#{{p.author.namecolor}};"{% elif p.distinguish_level and 'rama' in request.host %}class="mod"{% endif %}>{{p.author.username}}</span></a>{% if p.author.customtitle %}&nbsp;<bdi style="color: #{{p.author.titlecolor}}">&nbsp;{% if p.author.quadrant %}<img loading="lazy" height="20" src="/assets/images/quadrants/{{p.author.quadrant}}.webp?v=190">{% endif %}{{p.author.customtitle | safe}}</bdi>{% endif %}
<span data-bs-toggle="tooltip" data-bs-placement="bottom" id="timestamp" onmouseover="timestamp('timestamp','{{p.created_utc}}')">&nbsp;{{p.age_string}}</span>
({% if p.is_image %}image post{% elif p.realurl(v) %}<a href="/search/posts/?q=domain%3A{{p.domain}}&sort=new&t=all" {% if not v or v.newtabexternal %}target="_blank"{% endif %}>{{p.domain}}</a>{% else %}text post{% endif %})
({% if p.is_image %}image post{% elif p.is_video %}video post{% elif p.realurl(v) %}<a href="/search/posts/?q=domain%3A{{p.domain}}&sort=new&t=all" {% if not v or v.newtabexternal %}target="_blank"{% endif %}>{{p.domain}}</a>{% else %}text post{% endif %})
{% if p.edited_utc %}
&nbsp;&nbsp;Edited <span data-bs-toggle="tooltip" data-bs-placement="bottom" onmouseover="timestamp('edited_timestamp','{{p.edited_utc}}')" id="edited_timestamp">{{p.edited_string}}</span>
@ -408,7 +408,7 @@
</div>
</div>
<pre></pre>
{% elif p.url and p.url.lower().endswith('.mp4') %}
{% elif p.is_video %}
<div class="row no-gutters">
<div class="col">
<video controls preload="none" class="embedvid">
@ -417,15 +417,6 @@
</div>
</div>
<pre></pre>
{% elif p.url and p.url.lower().endswith('.webm') %}
<div class="row no-gutters">
<div class="col">
<video controls preload="none" class="embedvid">
<source src="{{p.realurl(v)}}" type="video/webm">
</video>
</div>
</div>
<pre></pre>
{% endif %}
{{p.realbody(v) | safe}}

View File

@ -185,7 +185,7 @@
<a class="user-name text-decoration-none" onclick='popclick({{p.author.json_popover(v) | tojson}})' data-bs-placement="bottom" data-bs-toggle="popover" data-bs-trigger="focus" data-content-id="popover" href="javascript:void(0)" tabindex="0" style="color: #{{p.author.namecolor}}; font-weight: bold;"><img loading="lazy" src="{{p.author.profile_url}}" class="profile-pic-25 mr-2"><span {% if p.author.patron and not p.distinguish_level %}class="patron" style="background-color:#{{p.author.namecolor}};"{% elif p.distinguish_level and 'rama' in request.host %}class="mod"{% endif %}>{{p.author.username}}</span></a>{% if p.author.customtitle %}<bdi style="color: #{{p.author.titlecolor}}">&nbsp;&nbsp;{% if p.author.quadrant %}<img loading="lazy" height="20" src="/assets/images/quadrants/{{p.author.quadrant}}.webp?v=190">{% endif %}{{p.author.customtitle | safe}}</bdi>{% endif %}
<span data-bs-toggle="tooltip" data-bs-placement="bottom" onmouseover="timestamp('timestamp-{{p.id}}','{{p.created_utc}}')" id="timestamp-{{p.id}}">&nbsp;{{p.age_string}}</span>
&nbsp;
({% if p.is_image %}image post{% elif p.realurl(v) %}<a href="/search/posts/?q=domain%3A{{p.domain}}&sort=new&t=all" {% if v and v.newtab %}target="_blank"{% endif %}>{{p.domain}}</a>{% else %}text post{% endif %})
({% if p.is_image %}image post{% elif p.is_video %}video post{% elif p.realurl(v) %}<a href="/search/posts/?q=domain%3A{{p.domain}}&sort=new&t=all" {% if v and v.newtab %}target="_blank"{% endif %}>{{p.domain}}</a>{% else %}text post{% endif %})
{% if p.edited_utc %}
&nbsp;&nbsp;Edited <span data-bs-toggle="tooltip" data-bs-placement="bottom" id="edited_timestamp-{{p.id}}" onmouseover="timestamp('edited_timestamp-{{p.id}}','{{p.edited_utc}}')">{{p.edited_string}}</span>
{% endif %}
@ -506,20 +506,12 @@
<img loading="lazy" src="/assets/images/loading.webp" data-src="{{p.url}}" class="img-fluid" style="max-height:20rem;" alt="Unable to load image">
</a>
</div>
{% endif %}
{% if p.url and p.url.lower().endswith('.mp4') %}
{% elif p.is_video %}
<div id="video-{{p.id}}" style="text-align: center" class="{% if p.over_18 or not ((v and v.cardview) or (not v and environ.get('CARD_VIEW') == '1')) %}d-none{% endif %} mt-4">
<video controls preload="none" class="embedvid">
<source src="{{p.realurl(v)}}" type="video/mp4">
</video>
</div>
{% elif p.url and p.url.lower().endswith('.webm') %}
<div id="video-{{p.id}}" style="text-align: center" class="{% if p.over_18 or not ((v and v.cardview) or (not v and environ.get('CARD_VIEW') == '1')) %}d-none{% endif %} mt-4">
<video controls preload="none" class="embedvid">
<source src="{{p.realurl(v)}}" type="video/webm">
</video>
</div>
{% elif p.embed_url and p.domain in ['youtu.be','youtube.com'] and p.embed_url.startswith('<lite-youtube') %}
<div id="video-{{p.id}}" class="{% if p.over_18 or not ((v and v.cardview) or (not v and environ.get('CARD_VIEW') == '1')) %}d-none{% endif %} mt-3 mb-4">
{{p.embed_url | safe}}