hexo-theme-stellar/layout/_partial/main/article/article_footer.ejs

103 lines
4.0 KiB
Plaintext
Raw Normal View History

2021-02-19 23:33:19 +08:00
<%
function layoutDiv() {
2021-02-25 13:12:04 +08:00
if (page.layout == 'wiki' && !page.references) {
return '';
}
2021-02-25 00:05:23 +08:00
let el = '';
2021-07-13 22:25:24 +08:00
el += '<div class="article-footer reveal fs14">';
2021-02-19 23:33:19 +08:00
if (page.references && page.references.length > 0) {
2021-02-25 00:05:23 +08:00
el += '<section id="references">';
el += '<div class="header">';
el += '<span>' + __('meta.references') + '</span>';
el += '</div>';
el += '<div class="body"><ul>';
2021-02-19 23:33:19 +08:00
page.references.forEach((item, i) => {
2021-02-25 00:05:23 +08:00
el += '<li class="post-title">';
2021-02-27 20:08:36 +08:00
el += '<a href="' + item.url + '"';
if (item.url.includes('://')) {
el += ' target="_blank" rel="external nofollow noopener noreferrer">';
} else {
el += ' rel="noopener noreferrer">';
}
2021-02-25 20:49:43 +08:00
el += item.title || item.url;
2021-02-25 00:05:23 +08:00
el += '</a>';
el += '</li>';
2021-02-19 23:33:19 +08:00
});
2021-02-25 00:05:23 +08:00
el += '</ul></div>';
el += '</section>';
2021-02-19 23:33:19 +08:00
}
2021-02-25 00:05:23 +08:00
2021-02-25 13:12:04 +08:00
if (page.layout == 'post') {
if (theme.article.license && page.license != false) {
el += '<section id="license">';
el += '<div class="header">';
el += '<span>' + __('meta.license') + '</span>';
el += '</div>';
el += '<div class="body">';
el += markdown(page.license || theme.article.license);
el += '</div>';
el += '</section>';
}
2021-02-25 00:05:23 +08:00
2021-02-25 13:12:04 +08:00
if (theme.article.share && page.share != false) {
el += '<section id="share">';
el += '<div class="header">';
el += '<span>' + __('meta.share') + '</span>';
el += '</div>';
el += '<div class="body">';
el += '<div class="link"><input class="copy-area" readonly="true" id="copy-link" value="' + page.permalink + '" /></div>';
2021-03-08 15:26:52 +08:00
el += '<div class="social-wrap dis-select">';
2021-02-25 13:12:04 +08:00
theme.article.share.forEach((item, i) => {
if (['wechat', 'weibo', 'email', 'link'].includes(item)) {
2021-02-27 20:08:36 +08:00
el += '<a class="social share-item ' + item + '"';
if (item == 'weibo') {
el += ' target="_blank" rel="external nofollow noopener noreferrer"';
}
2021-02-25 13:12:04 +08:00
if (item == 'wechat') {
2021-02-27 20:08:36 +08:00
el += ' onclick="util.toggle(&quot;qrcode-wechat&quot)"';
2021-02-25 13:12:04 +08:00
} else if (item == 'weibo') {
2021-02-26 20:02:32 +08:00
el += ' href="https://service.weibo.com/share/share.php?url=' + page.permalink;
2021-02-25 13:12:04 +08:00
el += '&title=' + (page.seo_title || page.title) + ' - ' + config.title;
if (page.latyout == 'post' && page.cover) {
el += '&pics=' + page.cover;
} else if (page.latyout == 'wiki' && page.logo && page.logo.src) {
el += '&pics=' + page.logo.src;
}
el += '&summary=' + truncate(page.description || strip_html(page.excerpt || page.content), {length: 120});
el += '"';
} else if (item == 'email') {
el += ' href="mailto:?subject=' + (page.title || page.seo_title) + ' - ' + config.title + '&amp;'
el += 'body=' + page.permalink + '"';
} else if (item == 'link') {
2021-02-27 20:08:36 +08:00
el += ' onclick="util.copy(&quot;copy-link&quot;, &quot;' + __('message.copied') + '&quot;)"';
2021-02-25 13:12:04 +08:00
}
el += '>';
if (item == 'wechat') {
2021-03-08 01:41:59 +08:00
el += '<img src="https://cdn.jsdelivr.net/gh/cdn-x/placeholder@1.0.1/social/b32ef3da1162a.svg"/>';
2021-02-25 13:12:04 +08:00
} else if (item == 'weibo') {
2021-03-08 01:41:59 +08:00
el += '<img src="https://cdn.jsdelivr.net/gh/cdn-x/placeholder@1.0.1/social/80c07e4dbb303.svg"/>';
2021-02-25 13:12:04 +08:00
} else if (item == 'email') {
2021-03-08 01:41:59 +08:00
el += '<img src="https://cdn.jsdelivr.net/gh/cdn-x/placeholder@1.0.1/social/a1b00e20f425d.svg"/>';
2021-02-25 13:12:04 +08:00
} else if (item == 'link') {
2021-03-08 01:41:59 +08:00
el += '<img src="https://cdn.jsdelivr.net/gh/cdn-x/placeholder@1.0.1/social/8411ed322ced6.svg"/>';
2021-02-25 13:12:04 +08:00
}
el += '</a>';
2021-02-25 00:05:23 +08:00
}
2021-02-25 13:12:04 +08:00
});
el += '</div>';
if (theme.article.share.includes('wechat')) {
2021-03-08 15:26:52 +08:00
el += '<div class="qrcode" id="qrcode-wechat" style="visibility:hidden;height:0">';
el += '<img src="https://api.qrserver.com/v1/create-qr-code/?size=256x256&data=' + url + '"/>';
2021-02-25 13:12:04 +08:00
el += '</div>';
2021-02-25 00:05:23 +08:00
}
2021-02-25 13:12:04 +08:00
el += '</div>';
el += '</section>';
}
2021-02-25 00:05:23 +08:00
}
el += '</div>';
return el;
2021-02-19 23:33:19 +08:00
}
%>
<%- layoutDiv(); %>