Discussions » Greasy Fork Feedback

Line numbers above 9999 don't fit.

§
Posted: 2023-11-26
Edited: 2023-11-26

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}

§
Posted: 2023-11-28
Edited: 2023-11-28

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

Post reply

Sign in to post a reply.