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