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

54 lines
1.4 KiB
Plaintext

<%
var btns = [];
btns.push({
key: 'followers',
desc: 'followers',
tab: 'followers'
});
btns.push({
key: 'following',
desc: 'following',
tab: 'following'
});
btns.push({
key: 'public_repos',
desc: 'repos',
tab: 'repositories'
});
function layoutDiv() {
var el = '';
if (item.username == undefined || item.username.length == 0) {
return el;
}
el += `<widget class="widget-wrapper${scrollreveal(' ')} user-card ghuser">`
// body
el += '<div class="widget-body ds-ghinfo" api="' + theme.api_host.ghapi + '/users/' + item.username + '">';
if (item.avatar) {
el += '<div class="avatar" ><img no-lazy type="img" id="avatar_url" src="' + config.avatar + '"></div>';
}
// username
el += '<p class="username" ff="title" type="text" id="name">&nbsp;</p>';
el += '<p class="bio" type="text" id="bio">&nbsp;</p>';
el += '<div class="buttons">';
btns.forEach((btn, i) => {
el += '<a class="btn" href="https://github.com/' + item.username + '?tab=' + btn.tab + '">';
el += '<span class="title" type="text" id="' + btn.key + '">0</span>';
el += '<span class="desc">' + btn.desc + '</span>';
el += '</a>';
});
el += '</div>';
// follow
el += '<a class="follow" href="https://github.com/' + item.username + '">';
el += icon('github:logo')
el += 'Follow';
el += '</a>';
el += '</div>';
el += '</widget>';
return el;
}
%>
<%- layoutDiv() %>