This repository was archived by the owner on Jan 19, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 5 files changed +27
-11
lines changed
Expand file tree Collapse file tree 5 files changed +27
-11
lines changed Original file line number Diff line number Diff line change 1818< script type ="text/javascript " src ="//cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-AMS_SVG "> </ script >
1919{% endif %}
2020< script type ="text/javascript " src ="https://cdn.jsdelivr.net/npm/cookieconsent@3/build/cookieconsent.min.js " data-cfasync ="false "> </ script >
21- < script type ="text/javascript " src ="/assets/js/index.blog.min.js?rev=7878cb2532f75ed3af6934acec4c2205 "> </ script >
21+ < script type ="text/javascript " src ="/assets/js/index.blog.min.js?rev=0c9e9c3055977cc5c44727b808ce2c51 "> </ script >
2222< script type ="text/javascript ">
2323 ChicioCodingBlog . init ( '{{ include.track-category }}' , { { include . shouldActivatePullToRefresh } } )
2424</ script >
Original file line number Diff line number Diff line change 1- "/assets/js/index.blog.min.js?rev=7878cb2532f75ed3af6934acec4c2205 " ,
1+ "/assets/js/index.blog.min.js?rev=0c9e9c3055977cc5c44727b808ce2c51 " ,
Original file line number Diff line number Diff line change @@ -5,17 +5,25 @@ const disqus = () => {
55 this . page . identifier = window . location . href
66 }
77 const intersectionObserver : IntersectionObserver = new IntersectionObserver (
8- loadDisqus ,
9- { rootMargin : '250px 0px' , threshold : 0.01 }
8+ onIntersection ,
9+ { rootMargin : '100px 0px' , threshold : 0.01 }
1010 )
1111 const disquisThread = document . getElementById ( 'disqus_thread' )
1212 if ( disquisThread ) {
1313 intersectionObserver . observe ( disquisThread )
1414 }
1515}
1616
17- const loadDisqus = ( entries : IntersectionObserverEntry [ ] , observer : IntersectionObserver ) => {
18- observer . unobserve ( entries [ 0 ] . target )
17+ const onIntersection = ( entries : IntersectionObserverEntry [ ] , observer : IntersectionObserver ) : void => {
18+ for ( let i : number = 0 ; i < entries . length ; i ++ ) {
19+ if ( entries [ i ] . intersectionRatio > 0 ) {
20+ loadDisqus ( entries [ i ] . target , observer )
21+ }
22+ }
23+ }
24+
25+ const loadDisqus = ( element : HTMLElement , observer : IntersectionObserver ) => {
26+ observer . unobserve ( element )
1927 const s = document . createElement ( 'script' )
2028 s . src = 'https://fabrizio-duroni.disqus.com/embed.js'
2129 s . setAttribute ( 'data-timestamp' , `${ + new Date ( ) } ` )
Original file line number Diff line number Diff line change @@ -5,17 +5,25 @@ const disqus = () => {
55 this . page . identifier = window . location . href
66 }
77 const intersectionObserver = new IntersectionObserver (
8- loadDisqus ,
9- { rootMargin : '250px 0px' , threshold : 0.01 }
8+ onIntersection ,
9+ { rootMargin : '100px 0px' , threshold : 0.01 }
1010 )
1111 const disquisThread = document . getElementById ( 'disqus_thread' )
1212 if ( disquisThread ) {
1313 intersectionObserver . observe ( disquisThread )
1414 }
1515}
1616
17- const loadDisqus = ( entries , observer ) => {
18- observer . unobserve ( entries [ 0 ] . target )
17+ const onIntersection = ( entries , observer ) => {
18+ for ( let i = 0 ; i < entries . length ; i ++ ) {
19+ if ( entries [ i ] . intersectionRatio > 0 ) {
20+ loadDisqus ( entries [ i ] . target , observer )
21+ }
22+ }
23+ }
24+
25+ const loadDisqus = ( element , observer ) => {
26+ observer . unobserve ( element )
1927 const s = document . createElement ( 'script' )
2028 s . src = 'https://fabrizio-duroni.disqus.com/embed.js'
2129 s . setAttribute ( 'data-timestamp' , `${ + new Date ( ) } ` )
You can’t perform that action at this time.
0 commit comments