cgit has no download tab; snapshot links only appear on the commit page (hidden here) and for tags (none exist). A small inline script in head.html adds tar.gz/zip for the selected branch to the tab bar and shows the SSH clone URL from cgit's own vcs-git link. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JGodmgtRqahbT52gApsM8N
32 lines
1.3 KiB
HTML
32 lines
1.3 KiB
HTML
<link rel="stylesheet" type="text/css" href="/pinix.css"/>
|
|
<script>
|
|
// cgit hat keinen Download-Tab: Snapshot-Links stehen nur auf der
|
|
// Commit-Seite und bei Tags. Hier kommen tar.gz/zip fuer den gewaehlten
|
|
// Branch direkt in die Tab-Leiste, dazu die Clone-URL aus cgits eigenem
|
|
// <link rel="vcs-git">.
|
|
document.addEventListener('DOMContentLoaded', function () {
|
|
var tabs = document.querySelector('table.tabs td');
|
|
var repo = location.pathname.split('/')[1];
|
|
if (!tabs || !repo) return;
|
|
|
|
var ref = new URLSearchParams(location.search).get('h') || 'HEAD';
|
|
var box = document.createElement('span');
|
|
box.className = 'pinix-download';
|
|
['tar.gz', 'zip'].forEach(function (ext) {
|
|
var a = document.createElement('a');
|
|
a.href = '/' + repo + '/snapshot/' + repo + '-' + ref + '.' + ext;
|
|
a.textContent = ext;
|
|
box.appendChild(a);
|
|
});
|
|
tabs.appendChild(box);
|
|
|
|
var clone = document.querySelector('link[rel="vcs-git"]');
|
|
if (clone) {
|
|
var row = document.createElement('div');
|
|
row.className = 'pinix-clone';
|
|
row.innerHTML = 'clone <code></code>';
|
|
row.querySelector('code').textContent = 'git clone ' + clone.getAttribute('href');
|
|
document.querySelector('table.tabs').insertAdjacentElement('afterend', row);
|
|
}
|
|
});
|
|
</script>
|