This commit is contained in:
xaoxuu 2022-10-29 23:14:28 +08:00
parent a8ca8a9a5b
commit 9a2101ebfc
3 changed files with 17 additions and 17 deletions

View File

@ -66,5 +66,5 @@ welcome:
timeline: timeline:
layout: timeline layout: timeline
title: 近期动态 title: 近期动态
api: https://api.github.com/repos/xaoxuu/hexo-theme-stellar/issues api: # https://api.github.com/repos/xaoxuu/hexo-theme-stellar/issues
user: user:

View File

@ -2,28 +2,28 @@
* friends.js v2 | https://github.com/xaoxuu/hexo-theme-stellar/ * friends.js v2 | https://github.com/xaoxuu/hexo-theme-stellar/
* 格式与官方标签插件一致使用空格分隔中括号内的是可选参数中括号不需要写出来 * 格式与官方标签插件一致使用空格分隔中括号内的是可选参数中括号不需要写出来
* *
* {% friends [group] [repo:owner/repo] [data:http] %} * {% friends [group] [repo:owner/repo] [api:http] %}
*/ */
'use strict'; 'use strict';
hexo.extend.tag.register('friends', function(args) { hexo.extend.tag.register('friends', function(args) {
args = hexo.args.map(args, ['repo', 'data'], ['group']); args = hexo.args.map(args, ['repo', 'api'], ['group']);
var links = hexo.locals.get('data').links; var links = hexo.locals.get('data').links;
if (links == undefined) { if (links == undefined) {
links = {}; links = {};
} }
var data; var api;
if (args.data) { if (args.api) {
data = args.data; api = args.api;
} else if (args.repo) { } else if (args.repo) {
data = 'https://raw.github.xaoxuu.com/' + args.repo + '/output/v2/data.json'; api = 'https://raw.github.xaoxuu.com/' + args.repo + '/output/v2/data.json';
} }
var el = '<div class="tag-plugin users-wrap">'; var el = '<div class="tag-plugin users-wrap">';
if (data) { if (api) {
el += '<div class="stellar-friends-api"'; el += '<div class="stellar-friends-api"';
el += ' api="' + data + '"'; el += ' api="' + api + '"';
el += '>'; el += '>';
el += '<div class="group-body"></div>'; el += '<div class="group-body"></div>';
el += '</div>'; el += '</div>';

View File

@ -2,28 +2,28 @@
* sites.js v2 | https://github.com/xaoxuu/hexo-theme-stellar/ * sites.js v2 | https://github.com/xaoxuu/hexo-theme-stellar/
* 格式与官方标签插件一致使用空格分隔中括号内的是可选参数中括号不需要写出来 * 格式与官方标签插件一致使用空格分隔中括号内的是可选参数中括号不需要写出来
* *
* {% sites [group] [repo:owner/repo] [data:http] %} * {% sites [group] [repo:owner/repo] [api:http] %}
*/ */
'use strict'; 'use strict';
hexo.extend.tag.register('sites', function(args) { hexo.extend.tag.register('sites', function(args) {
args = hexo.args.map(args, ['repo', 'data'], ['group']); args = hexo.args.map(args, ['repo', 'api'], ['group']);
var links = hexo.locals.get('data').links; var links = hexo.locals.get('data').links;
if (links == undefined) { if (links == undefined) {
links = {}; links = {};
} }
var data; var api;
if (args.data) { if (args.api) {
data = args.data; api = args.api;
} else if (args.repo) { } else if (args.repo) {
data = 'https://raw.github.xaoxuu.com/' + args.repo + '/output/v2/data.json'; api = 'https://raw.github.xaoxuu.com/' + args.repo + '/output/v2/data.json';
} }
var el = '<div class="tag-plugin sites-wrap">'; var el = '<div class="tag-plugin sites-wrap">';
if (data) { if (api) {
el += '<div class="stellar-sites-api"'; el += '<div class="stellar-sites-api"';
el += ' api="' + data + '"'; el += ' api="' + api + '"';
el += '>'; el += '>';
el += '<div class="group-body"></div>'; el += '<div class="group-body"></div>';
el += '</div>'; el += '</div>';