Created
January 12, 2023 07:04
-
-
Save Metrakit/4aa1d64c900f7c33c790da9fd1fdc766 to your computer and use it in GitHub Desktop.
hyvor test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{{-- HYVOR --}} | |
<hyvor-talk-comments | |
class="mt-4" | |
website-id="{{ hyvorId }}" | |
page-id="{{ pageId }}" | |
page-language="{{ lang }}" | |
loading="manual" | |
></hyvor-talk-comments> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const initHyvor = (sso) => { | |
const hyv = document.createElement("script"); | |
hyv.type = "module"; | |
hyv.async = true; | |
hyv.src = "//talk.hyvor.com/embed/embed.js"; | |
( | |
document.getElementsByTagName("head")[0] || | |
document.getElementsByTagName("body")[0] | |
).appendChild(hyv); | |
const comments = document.querySelector("hyvor-talk-comments"); | |
console.log(comments); | |
console.log(sso); | |
// comments.setAttribute("sso-user", sso.userData); | |
// comments.setAttribute("sso-hash", sso.hash); | |
comments.ssoUser = sso.userData; | |
comments.ssoHash = sso.hash; | |
comments.settings = { | |
auth: { | |
sso_stateless_login_url: `${sso.url}/sign-in` | |
}, | |
comments_view: { | |
is_keyboard_navigation_on: false | |
}, | |
realtime: { | |
count: false | |
}, | |
reactions: { | |
display_type: 'image' | |
}, | |
ui: { | |
box_radius: 0 | |
} | |
}; | |
comments.addEventListener('auth:login:clicked', function (e) { | |
console.log("btn clicked"); | |
}) | |
comments.load(); | |
// const hyvorInterval = setInterval(() => { | |
// if (comments.shadowRoot) { | |
// clearInterval(hyvorInterval); | |
// console.log('loaded'); | |
// console.log(comments) | |
// comments.load(); | |
// } | |
// }, 200) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment