waline 3.x (#396)
This commit is contained in:
parent
dca305c5c3
commit
575fc5fef0
|
@ -204,8 +204,9 @@ comments:
|
|||
# Waline
|
||||
# https://waline.js.org/
|
||||
waline:
|
||||
js: https://unpkg.com/@waline/client@2.14.1/dist/waline.js
|
||||
css: https://unpkg.com/@waline/client@2.14.1/dist/waline.css
|
||||
js: https://gcore.jsdelivr.net/npm/@waline/client@3.1.2/dist/waline.js
|
||||
css: https://gcore.jsdelivr.net/npm/@waline/client@3.1.2/dist/waline.css
|
||||
meta_css: https://gcore.jsdelivr.net/npm/@waline/client@3.1.2/dist/waline-meta.css
|
||||
# Waline server address url, you should set this to your own link
|
||||
serverURL:
|
||||
# If false, comment count will only be displayed in post page, not in home page
|
||||
|
|
|
@ -1,14 +1,19 @@
|
|||
<script>
|
||||
<script type="module">
|
||||
import { init } from '<%- theme.comments.waline.js %>'
|
||||
|
||||
function load_comment(){
|
||||
if(!document.getElementById("waline_container"))return;
|
||||
|
||||
utils.css('<%- theme.comments.waline.css %>');
|
||||
utils.js('<%- theme.comments.waline.js %>', {defer:true}).then(function () {
|
||||
utils.css('<%- theme.comments.waline.meta_css %>');
|
||||
|
||||
const el = document.getElementById("waline_container");
|
||||
var path = el.getAttribute('comment_id');
|
||||
if (!path) {
|
||||
path = decodeURI(window.location.pathname);
|
||||
}
|
||||
Waline.init(Object.assign(<%- JSON.stringify(theme.comments.waline) %>, {
|
||||
|
||||
const waline = init(Object.assign(<%- JSON.stringify(theme.comments.waline) %>, {
|
||||
el: '#waline_container',
|
||||
path: path,
|
||||
<% if(!!theme.comments.waline.imageUploader?.api){ %>
|
||||
|
@ -29,7 +34,7 @@
|
|||
},
|
||||
<% } %>
|
||||
}));
|
||||
});
|
||||
|
||||
}
|
||||
window.addEventListener('DOMContentLoaded', (event) => {
|
||||
load_comment();
|
||||
|
|
Loading…
Reference in New Issue