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

51 lines
1.6 KiB
Plaintext
Raw Permalink Normal View History

2022-10-20 22:57:40 +08:00
<%
function layoutDiv() {
var el = '';
var repo;
var branch = 'main';
2022-11-22 22:38:25 +08:00
if (page.repo) {
repo = page.repo
2024-01-19 01:05:44 +08:00
} else if (theme.wiki.tree[page.wiki]?.repo) {
const proj = theme.wiki.tree[page.wiki]
repo = proj.repo
if (proj.branch != undefined) {
branch = proj.branch
2022-10-20 22:57:40 +08:00
}
}
if (repo == undefined) {
return el;
}
// 布局
2024-01-19 01:05:44 +08:00
el += `<widget class="widget-wrapper${scrollreveal(' ')} ghrepo">`
2022-10-20 22:57:40 +08:00
// body
el += '<div class="widget-body">';
2024-02-18 12:33:28 +08:00
el += '<div class="items ds-ghinfo" api="' + theme.api_host.ghapi + '/repos/' + repo + '">';
2022-10-20 22:57:40 +08:00
el += '<a class="repo" href="https://github.com/' + repo + '" target="_blank" rel="external nofollow noopener noreferrer">';
el += '<div class="repo-name flex-row">';
2024-01-19 13:51:55 +08:00
el += icon('github:repo')
2022-10-26 22:44:50 +08:00
el += repo;
2022-10-20 22:57:40 +08:00
el += '</div>';
el += '<div class="repo-desc"><span type="text" id="description">&nbsp;</span></div>';
el += '<div class="grid">';
el += '<div class="flex-row">';
2024-01-19 13:51:55 +08:00
el += icon('github:star')
2022-10-20 22:57:40 +08:00
el += '<span type="text" id="stargazers_count"></span>';
el += '</div>';
el += '<div class="flex-row">';
2024-01-19 13:51:55 +08:00
el += icon('github:fork')
2022-10-20 22:57:40 +08:00
el += '<span type="text" id="forks_count"></span>';
el += '</div>';
2024-02-18 12:33:28 +08:00
el += '<div class="flex-row ds-ghinfo" index="0" api="' + theme.api_host.ghapi + '/repos/' + repo + '/tags">';
2024-01-19 13:51:55 +08:00
el += icon('github:tag')
2022-10-22 13:03:47 +08:00
el += '<span type="text" id="latest-tag-name">0</span>';
2022-10-20 22:57:40 +08:00
el += '</div>';
el += '</div>';
el += '</a>';
el += '</div>';
el += '</div>';
2022-11-23 21:54:21 +08:00
el += '</widget>';
2022-10-20 22:57:40 +08:00
return el;
}
%>
<%- layoutDiv() %>