️ refactor(utterances): further minify JS

main
welpo 2 years ago
parent cffe06f44e
commit 725101300e
No known key found for this signature in database
GPG Key ID: A2F978CF4EC1F5A6

@ -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();

Loading…
Cancel
Save