115 lines
4.3 KiB
Plaintext
115 lines
4.3 KiB
Plaintext
<%
|
|
function layoutDiv() {
|
|
var el = '';
|
|
var item = [];
|
|
if (page.references && page.references.length > 0) {
|
|
item.push('references');
|
|
}
|
|
if (page.layout !== 'wiki') {
|
|
if (theme.article.license && theme.article.license.length > 0) {
|
|
item.push('license');
|
|
}
|
|
if (theme.article.share && theme.article.share.length > 0) {
|
|
item.push('share');
|
|
}
|
|
}
|
|
if (item.length === 0) {
|
|
return el;
|
|
}
|
|
el += '<div class="article-footer reveal fs14">';
|
|
if (page.references && page.references.length > 0) {
|
|
el += '<section id="references">';
|
|
el += '<div class="header">';
|
|
el += '<span>' + __('meta.references') + '</span>';
|
|
el += '</div>';
|
|
el += '<div class="body"><ul>';
|
|
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>';
|
|
});
|
|
el += '</ul></div>';
|
|
el += '</section>';
|
|
}
|
|
|
|
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>';
|
|
}
|
|
|
|
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>';
|
|
el += '<div class="social-wrap dis-select">';
|
|
theme.article.share.forEach((item, i) => {
|
|
if (['wechat', 'weibo', 'email', 'link'].includes(item)) {
|
|
el += '<a class="social share-item ' + item + '"';
|
|
if (item == 'weibo') {
|
|
el += ' target="_blank" rel="external nofollow noopener noreferrer"';
|
|
}
|
|
if (item == 'wechat') {
|
|
el += ' onclick="util.toggle("qrcode-wechat")"';
|
|
} else if (item == 'weibo') {
|
|
el += ' href="https://service.weibo.com/share/share.php?url=' + page.permalink;
|
|
el += '&title=' + (page.seo_title || (page.title + ' - ' + config.title));
|
|
if (page.layout == 'post' && page.cover) {
|
|
el += '&pics=' + page.cover;
|
|
} else if (page.layout == '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 + ' - ' + config.title) || page.seo_title) + '&'
|
|
el += 'body=' + page.permalink + '"';
|
|
} else if (item == 'link') {
|
|
el += ' onclick="util.copy("copy-link", "' + __('message.copied') + '")"';
|
|
}
|
|
el += '>';
|
|
if (item == 'wechat') {
|
|
el += '<img src="https://gcore.jsdelivr.net/gh/cdn-x/placeholder@1.0.4/social/b32ef3da1162a.svg"/>';
|
|
} else if (item == 'weibo') {
|
|
el += '<img src="https://gcore.jsdelivr.net/gh/cdn-x/placeholder@1.0.4/social/80c07e4dbb303.svg"/>';
|
|
} else if (item == 'email') {
|
|
el += '<img src="https://gcore.jsdelivr.net/gh/cdn-x/placeholder@1.0.4/social/a1b00e20f425d.svg"/>';
|
|
} else if (item == 'link') {
|
|
el += '<img src="https://gcore.jsdelivr.net/gh/cdn-x/placeholder@1.0.4/social/8411ed322ced6.svg"/>';
|
|
}
|
|
el += '</a>';
|
|
}
|
|
});
|
|
el += '</div>';
|
|
if (theme.article.share.includes('wechat')) {
|
|
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=' + page.permalink + '"/>';
|
|
el += '</div>';
|
|
}
|
|
el += '</div>';
|
|
el += '</section>';
|
|
}
|
|
}
|
|
|
|
el += '</div>';
|
|
return el;
|
|
}
|
|
%>
|
|
<%- layoutDiv(); %>
|