update
This commit is contained in:
parent
a8649e04ff
commit
24ce3ed02c
|
@ -5,6 +5,7 @@
|
||||||
hexo.on('generateBefore', () => {
|
hexo.on('generateBefore', () => {
|
||||||
// Merge config.
|
// Merge config.
|
||||||
require('./lib/config')(hexo);
|
require('./lib/config')(hexo);
|
||||||
|
require('./lib/utils')(hexo);
|
||||||
});
|
});
|
||||||
|
|
||||||
hexo.on('ready', () => {
|
hexo.on('ready', () => {
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
module.exports = hexo => {
|
module.exports = hexo => {
|
||||||
|
|
||||||
const { cache, language_switcher } = hexo.theme.config;
|
const { cache, language_switcher } = hexo.theme.config;
|
||||||
const warning = function(...args) {
|
const warning = function(...args) {
|
||||||
hexo.log.warn(`Since ${args[0]} is turned on, the ${args[1]} is disabled to avoid potential hazards.`);
|
hexo.log.warn(`Since ${args[0]} is turned on, the ${args[1]} is disabled to avoid potential hazards.`);
|
||||||
|
|
|
@ -0,0 +1,73 @@
|
||||||
|
/**
|
||||||
|
* utils.js v1 | https://github.com/xaoxuu/hexo-theme-stellar/
|
||||||
|
*/
|
||||||
|
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
module.exports = hexo => {
|
||||||
|
hexo.args = {
|
||||||
|
map: (args, keys, others) => {
|
||||||
|
if (Array.isArray(args) == false) {
|
||||||
|
return args;
|
||||||
|
}
|
||||||
|
var map = {others: Array()};
|
||||||
|
args.forEach((arg, i) => {
|
||||||
|
let kv = arg.trim();
|
||||||
|
if (kv.includes('://') && kv.split(':').length == 2) {
|
||||||
|
// 纯 url
|
||||||
|
map.others.push(kv);
|
||||||
|
} else {
|
||||||
|
kv = kv.split(':');
|
||||||
|
if (kv.length > 1) {
|
||||||
|
if (keys.includes(kv[0]) == true) {
|
||||||
|
map[kv.shift()] = kv.join(':');
|
||||||
|
} else {
|
||||||
|
map.others.push(kv.join(':'));
|
||||||
|
}
|
||||||
|
} else if (kv.length == 1) {
|
||||||
|
map.others.push(kv[0]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// 解析不带 key 的参数
|
||||||
|
if (others && others.length > 0 && map.others.length > 0) {
|
||||||
|
if (Array.isArray(others) == false) {
|
||||||
|
others = [others];
|
||||||
|
}
|
||||||
|
others.forEach((arg, i) => {
|
||||||
|
map[arg] = map.others.shift();
|
||||||
|
});
|
||||||
|
// 最后一段合并到最后一个参数中
|
||||||
|
if (map.others.length > 0) {
|
||||||
|
map[others[others.length-1]] += ' ' + map.others.join(' ');
|
||||||
|
map.others = [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
},
|
||||||
|
joinTags: (args, keys) => {
|
||||||
|
if (Array.isArray(keys) == false) {
|
||||||
|
keys = [keys];
|
||||||
|
}
|
||||||
|
var ret = [];
|
||||||
|
keys.forEach((key, i) => {
|
||||||
|
if (args[key] && args[key].length > 0) {
|
||||||
|
ret.push(key + '="' + args[key] + '"');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return ret;
|
||||||
|
},
|
||||||
|
joinURLParams: (args, keys) => {
|
||||||
|
if (Array.isArray(keys) == false) {
|
||||||
|
keys = [keys];
|
||||||
|
}
|
||||||
|
var ret = [];
|
||||||
|
keys.forEach((key, i) => {
|
||||||
|
if (args[key] && args[key].length > 0) {
|
||||||
|
ret.push(key + '=' + args[key]);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return ret.join('&');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
|
@ -1,7 +1,7 @@
|
||||||
/**
|
/**
|
||||||
* about.js v1 | https://github.com/xaoxuu/hexo-theme-stellar/
|
* about.js v1 | https://github.com/xaoxuu/hexo-theme-stellar/
|
||||||
* 格式与官方标签插件一致使用空格分隔,中括号内的是可选参数(中括号不需要写出来)
|
* 格式与官方标签插件一致使用空格分隔,中括号内的是可选参数(中括号不需要写出来)
|
||||||
*
|
*
|
||||||
* {% about [avatar:xxx] [height:80px] %}
|
* {% about [avatar:xxx] [height:80px] %}
|
||||||
* title / body
|
* title / body
|
||||||
* {% endabout %}
|
* {% endabout %}
|
||||||
|
@ -9,10 +9,8 @@
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const { ArgsMap } = require('./utils');
|
|
||||||
|
|
||||||
hexo.extend.tag.register('about', function(args, content) {
|
hexo.extend.tag.register('about', function(args, content) {
|
||||||
args = ArgsMap(args, ['avatar', 'height']);
|
args = hexo.args.map(args, ['avatar', 'height']);
|
||||||
var rows = hexo.render.renderSync({text: content, engine: 'markdown'}).split('\n');
|
var rows = hexo.render.renderSync({text: content, engine: 'markdown'}).split('\n');
|
||||||
var el = '';
|
var el = '';
|
||||||
// wrapper
|
// wrapper
|
||||||
|
@ -33,14 +31,14 @@ hexo.extend.tag.register('about', function(args, content) {
|
||||||
el += rows.shift();
|
el += rows.shift();
|
||||||
// el += '</div>';
|
// el += '</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
el += '</div>';
|
el += '</div>';
|
||||||
|
|
||||||
// content
|
// content
|
||||||
el += '<div class="about-body">';
|
el += '<div class="about-body">';
|
||||||
el += rows.join('');
|
el += rows.join('');
|
||||||
el += '</div>';
|
el += '</div>';
|
||||||
|
|
||||||
el += '</div>';
|
el += '</div>';
|
||||||
return el;
|
return el;
|
||||||
}, {ends: true});
|
}, {ends: true});
|
||||||
|
|
|
@ -2,21 +2,19 @@
|
||||||
* checkbox.js v1 | https://github.com/xaoxuu/hexo-theme-stellar/
|
* checkbox.js v1 | https://github.com/xaoxuu/hexo-theme-stellar/
|
||||||
* radio.js v1 | https://github.com/xaoxuu/hexo-theme-stellar/
|
* radio.js v1 | https://github.com/xaoxuu/hexo-theme-stellar/
|
||||||
* 格式与官方标签插件一致使用空格分隔,中括号内的是可选参数(中括号不需要写出来)
|
* 格式与官方标签插件一致使用空格分隔,中括号内的是可选参数(中括号不需要写出来)
|
||||||
*
|
*
|
||||||
* {% checkbox [checked:false] [color:cyan] [symbol:plus/minus/times] text %}
|
* {% checkbox [checked:false] [color:cyan] [symbol:plus/minus/times] text %}
|
||||||
* {% radio [checked:false] [color:cyan] text %}
|
* {% radio [checked:false] [color:cyan] text %}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const { ArgsMap, ArgsJoinTags } = require('./utils');
|
|
||||||
|
|
||||||
function layoutDiv(args, type) {
|
function layoutDiv(args, type) {
|
||||||
args = ArgsMap(args, ['color', 'checked', 'symbol'], ['text']);
|
args = hexo.args.map(args, ['color', 'checked', 'symbol'], ['text']);
|
||||||
var el = '';
|
var el = '';
|
||||||
// div
|
// div
|
||||||
el += '<div class="tag-plugin checkbox"';
|
el += '<div class="tag-plugin checkbox"';
|
||||||
el += ' ' + ArgsJoinTags(args, ['color', 'symbol']).join(' ');
|
el += ' ' + hexo.args.joinTags(args, ['color', 'symbol']).join(' ');
|
||||||
el += '>';
|
el += '>';
|
||||||
// input
|
// input
|
||||||
el += '<input type="' + type + '"';
|
el += '<input type="' + type + '"';
|
||||||
|
|
|
@ -9,10 +9,8 @@
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const { ArgsMap } = require('./utils');
|
|
||||||
|
|
||||||
hexo.extend.tag.register('copy', function(args) {
|
hexo.extend.tag.register('copy', function(args) {
|
||||||
args = ArgsMap(args, ['width', 'git'], ['text']);
|
args = hexo.args.map(args, ['width', 'git'], ['text']);
|
||||||
if (args == undefined || args.text == undefined) {
|
if (args == undefined || args.text == undefined) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/**
|
/**
|
||||||
* folding.js v1 | https://github.com/xaoxuu/hexo-theme-stellar/
|
* folding.js v1 | https://github.com/xaoxuu/hexo-theme-stellar/
|
||||||
* 格式与官方标签插件一致使用空格分隔,中括号内的是可选参数(中括号不需要写出来)
|
* 格式与官方标签插件一致使用空格分隔,中括号内的是可选参数(中括号不需要写出来)
|
||||||
*
|
*
|
||||||
* {% folding [color:yellow] [codeblock:false] [open:false] title %}
|
* {% folding [color:yellow] [codeblock:false] [open:false] title %}
|
||||||
* body
|
* body
|
||||||
* {% endtable %}
|
* {% endtable %}
|
||||||
|
@ -9,14 +9,12 @@
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const { ArgsMap, ArgsJoinTags } = require('./utils');
|
|
||||||
|
|
||||||
hexo.extend.tag.register('folding', function(args, content) {
|
hexo.extend.tag.register('folding', function(args, content) {
|
||||||
args = ArgsMap(args, ['color', 'codeblock', 'open'], ['title']);
|
args = hexo.args.map(args, ['color', 'codeblock', 'open'], ['title']);
|
||||||
var el = '';
|
var el = '';
|
||||||
// header
|
// header
|
||||||
el += '<details class="tag-plugin"'
|
el += '<details class="tag-plugin"'
|
||||||
el += ' ' + ArgsJoinTags(args, ['color', 'codeblock']).join(' ');
|
el += ' ' + hexo.args.joinTags(args, ['color', 'codeblock']).join(' ');
|
||||||
if (args.open && args.open == 'true') {
|
if (args.open && args.open == 'true') {
|
||||||
el += ' open';
|
el += ' open';
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,10 +7,8 @@
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const { ArgsMap } = require('./utils');
|
|
||||||
|
|
||||||
hexo.extend.tag.register('frame', function(args) {
|
hexo.extend.tag.register('frame', function(args) {
|
||||||
args = ArgsMap(args, ['focus', 'img', 'video'], ['device', 'alt']);
|
args = hexo.args.map(args, ['focus', 'img', 'video'], ['device', 'alt']);
|
||||||
const img = args.img || '';
|
const img = args.img || '';
|
||||||
const video = args.video || '';
|
const video = args.video || '';
|
||||||
const device = args.device || '';
|
const device = args.device || '';
|
||||||
|
|
|
@ -1,16 +1,14 @@
|
||||||
/**
|
/**
|
||||||
* friends.js v1 | https://github.com/xaoxuu/hexo-theme-stellar/
|
* friends.js v1 | https://github.com/xaoxuu/hexo-theme-stellar/
|
||||||
* 格式与官方标签插件一致使用空格分隔,中括号内的是可选参数(中括号不需要写出来)
|
* 格式与官方标签插件一致使用空格分隔,中括号内的是可选参数(中括号不需要写出来)
|
||||||
*
|
*
|
||||||
* {% friends [style:rect] [group:name] %}
|
* {% friends [style:rect] [group:name] %}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const { ArgsMap } = require('./utils');
|
|
||||||
|
|
||||||
hexo.extend.tag.register('friends', function(args) {
|
hexo.extend.tag.register('friends', function(args) {
|
||||||
args = ArgsMap(args, ['style', 'group']);
|
args = hexo.args.map(args, ['style', 'group']);
|
||||||
var friends = hexo.locals.get('data').friends;
|
var friends = hexo.locals.get('data').friends;
|
||||||
if (friends == undefined) {
|
if (friends == undefined) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -1,23 +1,21 @@
|
||||||
/**
|
/**
|
||||||
* friends.js v1 | https://github.com/xaoxuu/hexo-theme-stellar/
|
* friends.js v1 | https://github.com/xaoxuu/hexo-theme-stellar/
|
||||||
* 格式与官方标签插件一致使用空格分隔,中括号内的是可选参数(中括号不需要写出来)
|
* 格式与官方标签插件一致使用空格分隔,中括号内的是可选参数(中括号不需要写出来)
|
||||||
*
|
*
|
||||||
* {% ghcard user/repo [theme:xxx] %} or {% ghcard user %}
|
* {% ghcard user/repo [theme:xxx] %} or {% ghcard user %}
|
||||||
*
|
*
|
||||||
* example:
|
* example:
|
||||||
* {% ghcard xaoxuu %}
|
* {% ghcard xaoxuu %}
|
||||||
* {% ghcard xaoxuu/hexo-theme-stellar %}
|
* {% ghcard xaoxuu/hexo-theme-stellar %}
|
||||||
*
|
*
|
||||||
* API: https://github.com/anuraghazra/github-readme-stats
|
* API: https://github.com/anuraghazra/github-readme-stats
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const { ArgsMap, ArgsJoinURLParams } = require('./utils');
|
|
||||||
|
|
||||||
hexo.extend.tag.register('ghcard', function(args) {
|
hexo.extend.tag.register('ghcard', function(args) {
|
||||||
var params = ['show_owner', 'theme', 'title_color', 'text_color', 'icon_color', 'bg_color', 'hide_border', 'cache_seconds', 'locale'];
|
var params = ['show_owner', 'theme', 'title_color', 'text_color', 'icon_color', 'bg_color', 'hide_border', 'cache_seconds', 'locale'];
|
||||||
args = ArgsMap(args, params, ['repo']);
|
args = hexo.args.map(args, params, ['repo']);
|
||||||
const path = args.repo;
|
const path = args.repo;
|
||||||
var el = '';
|
var el = '';
|
||||||
el += '<div class="tag-plugin ghcard">';
|
el += '<div class="tag-plugin ghcard">';
|
||||||
|
@ -31,7 +29,7 @@ hexo.extend.tag.register('ghcard', function(args) {
|
||||||
// is user
|
// is user
|
||||||
url += 'https://github-readme-stats.vercel.app/api/?username=' + path;
|
url += 'https://github-readme-stats.vercel.app/api/?username=' + path;
|
||||||
}
|
}
|
||||||
url += '&' + ArgsJoinURLParams(args, params);
|
url += '&' + hexo.args.joinURLParams(args, params);
|
||||||
if (!url.includes('&show_owner=')) {
|
if (!url.includes('&show_owner=')) {
|
||||||
url += '&show_owner=true';
|
url += '&show_owner=true';
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,10 +7,8 @@
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const { ArgsMap } = require('./utils');
|
|
||||||
|
|
||||||
hexo.extend.tag.register('image', function(args) {
|
hexo.extend.tag.register('image', function(args) {
|
||||||
args = ArgsMap(args, ['width', 'height', 'bg', 'download', 'padding'], ['src', 'alt']);
|
args = hexo.args.map(args, ['width', 'height', 'bg', 'download', 'padding'], ['src', 'alt']);
|
||||||
var style = '';
|
var style = '';
|
||||||
if (args.width) {
|
if (args.width) {
|
||||||
style += 'width:' + args.width + ';';
|
style += 'width:' + args.width + ';';
|
||||||
|
|
|
@ -1,19 +1,17 @@
|
||||||
/**
|
/**
|
||||||
* issues.js v1 | https://github.com/xaoxuu/hexo-theme-stellar/
|
* issues.js v1 | https://github.com/xaoxuu/hexo-theme-stellar/
|
||||||
* 格式与官方标签插件一致使用空格分隔,中括号内的是可选参数(中括号不需要写出来)
|
* 格式与官方标签插件一致使用空格分隔,中括号内的是可选参数(中括号不需要写出来)
|
||||||
*
|
*
|
||||||
* {% issues [sites/timeline/friends] api:xxx [group:key=value1,value2,value3] %}
|
* {% issues [sites/timeline/friends] api:xxx [group:key=value1,value2,value3] %}
|
||||||
*
|
*
|
||||||
* example:
|
* example:
|
||||||
* {% issues sites api:https://api.github.com/repos/volantis-x/examples/issues?sort=updated&state=open&page=1&per_page=100 group:version=版本:^4.0,版本:^3.0,版本:^2.0 %}
|
* {% issues sites api:https://api.github.com/repos/volantis-x/examples/issues?sort=updated&state=open&page=1&per_page=100 group:version=版本:^4.0,版本:^3.0,版本:^2.0 %}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const { ArgsMap } = require('./utils');
|
|
||||||
|
|
||||||
hexo.extend.tag.register('issues', function(args) {
|
hexo.extend.tag.register('issues', function(args) {
|
||||||
args = ArgsMap(args, ['api', 'group'], ['type']);
|
args = hexo.args.map(args, ['api', 'group'], ['type']);
|
||||||
// 所有支持的参数
|
// 所有支持的参数
|
||||||
let type = args.type || '';
|
let type = args.type || '';
|
||||||
let api = args.api || '';
|
let api = args.api || '';
|
||||||
|
|
|
@ -7,14 +7,16 @@
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const { ArgsMap } = require('./utils');
|
|
||||||
|
|
||||||
hexo.extend.tag.register('link', function(args) {
|
hexo.extend.tag.register('link', function(args) {
|
||||||
args = ArgsMap(args, ['img'], ['url', 'title', 'description']);
|
args = hexo.args.map(args, ['img'], ['url', 'title', 'description']);
|
||||||
|
|
||||||
var el = '';
|
var el = '';
|
||||||
el += '<div class="tag-plugin tag link">';
|
el += '<div class="tag-plugin tag link">';
|
||||||
el += '<a class="link-card" title="' + args.title + '" href="' + args.url + '">';
|
el += '<a class="link-card" title="' + args.title + '" href="' + args.url + '"';
|
||||||
|
if (args.url.includes('://')) {
|
||||||
|
el += ' target="_blank" rel="external nofollow noopener noreferrer"';
|
||||||
|
}
|
||||||
|
el += '>';
|
||||||
// left
|
// left
|
||||||
el += '<div class="left">';
|
el += '<div class="left">';
|
||||||
el += '<span class="title">' + args.title + '</span><span class="url">' + (args.description || args.url) + '</span>';
|
el += '<span class="title">' + args.title + '</span><span class="url">' + (args.description || args.url) + '</span>';
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
/**
|
/**
|
||||||
* note.js v1 | https://github.com/xaoxuu/hexo-theme-stellar/
|
* note.js v1 | https://github.com/xaoxuu/hexo-theme-stellar/
|
||||||
* 格式与官方标签插件一致使用空格分隔,中括号内的是可选参数(中括号不需要写出来)
|
* 格式与官方标签插件一致使用空格分隔,中括号内的是可选参数(中括号不需要写出来)
|
||||||
*
|
*
|
||||||
* note:
|
* note:
|
||||||
* {% note [color:color] [title] content %}
|
* {% note [color:color] [title] content %}
|
||||||
*
|
*
|
||||||
* noteblock:
|
* noteblock:
|
||||||
* {% noteblock [color:color] title %}
|
* {% noteblock [color:color] title %}
|
||||||
* markdown content
|
* markdown content
|
||||||
|
@ -13,8 +13,6 @@
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const { ArgsMap } = require('./utils');
|
|
||||||
|
|
||||||
function outputNoteBlock(color, title, content) {
|
function outputNoteBlock(color, title, content) {
|
||||||
var el = '';
|
var el = '';
|
||||||
const defaultColor = hexo.theme.config.tag_plugins.note.default_color;
|
const defaultColor = hexo.theme.config.tag_plugins.note.default_color;
|
||||||
|
@ -40,7 +38,7 @@ function outputNoteBlock(color, title, content) {
|
||||||
}
|
}
|
||||||
|
|
||||||
hexo.extend.tag.register('note', function(args) {
|
hexo.extend.tag.register('note', function(args) {
|
||||||
args = ArgsMap(args, ['color'], ['title', 'content']);
|
args = hexo.args.map(args, ['color'], ['title', 'content']);
|
||||||
if (args.content) {
|
if (args.content) {
|
||||||
return outputNoteBlock(args.color, args.title, args.content);
|
return outputNoteBlock(args.color, args.title, args.content);
|
||||||
} else {
|
} else {
|
||||||
|
@ -49,6 +47,6 @@ hexo.extend.tag.register('note', function(args) {
|
||||||
});
|
});
|
||||||
|
|
||||||
hexo.extend.tag.register('noteblock', function(args, content) {
|
hexo.extend.tag.register('noteblock', function(args, content) {
|
||||||
args = ArgsMap(args, ['color'], ['title']);
|
args = hexo.args.map(args, ['color'], ['title']);
|
||||||
return outputNoteBlock(args.color, args.title, content);
|
return outputNoteBlock(args.color, args.title, content);
|
||||||
}, {ends: true});
|
}, {ends: true});
|
||||||
|
|
|
@ -9,10 +9,8 @@
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const { ArgsMap, ArgsJoinTags } = require('./utils');
|
|
||||||
|
|
||||||
hexo.extend.tag.register('swiper', function(args, content) {
|
hexo.extend.tag.register('swiper', function(args, content) {
|
||||||
args = ArgsMap(args, ['width']);
|
args = hexo.args.map(args, ['width']);
|
||||||
var el = '';
|
var el = '';
|
||||||
function slide() {
|
function slide() {
|
||||||
let imgs = hexo.render.renderSync({text: content, engine: 'markdown'});
|
let imgs = hexo.render.renderSync({text: content, engine: 'markdown'});
|
||||||
|
@ -26,7 +24,7 @@ hexo.extend.tag.register('swiper', function(args, content) {
|
||||||
}
|
}
|
||||||
el += '<div class="tag-plugin swiper-container" id="swiper-api"';
|
el += '<div class="tag-plugin swiper-container" id="swiper-api"';
|
||||||
if (args.width && args.width.length > 0) {
|
if (args.width && args.width.length > 0) {
|
||||||
el += ' ' + ArgsJoinTags(args, 'width').join(' ');
|
el += ' ' + hexo.args.joinTags(args, 'width').join(' ');
|
||||||
}
|
}
|
||||||
el += '>';
|
el += '>';
|
||||||
el += '<div class="swiper-wrapper">';
|
el += '<div class="swiper-wrapper">';
|
||||||
|
|
|
@ -16,10 +16,8 @@
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const { ArgsMap, ArgsJoinTags } = require('./utils');
|
|
||||||
|
|
||||||
function postTimeline(args, content) {
|
function postTimeline(args, content) {
|
||||||
args = ArgsMap(args, ['order']);
|
args = hexo.args.map(args, ['order']);
|
||||||
|
|
||||||
const newerIcon = '<svg class="icon top" width="1em" height="1em" viewBox="0 0 14 14" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M7,0 C3.13425,0 0,3.13425 0,7 C0,10.86575 3.13425,14 7,14 C10.86575,14 14,10.86575 14,7 C14,3.13425 10.86575,0 7,0 Z M7,12.25 C4.104625,12.25 1.75,9.89449999 1.75,7 C1.75,4.10550001 4.104625,1.75 7,1.75 C9.895375,1.75 12.25,4.10550001 12.25,7 C12.25,9.89449999 9.895375,12.25 7,12.25 Z M8.75875001,7 L7.43750001,7 C7.19600001,7 7.00000002,6.804 7.00000002,6.56250001 L7.00000002,5.24125001 C7.00000002,4.76262501 6.61237501,4.37500001 6.13375002,4.37500001 L6.11625001,4.37500001 C5.63762502,4.37500001 5.25000001,4.76262501 5.25000001,5.24125001 L5.25000001,7.88375 C5.25000001,8.362375 5.63762502,8.75 6.11625001,8.75 L8.75875001,8.75 C9.237375,8.75 9.62500001,8.362375 9.62500001,7.88375 L9.62500001,7.86625 C9.62500001,7.387625 9.237375,7 8.75875001,7 L8.75875001,7 Z" id="top"></path></svg>';
|
const newerIcon = '<svg class="icon top" width="1em" height="1em" viewBox="0 0 14 14" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M7,0 C3.13425,0 0,3.13425 0,7 C0,10.86575 3.13425,14 7,14 C10.86575,14 14,10.86575 14,7 C14,3.13425 10.86575,0 7,0 Z M7,12.25 C4.104625,12.25 1.75,9.89449999 1.75,7 C1.75,4.10550001 4.104625,1.75 7,1.75 C9.895375,1.75 12.25,4.10550001 12.25,7 C12.25,9.89449999 9.895375,12.25 7,12.25 Z M8.75875001,7 L7.43750001,7 C7.19600001,7 7.00000002,6.804 7.00000002,6.56250001 L7.00000002,5.24125001 C7.00000002,4.76262501 6.61237501,4.37500001 6.13375002,4.37500001 L6.11625001,4.37500001 C5.63762502,4.37500001 5.25000001,4.76262501 5.25000001,5.24125001 L5.25000001,7.88375 C5.25000001,8.362375 5.63762502,8.75 6.11625001,8.75 L8.75875001,8.75 C9.237375,8.75 9.62500001,8.362375 9.62500001,7.88375 L9.62500001,7.86625 C9.62500001,7.387625 9.237375,7 8.75875001,7 L8.75875001,7 Z" id="top"></path></svg>';
|
||||||
|
|
||||||
|
|
|
@ -1,72 +0,0 @@
|
||||||
/**
|
|
||||||
* folding.js v1 | https://github.com/xaoxuu/hexo-theme-stellar/
|
|
||||||
*/
|
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
ArgsMap(args, keys, others) {
|
|
||||||
if (Array.isArray(args) == false) {
|
|
||||||
return args;
|
|
||||||
}
|
|
||||||
var map = {others: Array()};
|
|
||||||
args.forEach((arg, i) => {
|
|
||||||
let kv = arg.trim();
|
|
||||||
if (kv.includes('://') && kv.split(':').length == 2) {
|
|
||||||
// 纯 url
|
|
||||||
map.others.push(kv);
|
|
||||||
} else {
|
|
||||||
kv = kv.split(':');
|
|
||||||
if (kv.length > 1) {
|
|
||||||
if (keys.includes(kv[0]) == true) {
|
|
||||||
map[kv.shift()] = kv.join(':');
|
|
||||||
} else {
|
|
||||||
map.others.push(kv.join(':'));
|
|
||||||
}
|
|
||||||
} else if (kv.length == 1) {
|
|
||||||
map.others.push(kv[0]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
// 解析不带 key 的参数
|
|
||||||
if (others && others.length > 0 && map.others.length > 0) {
|
|
||||||
if (Array.isArray(others) == false) {
|
|
||||||
others = [others];
|
|
||||||
}
|
|
||||||
others.forEach((arg, i) => {
|
|
||||||
map[arg] = map.others.shift();
|
|
||||||
});
|
|
||||||
// 最后一段合并到最后一个参数中
|
|
||||||
if (map.others.length > 0) {
|
|
||||||
map[others[others.length-1]] += ' ' + map.others.join(' ');
|
|
||||||
map.others = [];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return map;
|
|
||||||
},
|
|
||||||
ArgsJoinTags(args, keys) {
|
|
||||||
if (Array.isArray(keys) == false) {
|
|
||||||
keys = [keys];
|
|
||||||
}
|
|
||||||
var ret = [];
|
|
||||||
keys.forEach((key, i) => {
|
|
||||||
if (args[key] && args[key].length > 0) {
|
|
||||||
ret.push(key + '="' + args[key] + '"');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return ret;
|
|
||||||
},
|
|
||||||
ArgsJoinURLParams(args, keys) {
|
|
||||||
if (Array.isArray(keys) == false) {
|
|
||||||
keys = [keys];
|
|
||||||
}
|
|
||||||
var ret = [];
|
|
||||||
keys.forEach((key, i) => {
|
|
||||||
if (args[key] && args[key].length > 0) {
|
|
||||||
ret.push(key + '=' + args[key]);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return ret.join('&');
|
|
||||||
}
|
|
||||||
};
|
|
|
@ -33,8 +33,8 @@ $c-card-dark = #333
|
||||||
// font-weight: normal
|
// font-weight: normal
|
||||||
// font-style: normal
|
// font-style: normal
|
||||||
|
|
||||||
$ff-body = Dosis, -apple-system, "Helvetica Neue", Helvetica, Arial, "WenQuanYi Micro Hei", "Microsoft Yahei", Menlo, Monaco, monospace, courier, sans-serif
|
$ff-body = -apple-system, system-ui, "Segoe UI", Roboto, Ubuntu, "Helvetica Neue", Arial, "WenQuanYi Micro Hei", "Microsoft Yahei", sans-serif
|
||||||
$ff-code = Menlo, Monaco, monospace, courier, sans-serif
|
$ff-code = Menlo, Monaco, Consolas, "Courier New", monospace, sans-serif
|
||||||
|
|
||||||
$ff-logo = $ff-body
|
$ff-logo = $ff-body
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
width: 100%
|
width: 100%
|
||||||
color: var(--text-p2)
|
color: var(--text-p2)
|
||||||
button.copy-btn
|
button.copy-btn
|
||||||
|
margin: 0
|
||||||
border-left: 1px solid var(--block-border)
|
border-left: 1px solid var(--block-border)
|
||||||
display: inline-block
|
display: inline-block
|
||||||
background: var(--hover-block)
|
background: var(--hover-block)
|
||||||
|
|
Loading…
Reference in New Issue