[PATCH v5 2/6] cgit.js: line range highlight: introduce javascript

Jason A. Donenfeld Jason at zx2c4.com
Wed Jun 27 20:02:59 CEST 2018


Hi Andy,

I'm super hesitant about the Pandora's box that introducing javascript
implies, but perhaps there's no use in fighting the future.

A few notes:

- Your js needs the copyright line like the rest of the project.
- Rather than awkwardly namespacing global methods, wrap everything
inside a big anonymous function.
- 1.5s is way too long for an animation. In fact, I'm not sure what an
animation communicates at all, and perhaps we could get rid of it.
- Setting colors from inside js is a big no-no. Instead, add and
remove classes from elements, and leave the styling to css.

Also, can this be done from pure css? For example, certainly
highlighting one line in pure css based on the #anchor is possible,
via css link selectors.

Jason


More information about the CGit mailing list