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 18
18
< script type ="text/javascript " src ="//cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-AMS_SVG "> </ script >
19
19
{% endif %}
20
20
< 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 >
22
22
< script type ="text/javascript ">
23
23
ChicioCodingBlog . init ( '{{ include.track-category }}' , { { include . shouldActivatePullToRefresh } } )
24
24
</ 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 = () => {
5
5
this . page . identifier = window . location . href
6
6
}
7
7
const intersectionObserver : IntersectionObserver = new IntersectionObserver (
8
- loadDisqus ,
9
- { rootMargin : '250px 0px' , threshold : 0.01 }
8
+ onIntersection ,
9
+ { rootMargin : '100px 0px' , threshold : 0.01 }
10
10
)
11
11
const disquisThread = document . getElementById ( 'disqus_thread' )
12
12
if ( disquisThread ) {
13
13
intersectionObserver . observe ( disquisThread )
14
14
}
15
15
}
16
16
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 )
19
27
const s = document . createElement ( 'script' )
20
28
s . src = 'https://fabrizio-duroni.disqus.com/embed.js'
21
29
s . setAttribute ( 'data-timestamp' , `${ + new Date ( ) } ` )
Original file line number Diff line number Diff line change @@ -5,17 +5,25 @@ const disqus = () => {
5
5
this . page . identifier = window . location . href
6
6
}
7
7
const intersectionObserver = new IntersectionObserver (
8
- loadDisqus ,
9
- { rootMargin : '250px 0px' , threshold : 0.01 }
8
+ onIntersection ,
9
+ { rootMargin : '100px 0px' , threshold : 0.01 }
10
10
)
11
11
const disquisThread = document . getElementById ( 'disqus_thread' )
12
12
if ( disquisThread ) {
13
13
intersectionObserver . observe ( disquisThread )
14
14
}
15
15
}
16
16
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 )
19
27
const s = document . createElement ( 'script' )
20
28
s . src = 'https://fabrizio-duroni.disqus.com/embed.js'
21
29
s . setAttribute ( 'data-timestamp' , `${ + new Date ( ) } ` )
You can’t perform that action at this time.
0 commit comments