@@ -11,7 +11,7 @@ excerpt: ""
1111pill : " Developer Voices by Kris Jenkins"
1212---
1313
14- <div class =" video-container " >
14+ <div class =" video-container sticky " >
1515<iframe id =" yt-player " width =" 560 " height =" 315 " src =" https://www.youtube-nocookie.com/embed/C3l4CsP1Ak0?si=u_DMOqM7NgftcqOi&enablejsapi=1 " title =" YouTube video player " frameborder =" 0 " allow =" accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share " referrerpolicy =" strict-origin-when-cross-origin " allowfullscreen ></iframe >
1616</div >
1717
@@ -38,7 +38,6 @@ pill: "Developer Voices by Kris Jenkins"
3838 ytPlayer .playVideo ();
3939 }
4040 function seekYouTube (seconds ) {
41- document .getElementById (' yt-player' ).scrollIntoView ({ behavior: ' smooth' , block: ' center' });
4241 if (ytReady) {
4342 doSeek (seconds);
4443 } else {
@@ -55,7 +54,8 @@ pill: "Developer Voices by Kris Jenkins"
5554 var a = document .createElement (' a' );
5655 a .href = ' #' ;
5756 a .className = ' yt-seek' ;
58- a .textContent = text;
57+ a .innerHTML = ' <svg class="icon"><use href="#play"></use></svg>' ;
58+ a .appendChild (document .createTextNode (text .slice (1 , - 1 )));
5959 a .title = ' Jump to ' + m[0 ].slice (1 , - 1 ) + ' in the video' ;
6060 a .addEventListener (' click' , function (e ) {
6161 e .preventDefault ();
@@ -65,9 +65,40 @@ pill: "Developer Voices by Kris Jenkins"
6565 p .appendChild (a);
6666 });
6767 });
68+
69+ document .addEventListener (' click' , function (e ) {
70+ if (e .target .closest (' svg.anchor-icon' )) return ;
71+ var a = e .target .closest (' h2 > a[href^="#"], h3 > a[href^="#"], h4 > a[href^="#"]' );
72+ if (! a) return ;
73+ e .preventDefault ();
74+ e .stopPropagation ();
75+ history .replaceState (null , ' ' , a .href );
76+ }, true );
6877</script >
6978<style >
70- .yt-seek { font-family : monospace ; }
79+ .newswrap .postwrap .postcontent h2 + p :has (> .yt-seek ),
80+ .newswrap .postwrap .postcontent h3 + p :has (> .yt-seek ),
81+ .newswrap .postwrap .postcontent h4 + p :has (> .yt-seek ) {
82+ margin-top : 0 ;
83+ }
84+ .newswrap .postwrap .postcontent h2 :has (+ p > .yt-seek ),
85+ .newswrap .postwrap .postcontent h3 :has (+ p > .yt-seek ),
86+ .newswrap .postwrap .postcontent h4 :has (+ p > .yt-seek ) {
87+ margin-bottom : 6px ;
88+ }
89+ .yt-seek {
90+ font-family : " JetBrainsMono-Bold" , monospace ;
91+ font-size : var (--type-code-large , 16px );
92+ text-decoration : none ;
93+ }
94+ .yt-seek svg .icon {
95+ width : .9em ;
96+ height : .9em ;
97+ margin-right : .35em ;
98+ vertical-align : -.1em ;
99+ fill : currentColor ;
100+ stroke : none ;
101+ }
71102</style >
72103
73104| -------| -------|
0 commit comments