fix(comments): update Remark42 source code (#683)

update remark42 source code

Updated frontend code taken from https://remark42.com/docs/configuration/frontend/
This commit is contained in:
Dmitry Verkhoturov 2022-09-29 16:22:01 +02:00 committed by GitHub
parent efd6f1de37
commit 8826674b1f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2,10 +2,10 @@
<div id="remark42"></div>
<script>
var remark_config = {
host: "{{ .host }}",
host: '{{ .host }}',
site_id: '{{ .site }}',
components: ['embed'],
url: "{{ $.Permalink }}",
url: '{{ $.Permalink }}',
max_shown_comments: {{ default 15 .max_shown_comments }},
theme: document.documentElement.dataset.scheme,
page_title: '{{ $.Title }}',
@ -13,14 +13,14 @@
show_email_subscription: {{ default true .show_email_subscription }}
};
(function (c) {
for (var i = 0; i < c.length; i++) {
var d = document, s = d.createElement('script');
s.src = remark_config.host + '/web/' + c[i] + '.js';
s.defer = true;
(d.head || d.body).appendChild(s);
function(e, n) {
for (var o = 0; o < e.length; o++) {
var r = n.createElement('script'),
c = '.js',
d = n.head || n.body;
'noModule' in r ? (r.type = 'module', c = '.mjs') : r.async = !0, r.defer = !0, r.src = remark_config.host + '/web/' + e[o] + c, d.appendChild(r)
}
})(remark_config.components || ['embed']);
}(remark_config.components || ['embed'], document);
window.addEventListener('onColorSchemeChange', (e) => {
window.REMARK42.changeTheme(e.detail);