Conversaciones » Comentarios y opiniones sobre Greasy Fork

Line numbers above 9999 don't fit.

§
Publicado: 26/11/2023
Editado: 26/11/2023

There is seems to be a browser limitation for <ol> lists, where only last 4 digits are fit in the available width. So, if script has more than 9999 lines, it starts showing incorrect line numbers.

A quick CSS-only solution for modern browsers:

ol
{
  --offset: 3.5ch;
  padding-inline-start:var(--offset);
}
ol:has(li:nth-child(10)){--offset:4.5ch}
ol:has(li:nth-child(100)){--offset:5.5ch}
ol:has(li:nth-child(1000)){--offset:6.5ch}
ol:has(li:nth-child(10000)){--offset:7.5ch}
ol:has(li:nth-child(100000)){--offset:8.5ch}
ol:has(li:nth-child(1000000)){--offset:9.5ch}
ol:has(li:nth-child(10000000)){--offset:10.5ch}
ol:has(li:nth-child(100000000)){--offset:11.5ch}
ol:has(li:nth-child(1000000000)){--offset:12.5ch}
ol:has(li:nth-child(10000000000)){--offset:13.5ch}
ol:has(li:nth-child(100000000000)){--offset:14.5ch}
ol:has(li:nth-child(1000000000000)){--offset:15.5ch}

§
Publicado: 28/11/2023
Editado: 28/11/2023

Yes. The code viewer in GreasyFork is quite simple and basic.

You might consider using this to view code in GreasyFork. (just viewing, not editing)

https://greasyfork.org/en/scripts/472051

§
Publicado: 10/08/2024

You might consider using this to view code in GreasyFork. (just viewing, not editing)

It actually works about 5 times faster for larger scripts (10k+ lines) Thanks!

Publicar respuesta

Inicia sesión para responder.