summaryrefslogtreecommitdiff
path: root/web/cgit-extra.html
diff options
context:
space:
mode:
authoraura <nw@moneybot.cc>2026-02-17 01:01:48 +0100
committeraura <nw@moneybot.cc>2026-02-17 01:01:48 +0100
commit2f4b118cd28600216d40df776e0fead81a41d5cb (patch)
tree72f0b6421a6a5fbb22c3a1d5b3623f7b49860d95 /web/cgit-extra.html
parent2e8bcce422176922478c67118cb23d510d7784cf (diff)
fix git readmes
Diffstat (limited to 'web/cgit-extra.html')
-rw-r--r--web/cgit-extra.html24
1 files changed, 16 insertions, 8 deletions
diff --git a/web/cgit-extra.html b/web/cgit-extra.html
index 7f0d9f9..3b46fe7 100644
--- a/web/cgit-extra.html
+++ b/web/cgit-extra.html
@@ -182,7 +182,17 @@ function createReadme( text, isMd ) {
tr.style.backgroundColor = "#808080"
const list = document.querySelector( ".list" );
const tbody = list.querySelector( "tbody" );
- tbody.insertBefore( tr, tbody.children[3] );
+
+ let insertTarget = tbody.children[3];
+ for( let i = 2; i < tbody.children.length; ++i ) {
+ console.log( tbody.children[i].classList );
+ if( tbody.children[i-1].classList.contains( "nohover" ) ) {
+ insertTarget = tbody.children[i];
+ break;
+ }
+ }
+
+ tbody.insertBefore( tr, insertTarget );
const th = document.createElement( "th" );
th.classList.add( "left" );
@@ -193,15 +203,11 @@ function createReadme( text, isMd ) {
setTimeout( runHighlight );
}
-function isCodeView() {
- return location.pathname.includes( "/tree/src" );
+function isCodeView( repo ) {
+ return location.pathname.includes( `/${repo}/tree` );
}
const main = async () => {
- if( isCodeView() ) {
- return setTimeout( runHighlight );
- }
-
const mainEl = document.querySelector( ".main" );
if( !mainEl )
return;
@@ -214,10 +220,12 @@ const main = async () => {
if( !repo )
return;
+ if( isCodeView( repo ) )
+ return setTimeout( runHighlight );
+
if( !isIndex( repo ) )
return;
- const branch = branchFromForm();
const { file, isMd } = await getReadmeFile( repo, branch );
createReadme( file, isMd );
}