cosmetic improvement to reddit embed

master
Aevann 2024-04-09 03:51:24 +02:00
parent aced39943b
commit 4f65791d3b
3 changed files with 6 additions and 3 deletions

View File

@ -7824,3 +7824,8 @@ table.border-0 * {
img[src$="/e/speechbubble.webp"] {
height: auto !important;
}
#reddit-embed {
border: none;
margin-bottom: 10px;
}

View File

@ -3,8 +3,6 @@ addEventListener("message", function(t) {
const data = JSON.parse(t.data)
let height = data.data
if (data && "type" in data && data.type == "resize.embed")
if (screen_width < 768)
height += 40
document.getElementById('reddit-embed').height = height
}
})

View File

@ -149,7 +149,7 @@
{% endif %}
{% if p.url and p.url.startswith('https://old.reddit.com/r/') %}
<iframe id="reddit-embed" class="border-0" src="{{p.url.replace('https://old.reddit.com/', 'https://embed.reddit.com/').split('?')[0]}}?context=1&showtitle=true{% if v.theme in DARK_THEMES %}&theme=dark{% endif %}" height="317px" width="100%"></iframe>
<iframe id="reddit-embed" src="{{p.url.replace('https://old.reddit.com/', 'https://embed.reddit.com/').split('?')[0]}}?context=1&showtitle=true{% if v.theme in DARK_THEMES %}&theme=dark{% endif %}" height="317px" width="100%"></iframe>
<script defer src="{{'js/reddit_embed.js' | asset}}"></script>
{% endif %}