forgejo links
This commit is contained in:
parent
6c0e5e67bd
commit
02b7694bfe
|
|
@ -70,6 +70,7 @@ domainIcon url
|
|||
| "archive.org" `T.isInfixOf` url = "internet-archive"
|
||||
-- Code / software
|
||||
| "github.com" `T.isInfixOf` url = "github"
|
||||
| "git.levineuwirth.org" `T.isInfixOf` url = "forgejo"
|
||||
| "tensorflow.org" `T.isInfixOf` url = "tensorflow"
|
||||
-- AI companies
|
||||
| "anthropic.com" `T.isInfixOf` url = "anthropic"
|
||||
|
|
|
|||
|
|
@ -97,6 +97,10 @@
|
|||
mask-image: url('/images/link-icons/github.svg');
|
||||
-webkit-mask-image: url('/images/link-icons/github.svg');
|
||||
}
|
||||
.popup-source[data-popup-source="forgejo"]::before {
|
||||
mask-image: url('/images/link-icons/forgejo.svg');
|
||||
-webkit-mask-image: url('/images/link-icons/forgejo.svg');
|
||||
}
|
||||
.popup-source[data-popup-source="youtube"]::before {
|
||||
mask-image: url('/images/link-icons/youtube.svg');
|
||||
-webkit-mask-image: url('/images/link-icons/youtube.svg');
|
||||
|
|
|
|||
|
|
@ -626,6 +626,11 @@ a[data-link-icon="github"]::after {
|
|||
-webkit-mask-image: url('/images/link-icons/github.svg');
|
||||
}
|
||||
|
||||
a[data-link-icon="forgejo"]::after {
|
||||
mask-image: url('/images/link-icons/forgejo.svg');
|
||||
-webkit-mask-image: url('/images/link-icons/forgejo.svg');
|
||||
}
|
||||
|
||||
a[data-link-icon="worldcat"]::after {
|
||||
mask-image: url('/images/link-icons/worldcat.svg');
|
||||
-webkit-mask-image: url('/images/link-icons/worldcat.svg');
|
||||
|
|
|
|||
|
|
@ -0,0 +1 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" id="Layer_1" x="0" y="0" version="1.1" viewBox="38.5 0.5 135 211" stroke="currentColor" fill="none"><style>.st-line{stroke-width:25;stroke-linecap:round;stroke-linejoin:round}.st-circle{stroke-width:15}</style><g transform="translate(6 6)"><path d="M58 168V70c0-27.6 22.4-50 50-50h20" class="st-line"/><path d="M58 168v-30c0-27.6 22.4-50 50-50h20" class="st-line"/><circle cx="142" cy="20" r="18" class="st-circle"/><circle cx="142" cy="88" r="18" class="st-circle"/><circle cx="58" cy="180" r="18" class="st-circle"/></g></svg>
|
||||
|
After Width: | Height: | Size: 589 B |
|
|
@ -108,6 +108,7 @@
|
|||
if (/arxiv\.org\/(?:abs|pdf)\/\d{4}\.\d{4,5}/.test(href)) return arxivContent;
|
||||
if (/(?:dx\.)?doi\.org\/10\./.test(href)) return doiContent;
|
||||
if (/github\.com\/[^/]+\/[^/?#]+/.test(href)) return githubContent;
|
||||
if (/git\.levineuwirth\.org\/[^/]+\/[^/?#]+/.test(href)) return forgejoContent;
|
||||
if (/openlibrary\.org\/(?:works|books)\//.test(href)) return openlibraryContent;
|
||||
if (/(?:bio|med)rxiv\.org\/content\/10\./.test(href)) return biorxivContent;
|
||||
if (/(?:youtube\.com\/watch|youtu\.be\/)/.test(href)) return youtubeContent;
|
||||
|
|
@ -411,6 +412,32 @@
|
|||
.catch(function () { return null; });
|
||||
}
|
||||
|
||||
/* 6.5 Forgejo — repo description, language, stars */
|
||||
function forgejoContent(target) {
|
||||
var href = target.getAttribute('href');
|
||||
if (!href || cache[href]) return Promise.resolve(cache[href] || null);
|
||||
|
||||
var m = href.match(/git\.levineuwirth\.org\/([^/]+)\/([^/?#]+)/);
|
||||
if (!m) return Promise.resolve(null);
|
||||
|
||||
var apiUrl = 'https://git.levineuwirth.org/api/v1/repos/' + m[1] + '/' + m[2];
|
||||
return fetch(apiUrl)
|
||||
.then(function (r) { return r.ok ? r.json() : null; })
|
||||
.then(function (data) {
|
||||
if (!data || !data.full_name) return null;
|
||||
var meta = [data.language, data.stars_count != null ? '\u2605\u00a0' + data.stars_count : null]
|
||||
.filter(Boolean).join(' \u00b7 ');
|
||||
return store(href,
|
||||
'<div class="popup-forgejo">'
|
||||
+ srcHtml('forgejo', 'Forgejo')
|
||||
+ '<div class="popup-title">' + esc(data.full_name) + '</div>'
|
||||
+ (data.description ? '<div class="popup-abstract">' + esc(data.description) + '</div>' : '')
|
||||
+ (meta ? '<div class="popup-meta">' + esc(meta) + '</div>' : '')
|
||||
+ '</div>');
|
||||
})
|
||||
.catch(function () { return null; });
|
||||
}
|
||||
|
||||
/* 7. Open Library — book title + description */
|
||||
function openlibraryContent(target) {
|
||||
var href = target.getAttribute('href');
|
||||
|
|
|
|||
Loading…
Reference in New Issue