From 3cf865dfec89f1e52805b11c176b29aaef594d2d Mon Sep 17 00:00:00 2001 From: Aevann Date: Tue, 29 Aug 2023 14:05:10 +0300 Subject: [PATCH] improve videos --- files/assets/css/main.css | 30 +++++++++++++----------------- files/helpers/sanitize.py | 4 +++- files/templates/default.html | 12 ++++++------ files/templates/post.html | 4 +++- files/templates/post_listing.html | 2 +- 5 files changed, 26 insertions(+), 26 deletions(-) diff --git a/files/assets/css/main.css b/files/assets/css/main.css index 07ef4e0e39..bdad1de3c0 100644 --- a/files/assets/css/main.css +++ b/files/assets/css/main.css @@ -5369,12 +5369,6 @@ textarea { margin-bottom: 0.5rem !important; cursor: pointer; } -video { - max-height: 50vh !important; - max-width: 100% !important; - margin-top: 0.5rem !important; - margin-bottom: 0.5rem !important; -} .spotify { max-height: 80px !important; max-width: 100% !important; @@ -5658,12 +5652,10 @@ lite-youtube { background-size: cover; cursor: pointer; margin-bottom: 1.3rem !important; - display: inline-block; - resize: both; - overflow: auto; + overflow: hidden; max-height: 70vh !important; - max-width: 100vw !important; + max-width: 90vw !important; width: min(100%, 500px); } @@ -7075,15 +7067,19 @@ div.markdown { .resizable { resize: both; display: inline-block; - overflow: auto; - max-width: 100vw !important; -} -.resizable > video { - height: 99% !important; - width: 99% !important; + overflow: hidden; max-height: 70vh !important; - max-width: 100vw !important; + max-width: 90vw !important; +} +.resizable.yt { + display: block; +} +.resizable > * { + height: 95% !important; + width: 95% !important; margin: 0 !important; + max-height: 65vh !important; + max-width: 85vw !important; } .user-signature video { diff --git a/files/helpers/sanitize.py b/files/helpers/sanitize.py index 70ceb8d288..39b17f22f5 100644 --- a/files/helpers/sanitize.py +++ b/files/helpers/sanitize.py @@ -95,7 +95,7 @@ def allowed_attributes(tag, name, value): if name == 'preload' and value == 'none': return True if tag == 'p': - if name == 'class' and value in {'mb-0','resizable','text-center'}: return True + if name == 'class' and value in {'mb-0','resizable','yt','text-center'}: return True if tag == 'span': if name == 'data-bs-toggle' and value == 'tooltip': return True @@ -650,6 +650,8 @@ def sanitize(sanitized, golden=True, limit_pings=0, showmore=False, count_emojis html = handle_youtube_links(i.group(1)) if html: + if not chat: + html = f'

{html}

' sanitized = sanitized.replace(i.group(0), html) if '
' not in sanitized and blackjack != "rules":
diff --git a/files/templates/default.html b/files/templates/default.html
index 30a871e7a6..82312ea351 100644
--- a/files/templates/default.html
+++ b/files/templates/default.html
@@ -74,12 +74,6 @@
 {% block mobileUserBanner %}{% endblock %}
 
- {% block sidebar %} - {% if has_sidebar and (home or p) %} - {% set sidebar = "sidebar_" ~ SITE_NAME ~ ".html" %} - {% include sidebar %} - {% endif %} - {% endblock %}
{% block desktopUserBanner %}{% endblock %} {% block desktopBanner %}{% endblock %} @@ -88,6 +82,12 @@ {% block content %}{% endblock %} {% block pagenav %}{% endblock %}
+ {% block sidebar %} + {% if has_sidebar and (home or p) %} + {% set sidebar = "sidebar_" ~ SITE_NAME ~ ".html" %} + {% include sidebar %} + {% endif %} + {% endblock %}
{% block mobilenavbar %}{% include "mobile_navigation_bar.html" %}{% endblock %} diff --git a/files/templates/post.html b/files/templates/post.html index 559617d3f1..871857e867 100644 --- a/files/templates/post.html +++ b/files/templates/post.html @@ -110,7 +110,9 @@ {% endif %} {% elif p.domain in ['youtu.be','youtube.com'] and p.embed and p.embed.startswith(' + {{p.embed | safe}} +

{% endif %} {% endif %} diff --git a/files/templates/post_listing.html b/files/templates/post_listing.html index e6001196c6..fb6d3731a8 100644 --- a/files/templates/post_listing.html +++ b/files/templates/post_listing.html @@ -224,7 +224,7 @@ {% elif p.is_youtube %} -
+
{{p.embed | safe}}
{% endif %}