Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 2bc54b9

Browse files
fuentesloicmlbiche
authored andcommittedMar 24, 2020
Video full size (#333)
1 parent 987f22a commit 2bc54b9

File tree

3 files changed

+22
-10
lines changed

3 files changed

+22
-10
lines changed
 

‎core/helpers.py

+10-5
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,16 @@ def _replace_embed(match):
5959
youtube_id = extract_youtube_id(url)
6060
if not youtube_id:
6161
return url
62-
return f'''<iframe class=video width=auto height=auto
63-
src=https://www.youtube-nocookie.com/embed/{youtube_id}
64-
frameborder=0 allow="autoplay; encrypted-media" allowfullscreen>
65-
</iframe>
66-
<small>{url}</small>'''
62+
return f'''
63+
<div class=video>
64+
<iframe
65+
src=https://www.youtube-nocookie.com/embed/{youtube_id}
66+
frameborder=0
67+
allow="autoplay; encrypted-media"
68+
allowfullscreen>
69+
</iframe>
70+
<small>{url}</small>
71+
</div>'''
6772

6873

6974
@app.template_filter()

‎static/css/article.css

+12-3
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,18 @@ body {
2626
margin-top: 2rem;
2727
}
2828

29-
.blog-article .content a {
30-
color: var(--color-primary);
31-
text-decoration: underline dotted var(--color-primary);
29+
.blog-article .video {
30+
position: relative;
31+
padding-bottom: 56.25%; /* 16:9 */
32+
height: 0;
33+
}
34+
35+
.blog-article .video > iframe {
36+
position: absolute;
37+
top: 0;
38+
left: 0;
39+
width: 100%;
40+
height: 100%;
3241
}
3342

3443
.blog-article .content a:active,

‎static/js/article.js

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
console.debug('>>>', document.querySelectorAll('article .content img'))
2-
debugger
31
Array.from(document.querySelectorAll('article .content img')).forEach(img => {
42
const rects = img.getClientRects()[0]
53
img.style.width = `${rects.right}px`

0 commit comments

Comments
 (0)
Please sign in to comment.