From 2f4b118cd28600216d40df776e0fead81a41d5cb Mon Sep 17 00:00:00 2001 From: aura Date: Tue, 17 Feb 2026 01:01:48 +0100 Subject: fix git readmes --- web/cgit-extra.html | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) (limited to 'web/cgit-extra.html') 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 ); } -- cgit v1.2.3