优化heti配置

This commit is contained in:
xaoxuu 2022-03-02 14:50:45 +08:00
parent 724d23ca5c
commit 65ce616542
5 changed files with 27 additions and 6 deletions

View File

@ -40,7 +40,11 @@ function div_default() {
el += '</h2>'; el += '</h2>';
// 摘要 // 摘要
el += '<div class="excerpt heti">'; el += '<div class="excerpt';
if (theme.plugins.heti && theme.plugins.heti.enable) {
el += ' heti';
}
el += '">';
el += '<p>'; el += '<p>';
if (post.excerpt) { if (post.excerpt) {
el += strip_html(post.excerpt); el += strip_html(post.excerpt);

View File

@ -124,6 +124,9 @@
if ('<%- theme.plugins.fancybox.enable %>' == 'true') { if ('<%- theme.plugins.fancybox.enable %>' == 'true') {
stellar.plugins.fancybox = Object.assign(<%- JSON.stringify(theme.plugins.fancybox) %>); stellar.plugins.fancybox = Object.assign(<%- JSON.stringify(theme.plugins.fancybox) %>);
} }
if ('<%- theme.plugins.heti.enable %>' == 'true') {
stellar.plugins.heti = Object.assign(<%- JSON.stringify(theme.plugins.heti) %>);
}
</script> </script>
<!-- required --> <!-- required -->

View File

@ -13,10 +13,14 @@ function layoutTitle() {
return ''; return '';
} }
} }
let post = page;
let heti = '';
if (theme.plugins.heti && theme.plugins.heti.enable) {
heti = ' heti';
}
%> %>
<% let post = page; %>
<%- partial('_partial/main/navbar/breadcrumb') %> <%- partial('_partial/main/navbar/breadcrumb') %>
<article class='content heti md <%- post.layout %><%- post.indent ? ' indent' : '' %><%- scrollreveal() %>'> <article class='content<%- heti %> md <%- post.layout %><%- post.indent ? ' indent' : '' %><%- scrollreveal() %>'>
<%- layoutTitle() %> <%- layoutTitle() %>
<%- post.content %> <%- post.content %>
<%- partial('_partial/main/article/article_footer') %> <%- partial('_partial/main/article/article_footer') %>

View File

@ -296,3 +296,13 @@ if (stellar.plugins.fancybox) {
}) })
} }
} }
// heti
if (stellar.plugins.heti) {
stellar.loadCSS(stellar.plugins.heti.css);
stellar.loadScript(stellar.plugins.heti.js, { defer: true }).then(function () {
const heti = new Heti('.heti p');
heti.autoSpacing();
stellar.plugins.heti.enable = false;
});
}