diff --git a/scripts/tags/index.js b/scripts/tags/index.js index 55bee61..e9043f8 100644 --- a/scripts/tags/index.js +++ b/scripts/tags/index.js @@ -6,3 +6,6 @@ const postTabs = require('./lib/tabs')(hexo); hexo.extend.tag.register('tabs', postTabs, true); hexo.extend.tag.register('subtabs', postTabs, true); hexo.extend.tag.register('subsubtabs', postTabs, true); + +const users = require('./lib/users')(hexo); +hexo.extend.tag.register('users', users); \ No newline at end of file diff --git a/scripts/tags/lib/users.js b/scripts/tags/lib/users.js new file mode 100644 index 0000000..50ac000 --- /dev/null +++ b/scripts/tags/lib/users.js @@ -0,0 +1,23 @@ +/** + * users.js v1 | https://github.com/xaoxuu/hexo-theme-stellar/ + * 格式与官方标签插件一致使用空格分隔,中括号内的是可选参数(中括号不需要写出来) + * + * {% users api:https://api.github.com/repos/xaoxuu/hexo-theme-stellar/contributors %} + */ + +'use strict'; + +module.exports = ctx => function(args) { + args = ctx.args.map(args, ['api']); + var el = '
'; + + el += '
div.body + display: flex; + flex-direction: column; padding: 1rem margin: 0 - 1rem margin-top: 0 diff --git a/source/js/plugins/friends.js b/source/js/plugins/friends.js index c15b700..0187d3b 100644 --- a/source/js/plugins/friends.js +++ b/source/js/plugins/friends.js @@ -47,13 +47,14 @@ const friendsjs = { $(el).append('

'); friendsjs.requestAPI(cfg.api, function(data) { $(el).find('.loading-wrap').remove(); - const arr = data.content; + const arr = data.content || data; + console.log(data); arr.forEach((item, i) => { var user = ''; $(el).find('.group-body').append(user);