From 725101300e77773362c2bec55d082798465aec0b Mon Sep 17 00:00:00 2001 From: welpo Date: Thu, 17 Aug 2023 23:58:08 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9A=A1=EF=B8=8F=20refactor(utterances):=20fu?= =?UTF-8?q?rther=20minify=20JS?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- static/js/utterances.min.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static/js/utterances.min.js b/static/js/utterances.min.js index da6ff7d..992de3b 100644 --- a/static/js/utterances.min.js +++ b/static/js/utterances.min.js @@ -1 +1 @@ -function setUtterancesTheme(t){const e=document.querySelector(".utterances-frame");e&&e.contentWindow.postMessage({type:"set-theme",theme:t},"https://utteranc.es")}function initUtterances(){const t=document.querySelector(".comments");if(t){var e=t.getAttribute("data-repo"),a=t.getAttribute("data-issue-term"),r=t.getAttribute("data-label");const s=t.getAttribute("data-light-theme"),d=t.getAttribute("data-dark-theme");var n=t.getAttribute("data-lazy-loading"),i=document.createElement("script"),e=(i.src="https://utteranc.es/client.js",i.async=!0,i.setAttribute("repo",e),i.setAttribute("issue-term",a),i.setAttribute("label",r),document.documentElement.getAttribute("data-theme")||"light"),a="dark"===e?d:s;i.setAttribute("theme",a),i.setAttribute("crossorigin","anonymous"),"true"===n&&i.setAttribute("data-loading","lazy"),t.appendChild(i),window.addEventListener("themeChanged",t=>{setUtterancesTheme("dark"===t.detail.theme?d:s)})}}initUtterances(); +function setUtterancesTheme(t){var e=document.querySelector(".utterances-frame");e&&e.contentWindow.postMessage({type:"set-theme",theme:t},"https://utteranc.es")}function initUtterances(){var t=document.querySelector(".comments");if(t){const a=t.getAttribute("data-repo"),r=t.getAttribute("data-issue-term"),n=t.getAttribute("data-label"),i=t.getAttribute("data-light-theme"),s=t.getAttribute("data-dark-theme"),u=t.getAttribute("data-lazy-loading"),d=document.createElement("script");d.src="https://utteranc.es/client.js",d.async=!0,d.setAttribute("repo",a),d.setAttribute("issue-term",r),d.setAttribute("label",n);var e="dark"===(document.documentElement.getAttribute("data-theme")||"light")?s:i;d.setAttribute("theme",e),d.setAttribute("crossorigin","anonymous"),"true"===u&&d.setAttribute("data-loading","lazy"),t.appendChild(d),window.addEventListener("themeChanged",t=>{setUtterancesTheme("dark"===t.detail.theme?s:i)})}}initUtterances();