embed rework

master
Aevann1 2022-06-27 03:00:45 +02:00
parent 785cea9c4c
commit b5d993569f
11 changed files with 39 additions and 21 deletions

View File

@ -215,6 +215,10 @@ def sanitize(sanitized, edit=False):
tag['alt'] = f'![]({tag["data-src"]})'
tag['referrerpolicy'] = "no-referrer"
a = soup.new_tag("a", href=tag["data-src"], rel="nofollow noopener noreferrer")
tag = tag.replace_with(a)
a.append(tag)
for tag in soup.find_all("a"):
if tag.get("href") and fishylinks_regex.fullmatch(str(tag.string)):
tag.string = tag["href"]

View File

@ -199,7 +199,7 @@
{% include "emoji_modal.html" %}
{% include "expanded_image_modal.html" %}
<script src="/assets/js/lozad.js?v=242"></script>
<script src="{{asset('js/lozad.js')}}"></script>
<script src="/assets/js/lite-youtube.js?v=241"></script>
</body>

View File

@ -268,7 +268,9 @@
{% block Banner %}
{% if '@' not in request.path %}
{% if sub %}
<img alt="/h/{{sub.name}} banner" role="button" data-bs-toggle="modal" data-bs-target="#expandImageModal" onclick="expandDesktopImage('{{sub.banner_url}}')" loading="lazy" src="{{sub.banner_url}}" width=100% style="object-fit:cover;max-height:min(42vh,30vw)!important">
<a href="{{sub.banner_url}}">
<img alt="/h/{{sub.name}} banner" role="button" onclick="expandDesktopImage()" loading="lazy" src="{{sub.banner_url}}" width=100% style="object-fit:cover;max-height:min(42vh,30vw)!important">
</a>
{% elif SITE_NAME == 'rDrama' %}
{% set path = "assets/images/" + SITE_NAME + "/banners" %}
{% set image = "/" + path + "/" + listdir('files/' + path)|random() + '?v=25' %}
@ -365,7 +367,7 @@
</div>
</div>
<script src="/assets/js/lozad.js?v=242"></script>
<script src="{{asset('js/lozad.js')}}"></script>
{% if v %}
<script src="{{asset('js/formatting.js')}}"></script>

View File

@ -290,8 +290,6 @@
</div>
</nav>
<script src="{{asset('js/header.js')}}"></script>
{% if v and not err %}
<div id="formkey" class="d-none">{{v.formkey}}</div>
{% endif %}

View File

@ -6,7 +6,9 @@
{% set image='/i/' + SITE_NAME + '/sidebar.webp?v=2000' %}
{% endif %}
<img class="mb-4" alt="sidebar image" role="button" data-bs-toggle="modal" data-bs-target="#expandImageModal" onclick="expandDesktopImage('{{image}}')" loading="lazy" src="{{image}}" width=100%>
<a href="{{image}}">
<img class="mb-4" alt="sidebar image" role="button" onclick="expandDesktopImage()" loading="lazy" src="{{image}}" width=100%>
</a>
<p class="text-center text-md mb-4">
<a class="sidebar-link" href="/random_user/" data-bs-toggle="tooltip" data-bs-placement="top" title="Random User"><i class="fas fa-music"></i></a>

View File

@ -41,8 +41,9 @@
{% set image='/i/' + SITE_NAME + '/sidebar.webp?v=2000' %}
{% endif %}
<img class="mb-4" alt="sidebar image" role="button" data-bs-toggle="modal" data-bs-target="#expandImageModal" onclick="expandDesktopImage('{{image}}')" loading="lazy" src="{{image}}" width=100%>
<a href="{{image}}">
<img class="mb-4" alt="sidebar image" role="button" onclick="expandDesktopImage()" loading="lazy" src="{{image}}" width=100%>
</a>
<pre>

View File

@ -6,7 +6,9 @@
{% set image='/i/' + SITE_NAME + '/sidebar.webp?v=2000' %}
{% endif %}
<img class="mb-4" alt="sidebar image" role="button" data-bs-toggle="modal" data-bs-target="#expandImageModal" onclick="expandDesktopImage('{{image}}')" loading="lazy" src="{{image}}" width=100%>
<a href="{{image}}">
<img class="mb-4" alt="sidebar image" role="button" onclick="expandDesktopImage()" loading="lazy" src="{{image}}" width=100%>
</a>
<p class="text-center text-md mb-4">
<a class="sidebar-link" href="/admins" data-bs-toggle="tooltip" data-bs-placement="top" title="Admins"><i class="fas fa-crown"></i></a>

View File

