hexo-theme-stellar/layout/_partial/widgets/ghuser.ejs

54 lines
1.4 KiB
Plaintext
Raw Permalink Normal View History

2022-10-05 23:00:52 +08:00
<%
var btns = [];
btns.push({
key: 'followers',
2022-10-06 01:21:36 +08:00
desc: 'followers',
2022-10-15 00:28:26 +08:00
tab: 'followers'
2022-10-05 23:00:52 +08:00
});
btns.push({
key: 'following',
2022-10-06 01:21:36 +08:00
desc: 'following',
2022-10-15 00:28:26 +08:00
tab: 'following'
2022-10-05 23:00:52 +08:00
});
btns.push({
key: 'public_repos',
2022-10-06 01:21:36 +08:00
desc: 'repos',
2022-10-15 00:28:26 +08:00
tab: 'repositories'
2022-10-05 23:00:52 +08:00
});
function layoutDiv() {
var el = '';
if (item.username == undefined || item.username.length == 0) {
return el;
}
2024-02-05 18:01:50 +08:00
el += `<widget class="widget-wrapper${scrollreveal(' ')} user-card ghuser">`
2022-10-08 16:48:13 +08:00
// body
2024-02-18 12:33:28 +08:00
el += '<div class="widget-body ds-ghinfo" api="' + theme.api_host.ghapi + '/users/' + item.username + '">';
2022-10-08 16:48:13 +08:00
if (item.avatar) {
el += '<div class="avatar" ><img no-lazy type="img" id="avatar_url" src="' + config.avatar + '"></div>';
}
// username
2022-10-15 00:28:26 +08:00
el += '<p class="username" ff="title" type="text" id="name">&nbsp;</p>';
2022-10-08 16:48:13 +08:00
el += '<p class="bio" type="text" id="bio">&nbsp;</p>';
2022-10-05 23:00:52 +08:00
el += '<div class="buttons">';
btns.forEach((btn, i) => {
2022-10-15 00:28:26 +08:00
el += '<a class="btn" href="https://github.com/' + item.username + '?tab=' + btn.tab + '">';
2022-10-08 16:48:13 +08:00
el += '<span class="title" type="text" id="' + btn.key + '">0</span>';
2022-10-05 23:00:52 +08:00
el += '<span class="desc">' + btn.desc + '</span>';
el += '</a>';
});
el += '</div>';
// follow
el += '<a class="follow" href="https://github.com/' + item.username + '">';
2024-01-19 13:51:55 +08:00
el += icon('github:logo')
2022-10-05 23:00:52 +08:00
el += 'Follow';
el += '</a>';
el += '</div>';
2022-11-23 21:54:21 +08:00
el += '</widget>';
2022-10-05 23:00:52 +08:00
return el;
}
%>
<%- layoutDiv() %>