2021-02-19 23:33:19 +08:00
|
|
|
<%
|
|
|
|
function layoutDiv() {
|
2021-07-14 13:21:58 +08:00
|
|
|
var el = '';
|
|
|
|
var item = [];
|
2023-12-06 13:22:50 +08:00
|
|
|
if (page.references?.length > 0) {
|
2021-07-14 13:21:58 +08:00
|
|
|
item.push('references');
|
|
|
|
}
|
2023-12-06 13:22:50 +08:00
|
|
|
if (theme.article.license?.length > 0) {
|
|
|
|
item.push('license');
|
|
|
|
}
|
|
|
|
if (theme.article.share?.length > 0) {
|
|
|
|
item.push('share');
|
2021-07-14 13:21:58 +08:00
|
|
|
}
|
|
|
|
if (item.length === 0) {
|
|
|
|
return el;
|
2021-02-25 13:12:04 +08:00
|
|
|
}
|
2021-07-13 22:25:24 +08:00
|
|
|
el += '<div class="article-footer reveal fs14">';
|
2023-12-06 13:22:50 +08:00
|
|
|
if (page.references?.length > 0) {
|
|
|
|
function refList() {
|
|
|
|
var el = '';
|
|
|
|
page.references.forEach((item, i) => {
|
|
|
|
el += '<li class="post-title">';
|
|
|
|
el += '<a href="' + item.url + '"';
|
|
|
|
if (item.url.includes('://')) {
|
|
|
|
el += ' target="_blank" rel="external nofollow noopener noreferrer">';
|
|
|
|
} else {
|
|
|
|
el += ' rel="noopener noreferrer">';
|
|
|
|
}
|
|
|
|
el += item.title || item.url;
|
|
|
|
el += '</a>';
|
|
|
|
el += '</li>';
|
|
|
|
});
|
|
|
|
return el;
|
|
|
|
}
|
|
|
|
el += `
|
|
|
|
<section id="references">
|
|
|
|
<div class="header"><span>${__('meta.references')}</span></div>
|
|
|
|
<div class="body">
|
|
|
|
<ul>${refList()}</ul>
|
|
|
|
</div>
|
|
|
|
</section>
|
|
|
|
`
|
2021-02-19 23:33:19 +08:00
|
|
|
}
|
2021-02-25 00:05:23 +08:00
|
|
|
|
2023-12-06 13:22:50 +08:00
|
|
|
var license = ''
|
2021-02-25 13:12:04 +08:00
|
|
|
if (page.layout == 'post') {
|
2023-12-06 13:22:50 +08:00
|
|
|
if (theme.article.license && (page.license != false)) {
|
|
|
|
license = markdown(page.license || theme.article.license)
|
2021-02-25 13:12:04 +08:00
|
|
|
}
|
2023-12-06 13:22:50 +08:00
|
|
|
} else if (page.layout == 'wiki' && page.wiki) {
|
|
|
|
let proj = theme.wiki.tree[page.wiki]
|
|
|
|
if (page.license != null) {
|
|
|
|
license = markdown(page.license || theme.article.license)
|
|
|
|
} else if (proj?.license != null) {
|
|
|
|
license = markdown(proj.license || theme.article.license)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (license.length > 0) {
|
|
|
|
el += `
|
|
|
|
<section id="license">
|
|
|
|
<div class="header"><span>${__('meta.license')}</span></div>
|
|
|
|
<div class="body">${license}</div>
|
|
|
|
</section>
|
|
|
|
`
|
|
|
|
}
|
2021-02-25 00:05:23 +08:00
|
|
|
|
2023-12-06 13:22:50 +08:00
|
|
|
var showSharePlugin = false
|
|
|
|
if (page.layout == 'post') {
|
|
|
|
showSharePlugin = page.share != false
|
|
|
|
} else if (page.layout == 'wiki' && page.wiki) {
|
|
|
|
let proj = theme.wiki.tree[page.wiki]
|
|
|
|
if (page.share != null) {
|
|
|
|
showSharePlugin = page.share == true
|
|
|
|
} else if (proj != null) {
|
|
|
|
showSharePlugin = proj.share == true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (theme.article.share && showSharePlugin) {
|
|
|
|
function socialButtons() {
|
|
|
|
var el = ''
|
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("qrcode-wechat")"';
|
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;
|
2022-11-06 19:46:47 +08:00
|
|
|
el += '&title=' + (page.seo_title || (page.title + ' - ' + config.title));
|
2022-11-28 11:11:33 +08:00
|
|
|
if (page.layout == 'post' && page.cover) {
|
2021-02-25 13:12:04 +08:00
|
|
|
el += '&pics=' + page.cover;
|
2022-11-28 11:11:33 +08:00
|
|
|
} else if (page.layout == 'wiki' && page.logo && page.logo.src) {
|
2021-02-25 13:12:04 +08:00
|
|
|
el += '&pics=' + page.logo.src;
|
|
|
|
}
|
|
|
|
el += '&summary=' + truncate(page.description || strip_html(page.excerpt || page.content), {length: 120});
|
|
|
|
el += '"';
|
|
|
|
} else if (item == 'email') {
|
2022-11-06 19:46:47 +08:00
|
|
|
el += ' href="mailto:?subject=' + ((page.title + ' - ' + config.title) || page.seo_title) + '&'
|
2021-02-25 13:12:04 +08:00
|
|
|
el += 'body=' + page.permalink + '"';
|
|
|
|
} else if (item == 'link') {
|
2021-02-27 20:08:36 +08:00
|
|
|
el += ' onclick="util.copy("copy-link", "' + __('message.copied') + '")"';
|
2021-02-25 13:12:04 +08:00
|
|
|
}
|
|
|
|
el += '>';
|
|
|
|
if (item == 'wechat') {
|
2022-12-20 00:09:34 +08:00
|
|
|
el += '<img src="https://gcore.jsdelivr.net/gh/cdn-x/placeholder@1.0.4/social/b32ef3da1162a.svg"/>';
|
2021-02-25 13:12:04 +08:00
|
|
|
} else if (item == 'weibo') {
|
2022-12-20 00:09:34 +08:00
|
|
|
el += '<img src="https://gcore.jsdelivr.net/gh/cdn-x/placeholder@1.0.4/social/80c07e4dbb303.svg"/>';
|
2021-02-25 13:12:04 +08:00
|
|
|
} else if (item == 'email') {
|
2022-12-20 00:09:34 +08:00
|
|
|
el += '<img src="https://gcore.jsdelivr.net/gh/cdn-x/placeholder@1.0.4/social/a1b00e20f425d.svg"/>';
|
2021-02-25 13:12:04 +08:00
|
|
|
} else if (item == 'link') {
|
2022-12-20 00:09:34 +08:00
|
|
|
el += '<img src="https://gcore.jsdelivr.net/gh/cdn-x/placeholder@1.0.4/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
|
|
|
});
|
2023-12-06 13:22:50 +08:00
|
|
|
return el;
|
|
|
|
}
|
|
|
|
function qrcode() {
|
2021-02-25 13:12:04 +08:00
|
|
|
if (theme.article.share.includes('wechat')) {
|
2023-12-06 13:22:50 +08:00
|
|
|
return `
|
|
|
|
<div class="qrcode" id="qrcode-wechat" style="visibility:hidden;height:0">
|
|
|
|
<img src="https://api.qrserver.com/v1/create-qr-code/?size=256x256&data=${page.permalink}"/>
|
|
|
|
</div>
|
|
|
|
`
|
|
|
|
} else {
|
|
|
|
return ''
|
2021-02-25 00:05:23 +08:00
|
|
|
}
|
2021-02-25 13:12:04 +08:00
|
|
|
}
|
2023-12-06 13:22:50 +08:00
|
|
|
el += `
|
|
|
|
<section id="share">
|
|
|
|
<div class="header"><span>${__('meta.share')}</span></div>
|
|
|
|
<div class="body">
|
|
|
|
<div class="link"><input class="copy-area" readonly="true" id="copy-link" value="${page.permalink}" /></div>
|
|
|
|
<div class="social-wrap dis-select">${socialButtons()}</div>
|
|
|
|
${qrcode()}
|
|
|
|
</div>
|
|
|
|
</section>
|
|
|
|
`
|
2021-02-25 00:05:23 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
el += '</div>';
|
|
|
|
return el;
|
2021-02-19 23:33:19 +08:00
|
|
|
}
|
|
|
|
%>
|
|
|
|
<%- layoutDiv(); %>
|