🐛 fix(hyvor-talk): switch from ID to class selector for initialisation (#196)
This commit is contained in:
parent
228f1ea6e5
commit
040a46dc4b
@ -1,6 +1,6 @@
|
||||
function initHyvorTalk() {
|
||||
// Get the div that will contain the comments.
|
||||
const commentsDiv = document.querySelector('#comments');
|
||||
const commentsDiv = document.querySelector('.comments');
|
||||
if (commentsDiv) {
|
||||
// Get the various settings from data attributes on the div.
|
||||
const websiteId = commentsDiv.getAttribute('data-website-id');
|
||||
|
2
static/js/hyvortalk.min.js
vendored
2
static/js/hyvortalk.min.js
vendored
@ -1 +1 @@
|
||||
function initHyvorTalk(){var t=document.querySelector("#comments");if(t){var e=t.getAttribute("data-website-id"),a=t.getAttribute("data-page-id"),i=t.getAttribute("data-page-language"),d=t.getAttribute("data-loading"),r=t.getAttribute("data-page-author"),n=document.createElement("script");n.src="https://talk.hyvor.com/embed/embed.js",n.async=!0,n.type="module",document.head.appendChild(n);const o=document.createElement("hyvor-talk-comments");o.setAttribute("website-id",e),o.setAttribute("page-id",a),o.setAttribute("page-language",i),o.setAttribute("loading",d),o.setAttribute("page-author",r);n=document.documentElement.getAttribute("data-theme")||"light";o.setAttribute("colors",n),t.appendChild(o),window.addEventListener("themeChanged",t=>{t=t.detail.theme;o.setAttribute("colors",t)})}}initHyvorTalk();
|
||||
function initHyvorTalk(){var t=document.querySelector(".comments");if(t){var e=t.getAttribute("data-website-id"),a=t.getAttribute("data-page-id"),i=t.getAttribute("data-page-language"),d=t.getAttribute("data-loading"),r=t.getAttribute("data-page-author"),n=document.createElement("script");n.src="https://talk.hyvor.com/embed/embed.js",n.async=!0,n.type="module",document.head.appendChild(n);const o=document.createElement("hyvor-talk-comments");o.setAttribute("website-id",e),o.setAttribute("page-id",a),o.setAttribute("page-language",i),o.setAttribute("loading",d),o.setAttribute("page-author",r);n=document.documentElement.getAttribute("data-theme")||"light";o.setAttribute("colors",n),t.appendChild(o),window.addEventListener("themeChanged",t=>{t=t.detail.theme;o.setAttribute("colors",t)})}}initHyvorTalk();
|
||||
|
Loading…
x
Reference in New Issue
Block a user