@ -31,9 +31,13 @@ set VISITORS_HERE_FLAVOR = [
{% endif %}
{% if v and (v.is_banned or v.agendaposter) %}
<img class="mb-4" alt="sidebar image" role="button" data-bs-toggle="modal" data-bs-target="#expandImageModal" onclick="expandDesktopImage('/i/{{SITE_NAME}}/sidebar2.webp')" loading="lazy" src="/i/{{SITE_NAME}}/sidebar2.webp" width=100%>
<a href="/i/{{SITE_NAME}}/sidebar2.webp">
<img class="mb-4" alt="sidebar image" role="button" onclick="expandDesktopImage()" loading="lazy" src="/i/{{SITE_NAME}}/sidebar2.webp" width=100%>
</a>
{% else %}
<img class="mb-4" alt="sidebar image" role="button" data-bs-toggle="modal" data-bs-target="#expandImageModal" onclick="expandDesktopImage('{{image}}')" loading="lazy" src="{{image}}" width=100%>
<a href="{{image}}">
<img class="mb-4" alt="sidebar image" role="button" onclick="expandDesktopImage()" loading="lazy" src="{{image}}" width=100%>
</a>
{% endif %}
<p class="mt-1 ml-2 mb-4 text-center">

View File

@ -123,14 +123,16 @@
<img alt="post thumnail" loading="lazy" src="{{p.thumb_url}}" class="post-img">
</a>
{% elif p.is_image %}
<img role="button" data-bs-toggle="modal" data-bs-target="#expandImageModal" onclick="expandDesktopImage('{{p.realurl(v)}}')" alt="post thumnail" loading="lazy" src="{{p.thumb_url}}" class="post-img">
<a href="{{p.realurl(v)}}" rel="nofollow noopener noreferrer">
<img onclick="expandDesktopImage('{{p.realurl(v)}}')" alt="post thumnail" loading="lazy" src="{{p.thumb_url}}" class="post-img">
</a>
{% elif p.is_video or p.is_audio %}
<a role="button" onclick="togglevideo({{p.id}})">
<img alt="post thumnail" loading="lazy" src="{{p.thumb_url}}" class="post-img">
<a href="{{p.realurl(v)}}" rel="nofollow noopener noreferrer">
<img onclick="togglevideo('{{p.id}}')" alt="post thumnail" loading="lazy" src="{{p.thumb_url}}" class="post-img">
</a>
{% elif p.is_youtube %}
<a role="button" onclick="document.getElementById('video-{{p.id}}').classList.toggle('d-none')">
<img alt="post thumnail" loading="lazy" src="{{p.thumb_url}}" class="post-img">
<a href="{{p.realurl(v)}}" rel="nofollow noopener noreferrer">
<img onclick="toggleyoutube('{{p.id}}')" alt="post thumnail" loading="lazy" src="{{p.thumb_url}}" class="post-img">
</a>
{% else %}
<a {% if not v or v.newtabexternal %}target="_blank"{% endif %} rel="nofollow noopener noreferrer" href="{{p.realurl(v)}}">
@ -445,4 +447,4 @@
<script src="/assets/js/clipboard.js?v=240"></script>
<script src="{{asset('js/comments+submission_listing.js')}}"></script>
<script src="/assets/js/submission_listing.js?v=240"></script>
<script src="{{asset('js/submission_listing.js')}}"></script>

View File

@ -369,7 +369,9 @@
<div class="container-fluid pb-0 text-center bg-white d-md-none" style="margin-top:-6px;border-radius:0!important;">
<div class="row">
<div class="col px-0">
<img alt="@{{u.username}}'s banner" role="button" data-bs-toggle="modal" data-bs-target="#expandImageModal" onclick="expandDesktopImage('{{u.banner_url}}')" loading="lazy" src="{{u.banner_url}}" width=100% style="object-fit:cover;max-height:30vh!important">
<a href="{{u.banner_url}}">
<img alt="@{{u.username}}'s banner" role="button" onclick="expandDesktopImage()" loading="lazy" src="{{u.banner_url}}" width=100% style="object-fit:cover;max-height:30vh!important">
</a>
</div>
</div>
<div class="row border-bottom">

View File

@ -16,16 +16,17 @@ set CACHE_VER = {
'css/win98.css': 61,
'js/award_modal.js': 253,
'js/bootstrap.js': 266,
'js/bootstrap.js': 267,
'js/comments+submission_listing.js': 261,
'js/submission_listing.js': 261,
'js/emoji_modal.js': 296,
'js/formatting.js': 240,
'js/header.js': 275,
'js/lottery.js': 256,
'js/marked.js': 272,
'js/submit.js': 263,
'js/userpage.js': 241,
'js/userpage_v.js': 245,
'js/lozad.js': 260,
'images/badges/': 1021,
}