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