This commit is contained in:
xaoxuu 2022-10-29 17:23:32 +08:00
parent 33243bb13e
commit 63ceaf5352
9 changed files with 56 additions and 43 deletions

View File

@ -1,5 +1,5 @@
--- ---
name: Any Question name: Any Question【问题反馈】
about: 主题使用方面任何问题或建议 about: 主题使用方面任何问题或建议
title: '' title: ''
labels: '' labels: ''

View File

@ -1,5 +1,5 @@
--- ---
name: Article Share name: Article Share【文章分享】
about: 与Stellar相关的文章分享 about: 与Stellar相关的文章分享
title: '[分享] ' title: '[分享] '
labels: '教程' labels: '教程'

View File

@ -45,6 +45,7 @@ function og_args() {
%> %>
<head> <head>
<%- meta_generator() %> <%- meta_generator() %>
<meta name="hexo-theme" content="<%- stellar_info('tree') %>">
<meta charset="utf-8"> <meta charset="utf-8">
<%- generate_robots() %> <%- generate_robots() %>
@ -60,6 +61,7 @@ function og_args() {
<meta name="apple-mobile-web-app-capable" content="yes"> <meta name="apple-mobile-web-app-capable" content="yes">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="theme-color" content="#f8f8f8"> <meta name="theme-color" content="#f8f8f8">
<title><%- generate_title() %></title> <title><%- generate_title() %></title>
<% if (theme.open_graph && theme.open_graph.enable) { %> <% if (theme.open_graph && theme.open_graph.enable) { %>

View File

@ -90,6 +90,7 @@
} }
} }
}; };
stellar.version = '<%- theme.stellar.version %>';
stellar.github = 'https://github.com/xaoxuu/hexo-theme-stellar/tree/<%- theme.stellar.version %>'; stellar.github = 'https://github.com/xaoxuu/hexo-theme-stellar/tree/<%- theme.stellar.version %>';
stellar.config = { stellar.config = {
date_suffix: { date_suffix: {

View File

@ -25,7 +25,7 @@ module.exports = hexo => {
warning('caching', '`relative_link` option in Hexo `_config.yml`'); warning('caching', '`relative_link` option in Hexo `_config.yml`');
hexo.config.relative_link = false; hexo.config.relative_link = false;
} }
hexo.config.meta_generator = false; // hexo.config.meta_generator = false;
// merge data // merge data
const data = hexo.locals.get('data'); const data = hexo.locals.get('data');

View File

@ -42,9 +42,6 @@ hexo.extend.tag.register('friends', function(args) {
} }
el += '<div class="group-body">'; el += '<div class="group-body">';
const items = links[args.group] || []; const items = links[args.group] || [];
console.log('links', links);
console.log('group', args.group);
console.log('items', items);
items.forEach((item, i) => { items.forEach((item, i) => {
el += cell(item); el += cell(item);
}); });

View File

@ -36,14 +36,14 @@ function layoutNodeContent(content) {
function postTimeline(args, content) { function postTimeline(args, content) {
args = hexo.args.map(args, ['api', 'user', 'type', 'limit']); args = hexo.args.map(args, ['api', 'user', 'type', 'limit', 'hide']);
var el = ''; var el = '';
if (!args.type) { if (!args.type) {
args.type = 'timeline'; args.type = 'timeline';
} }
if (args.api && args.api.length > 0) { if (args.api && args.api.length > 0) {
el += '<div class="tag-plugin timeline stellar-' + args.type + '-api"'; el += '<div class="tag-plugin timeline stellar-' + args.type + '-api"';
el += ' ' + hexo.args.joinTags(args, ['api', 'user', 'limit']).join(' '); el += ' ' + hexo.args.joinTags(args, ['api', 'user', 'limit', 'hide']).join(' ');
el += '>'; el += '>';
} else { } else {
el += '<div class="tag-plugin timeline">'; el += '<div class="tag-plugin timeline">';

View File

@ -1,4 +1,4 @@
console.log('hexo-theme-stellar:\n' + stellar.github); console.log('\n' + '%c Stellar v' + stellar.version + ' %c\n' + stellar.github + '\n', 'color:#e8fafe;background:#03c7fa;padding:8px;border-radius:4px', 'margin-top:8px');
// utils // utils
const util = { const util = {

View File

@ -57,12 +57,18 @@ const StellarTimeline = {
$(el).append('<div class="loading-wrap"><svg xmlns="http://www.w3.org/2000/svg" width="2rem" height="2rem" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"><g fill="none" stroke="currentColor" stroke-linecap="round" stroke-width="2"><path stroke-dasharray="60" stroke-dashoffset="60" stroke-opacity=".3" d="M12 3C16.9706 3 21 7.02944 21 12C21 16.9706 16.9706 21 12 21C7.02944 21 3 16.9706 3 12C3 7.02944 7.02944 3 12 3Z"><animate fill="freeze" attributeName="stroke-dashoffset" dur="1.3s" values="60;0"/></path><path stroke-dasharray="15" stroke-dashoffset="15" d="M12 3C16.9706 3 21 7.02944 21 12"><animate fill="freeze" attributeName="stroke-dashoffset" dur="0.3s" values="15;0"/><animateTransform attributeName="transform" dur="1.5s" repeatCount="indefinite" type="rotate" values="0 12 12;360 12 12"/></path></g></svg></div>'); $(el).append('<div class="loading-wrap"><svg xmlns="http://www.w3.org/2000/svg" width="2rem" height="2rem" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"><g fill="none" stroke="currentColor" stroke-linecap="round" stroke-width="2"><path stroke-dasharray="60" stroke-dashoffset="60" stroke-opacity=".3" d="M12 3C16.9706 3 21 7.02944 21 12C21 16.9706 16.9706 21 12 21C7.02944 21 3 16.9706 3 12C3 7.02944 7.02944 3 12 3Z"><animate fill="freeze" attributeName="stroke-dashoffset" dur="1.3s" values="60;0"/></path><path stroke-dasharray="15" stroke-dashoffset="15" d="M12 3C16.9706 3 21 7.02944 21 12"><animate fill="freeze" attributeName="stroke-dashoffset" dur="0.3s" values="15;0"/><animateTransform attributeName="transform" dur="1.5s" repeatCount="indefinite" type="rotate" values="0 12 12;360 12 12"/></path></g></svg></div>');
StellarTimeline.requestAPI(cfg.api, function(data) { StellarTimeline.requestAPI(cfg.api, function(data) {
$(el).find('.loading-wrap').remove(); $(el).find('.loading-wrap').remove();
const query = new URL(cfg.api).search;
const arr = data.content || data; const arr = data.content || data;
var users = []; var users = [];
const filter = el.getAttribute('user'); const filter = el.getAttribute('user');
if (filter && filter.length > 0) { if (filter && filter.length > 0) {
users = filter.split(","); users = filter.split(",");
} }
var hide = [];
const hideStr = el.getAttribute('hide');
if (hideStr && hideStr.length > 0) {
hide = hideStr.split(",");
}
arr.forEach((item, i) => { arr.forEach((item, i) => {
if (item.user && item.user.login && users.length > 0) { if (item.user && item.user.login && users.length > 0) {
if (!users.includes(item.user.login)) { if (!users.includes(item.user.login)) {
@ -81,20 +87,25 @@ const StellarTimeline = {
cell += '<p>' + date.toString().replace(/\sGMT([^.]*)/i, "") + '</p>'; cell += '<p>' + date.toString().replace(/\sGMT([^.]*)/i, "") + '</p>';
cell += '</div>'; cell += '</div>';
cell += '<div class="body">'; cell += '<div class="body">';
if (!hide.includes('title')) {
cell += '<p class="title">'; cell += '<p class="title">';
cell += '<a href="' + item.html_url + '" target="_blank" rel="external nofollow noopener noreferrer">'; cell += '<a href="' + item.html_url + '" target="_blank" rel="external nofollow noopener noreferrer">';
cell += item.title || item.name || item.tag_name; cell += item.title || item.name || item.tag_name;
cell += '</a>'; cell += '</a>';
cell += '</p>'; cell += '</p>';
}
cell += marked.parse(item.body); cell += marked.parse(item.body);
if (!hide.includes('footer')) {
cell += '<div class="footer">'; cell += '<div class="footer">';
cell += '<div class="flex left">'; cell += '<div class="flex left">';
if (item.labels) { if (item.labels) {
item.labels.forEach((label, i) => { item.labels.forEach((label, i) => {
if (!query || !query.includes(encodeURI(label.name))) {
cell += '<div class="item label ' + label.name + '" style="background:#' + label.color + '18;border-color:#' + label.color + '36">'; cell += '<div class="item label ' + label.name + '" style="background:#' + label.color + '18;border-color:#' + label.color + '36">';
cell += '<span>' + label.name + '</span>'; cell += '<span>' + label.name + '</span>';
cell += '</div>'; cell += '</div>';
}
}); });
} else if (item.zipball_url) { } else if (item.zipball_url) {
cell += '<a class="item download" href="' + item.zipball_url + '" target="_blank" rel="external nofollow noopener noreferrer">'; cell += '<a class="item download" href="' + item.zipball_url + '" target="_blank" rel="external nofollow noopener noreferrer">';
@ -121,6 +132,8 @@ const StellarTimeline = {
cell += '</div>'; cell += '</div>';
cell += '</div>'; cell += '</div>';
}
cell += '</div>'; cell += '</div>';
cell += '</div>'; cell += '</div>';
$(el).append(cell); $(el).append(cell);