[PATCH 1/3] ui-shared: introduce line range highlight javascript

Andy Green andy at warmcat.com
Thu Jun 21 09:30:59 CEST 2018



On 06/21/2018 03:03 PM, Christian Hesse wrote:
> Andy Green <andy at warmcat.com> on Thu, 2018/06/21 13:42:
>> This adds a small css class and a function in ui-shared that
>> emits canned javascript to interpret the # part of the URL
>> on the client, and apply a highlight to filtered source.

      "      			e1.style.backgroundColor =
>> \"yellow\";\n"
>> +	     "			}\n"
>> +	     "\n"
>> +	     "			e.scrollIntoView(true);\n"
>> +	     "		}\n"
>> +	     "	}\n"
>> +	     "}\n"
>> +	     "\n"
>> +	     "document.addEventListener(\"DOMContentLoaded\", function() {"
>> +	     "	cgit_line_range_highlight();\n"
>> +	     "}, false);\n"
>> +	     "</script>\n");
>> +}
> 
> I would prefer to have this in a file cgit.js (much like cgit.css).

OK... for the main part of it, it makes sense.  And have it brought in 
in HEAD.  Because I think the direction of the JS stuff is that it will 
only want to increase once it's a thing.

For the stuff using it or not though, it will still want to have its own 
little <script> and schedule or call the main stuff inline.

-Andy


More information about the CGit mailing list