1+ {% if page.meta.comments %}
2+ < h2 id ="__comments "> {{ lang.t("meta.comments") }}</ h2 >
3+ <!-- Insert generated snippet here -->
4+ < script src ="https://giscus.app/client.js "
5+ data-repo ="0xPolygon/polygon-docs "
6+ data-repo-id ="R_kgDOKs6Fqg "
7+ data-category ="Announcements "
8+ data-category-id ="DIC_kwDOKs6Fqs4CcoXX "
9+ data-mapping ="pathname "
10+ data-strict ="0 "
11+ data-reactions-enabled ="1 "
12+ data-emit-metadata ="0 "
13+ data-input-position ="bottom "
14+ data-theme ="preferred_color_scheme "
15+ data-lang ="en "
16+ crossorigin ="anonymous "
17+ async >
18+ </ script >
19+
20+ <!-- Synchronize Giscus theme with palette -->
21+ < script >
22+ var giscus = document . querySelector ( "script[src*=giscus]" )
23+
24+ // Set palette on initial load
25+ var palette = __md_get ( "__palette" )
26+ if ( palette && typeof palette . color === "object" ) {
27+ var theme = palette . color . scheme === "slate"
28+ ? "transparent_dark"
29+ : "light"
30+
31+ // Instruct Giscus to set theme
32+ giscus . setAttribute ( "data-theme" , theme )
33+ }
34+
35+ // Register event handlers after documented loaded
36+ document . addEventListener ( "DOMContentLoaded" , function ( ) {
37+ var ref = document . querySelector ( "[data-md-component=palette]" )
38+ ref . addEventListener ( "change" , function ( ) {
39+ var palette = __md_get ( "__palette" )
40+ if ( palette && typeof palette . color === "object" ) {
41+ var theme = palette . color . scheme === "slate"
42+ ? "transparent_dark"
43+ : "light"
44+
45+ // Instruct Giscus to change theme
46+ var frame = document . querySelector ( ".giscus-frame" )
47+ frame . contentWindow . postMessage (
48+ { giscus : { setConfig : { theme } } } ,
49+ "https://giscus.app"
50+ )
51+ }
52+ } )
53+ } )
54+ </ script >
55+ {% endif %}
0 commit comments