File tree 3 files changed +22
-10
lines changed
3 files changed +22
-10
lines changed Original file line number Diff line number Diff line change @@ -59,11 +59,16 @@ def _replace_embed(match):
59
59
youtube_id = extract_youtube_id (url )
60
60
if not youtube_id :
61
61
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>'''
67
72
68
73
69
74
@app .template_filter ()
Original file line number Diff line number Diff line change @@ -26,9 +26,18 @@ body {
26
26
margin-top : 2rem ;
27
27
}
28
28
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% ;
32
41
}
33
42
34
43
.blog-article .content a : active ,
Original file line number Diff line number Diff line change 1
- console . debug ( '>>>' , document . querySelectorAll ( 'article .content img' ) )
2
- debugger
3
1
Array . from ( document . querySelectorAll ( 'article .content img' ) ) . forEach ( img => {
4
2
const rects = img . getClientRects ( ) [ 0 ]
5
3
img . style . width = `${ rects . right } px`
You can’t perform that action at this time.
0 commit comments