hexo-theme-stellar/layout/_partial/plugins/comments/giscus/layout.ejs

26 lines
579 B
Plaintext
Raw Normal View History

2022-08-28 19:54:34 +08:00
<%
function layoutDiv() {
var el = '';
2022-11-14 00:28:48 +08:00
const cmt = page.cmt;
2024-02-07 16:21:19 +08:00
if (cmt?.service?.length > 0) {
2022-11-14 00:28:48 +08:00
const name = cmt.service;
2024-02-07 16:21:19 +08:00
var body = cmt[name];
if (theme.style.prefers_theme != 'auto' && body['data-theme'] == 'preferred_color_scheme') {
body['data-theme'] = theme.style.prefers_theme
}
2022-11-14 00:28:48 +08:00
el += '<div id="' + name + '"';
for (let key of Object.keys(body)) {
if (body[key] !== null) {
el += ' ' + key + '="' + body[key] + '"';
}
2022-08-28 19:54:34 +08:00
}
2022-11-14 00:28:48 +08:00
el += '></div>';
2022-08-28 19:54:34 +08:00
}
return el;
}
%>
2024-01-19 13:51:55 +08:00
<%- icon('default:loading') %>
2022-08-28 19:54:34 +08:00
<%- layoutDiv() %>