From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jason at zx2c4.com (Jason A. Donenfeld) Date: Wed, 27 Jun 2018 20:02:59 +0200 Subject: [PATCH v5 2/6] cgit.js: line range highlight: introduce javascript In-Reply-To: <153001232465.12484.1444048603463034115.stgit@mail.warmcat.com> References: <153001215740.12484.13344875445662026876.stgit@mail.warmcat.com> <153001232465.12484.1444048603463034115.stgit@mail.warmcat.com> Message-ID: 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