Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
1 contributor

Users who have contributed to this file

43 lines (43 sloc) 1.65 KB
<script>
function loadComments() {
if (typeof Valine === 'undefined') {
var getScript = (options) => {
var script = document.createElement('script');
script.defer = true;
script.crossOrigin = 'anonymous';
Object.keys(options).forEach((key) => {
script[key] = options[key];
});
document.body.appendChild(script);
};
getScript({
src: 'https://unpkg.com/valine/dist/Valine.min.js',
onload: () => {
newValine();
}
});
} else {
newValine();
}
}
function newValine() {
new Valine({
el: '#vcomments',
appId: '{{ .Site.Params.valineAppId }}',
appKey: '{{ .Site.Params.valineAppKey }}',
placeholder: '{{ .Site.Params.valinePlaceholder }}',
notify: {{ .Site.Params.valineNotify }},
verify: {{ .Site.Params.valineVerify }},
path: {{ .Site.Params.valinePath | default "location.pathname" | safeJS }},
avatar: '{{ .Site.Params.valineAvatar }}',
meta: {{ .Site.Params.valineMeta }},
pageSize: {{ .Site.Params.valinePageSize }},
lang: '{{ .Site.Params.valineLang }}',
visitor: {{ .Site.Params.valineVisitor }},
highlight: {{ .Site.Params.valineHighlight }},
avatarForce: {{ .Site.Params.avatarForce }},
recordIP: {{ .Site.Params.valineRecordIP }},
serverURLs: '{{ .Site.Params.valineServerURLs }}'
});
}
</script>
You can’t perform that action at this time.