mirror of
https://github.com/Damillora/Yuika
synced 2024-11-22 17:27:32 +00:00
chore: add comments
This commit is contained in:
parent
dbceefbaef
commit
105a835bab
@ -3,3 +3,4 @@ import './lib/fitvids';
|
|||||||
import './lib/infinite-scroll';
|
import './lib/infinite-scroll';
|
||||||
import './lib/nav-collapse';
|
import './lib/nav-collapse';
|
||||||
import './lib/search';
|
import './lib/search';
|
||||||
|
import './lib/comments';
|
||||||
|
39
assets/js/lib/comments.js
Normal file
39
assets/js/lib/comments.js
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
|
||||||
|
window.remark_config = {
|
||||||
|
host: "https://comments.nanao.moe", // hostname of remark server, same as REMARK_URL in backend config, e.g. "https://demo.remark42.com"
|
||||||
|
site_id: 'yuika',
|
||||||
|
theme: 'light',
|
||||||
|
components: ['embed'], // optional param; which components to load. default to ["embed"]
|
||||||
|
// to load all components define components as ['embed', 'last-comments', 'counter']
|
||||||
|
// available component are:
|
||||||
|
// - 'embed': basic comments widget
|
||||||
|
// - 'last-comments': last comments widget, see `Last Comments` section below
|
||||||
|
// - 'counter': counter widget, see `Counter` section below
|
||||||
|
max_shown_comments: 10, // optional param; if it isn't defined default value (15) will be used
|
||||||
|
show_email_subscription: false // optional param; by default it is `true` and you can see email subscription feature
|
||||||
|
// in interface when enable it from backend side
|
||||||
|
// if you set this param in `false` you will get notifications email notifications as admin
|
||||||
|
// but your users won't have interface for subscription
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
remark_config.theme = window.document.body.getAttribute("data-theme");
|
||||||
|
(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);
|
||||||
|
}
|
||||||
|
})(remark_config.components || ['embed']);
|
||||||
|
document.getElementById("darkMode").addEventListener('click',function () {
|
||||||
|
if (window.document.body.getAttribute("data-theme") != "dark") {
|
||||||
|
if (window.REMARK42) {
|
||||||
|
window.REMARK42.changeTheme('dark');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (window.REMARK42) {
|
||||||
|
window.REMARK42.changeTheme('light');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
2
post.hbs
2
post.hbs
@ -89,7 +89,7 @@
|
|||||||
<p>Comments are disabled for post previews</p>
|
<p>Comments are disabled for post previews</p>
|
||||||
{{else}}
|
{{else}}
|
||||||
{{!-- Comments --}}
|
{{!-- Comments --}}
|
||||||
|
<div id="remark42"></div>
|
||||||
{{/is}}
|
{{/is}}
|
||||||
</div>
|
</div>
|
||||||
<div class="container mx-auto">
|
<div class="container mx-auto">
|
||||||
|
Loading…
Reference in New Issue
Block a user