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

2018-06-24 Thread Andy Green
This adds a small css class, and a clientside js function plus event registrations in cgit.js, to interpret the # part of the URL on the client, and apply a highlight to filtered source. Unlike blame highlight boxes which use generated divs, this applies a computed absolutely-positioned, transpare

[PATCH v4 4/6] cgit.js: line range highlight: improve vertical scroll logic

2018-06-24 Thread Andy Green
Instead of following the browser heuristic to put any matching id element to the top left of the browser window, compute the number of visible lines vertically in the window, and the middle of the highlit range, and try to centre the middle of the highlit range in the window. If the top of the ran

[PATCH v4 3/6] cgit.js: line range highlight: make responsive to url changes

2018-06-24 Thread Andy Green
Browser default interpretation of the # part of the URL is to try to match it to an element ID one time at page load. Subsequent modifications in the URL bar are ignored, even if you hit enter there. This patch makes the line range highlight able to clean up after itself and be reapplied, and has

[PATCH v4 5/6] line-range-highlight: onclick handler and range selection

2018-06-24 Thread Andy Green
This allows the user to select line ranges simply by clicking on the line number links. - No selected highlit line, or a range already selected, causes the click to highlight just the clicked line as usual. - Clicking on a second line number link when a single line was already highlit creates a

[PATCH v4 1/6] config: add js

2018-06-24 Thread Andy Green
Just like the config allows setting css URL path, add a config for setting the js URL path Setting the js path to an empty string disables emitting the reference to it in the head section. Signed-off-by: Andy Green Reviewed-by: John Keeping --- Makefile |1 + cgit.c |3 +++ c

[PATCH v4 6/6] line-range-highlight: copy URL to clipboard UI

2018-06-24 Thread Andy Green
Clicking on the line numbers to control the highlight now causes a clipboard icon to appear to the left of the line for 5s. Clicking this will copy the highlight URL to the clipboard, and cause the icon to grow, blur and fade to acknowledge the click. After 5s the clipboard icon will fade out...

[PATCH v4 0/6] line range highlight

2018-06-24 Thread Andy Green
The following series adds the ability to direct the browser to highlight specific lines and ranges of lines in /tree/, /source/, and /blame/ views, using the existing #URLs. As part of the implementation it adds a new cgit.js file that is included in cgit page along with a new config "js" to spec

Re: [PATCH v3 5/6] line-range-highlight: onclick handler and range selection

2018-06-24 Thread Andy Green
On 06/24/2018 07:35 PM, John Keeping wrote: On Sun, Jun 24, 2018 at 10:44:49AM +0800, Andy Green wrote: This allows the user to select line ranges simply by clicking on the line number links. - No selected highlit line, or a range already selected, causes the click to highlight just the cl

Re: [PATCH v3 2/6] ui-shared: line range highlight: introduce javascript

2018-06-24 Thread Andy Green
On 06/24/2018 07:28 PM, John Keeping wrote: The subject is "ui-shared: ..." but should be "cgit.js" now I think. On Sun, Jun 24, 2018 at 10:44:34AM +0800, Andy Green wrote: diff --git a/cgit.js b/cgit.js index e69de29..501c98f 100644 --- a/cgit.js +++ b/cgit.js @@ -0,0 +1,53 @@ +function cgi

Re: [PATCH v3 6/6] line-range-highlight: copy URL to clipboard on click

2018-06-24 Thread Andy Green
On June 25, 2018 12:03:56 AM GMT+08:00, John Keeping wrote: >On Sun, Jun 24, 2018 at 11:06:45PM +0800, Andy Green wrote: >> On June 24, 2018 9:39:35 PM GMT+08:00, John Keeping > wrote: >> >On Sun, Jun 24, 2018 at 08:00:08PM +0800, Andy Green wrote: >> >> On June 24, 2018 7:42:33 PM GMT+08:00, J

Re: [PATCH] cgit.css: add dynamic age update

2018-06-24 Thread Andy Green
On June 25, 2018 6:58:06 AM GMT+08:00, Christian Hesse wrote: >John Keeping on Sun, 2018/06/24 12:52: >> I'd really like to here other people's opinions on this. > >I like this change, but we should keep js optional and not break >existing >functionality without it. (I did not look at the code

Re: [PATCH] cgit.css: add dynamic age update

2018-06-24 Thread Christian Hesse
John Keeping on Sun, 2018/06/24 12:52: > I'd really like to here other people's opinions on this. I like this change, but we should keep js optional and not break existing functionality without it. (I did not look at the code, but discussion sounds like it is good as-is.) -- main(a){char*c=/*

Re: [PATCH v3 6/6] line-range-highlight: copy URL to clipboard on click

2018-06-24 Thread John Keeping
On Sun, Jun 24, 2018 at 11:06:45PM +0800, Andy Green wrote: > On June 24, 2018 9:39:35 PM GMT+08:00, John Keeping > wrote: > >On Sun, Jun 24, 2018 at 08:00:08PM +0800, Andy Green wrote: > >> On June 24, 2018 7:42:33 PM GMT+08:00, John Keeping > > wrote: > >> >On Sun, Jun 24, 2018 at 10:44:54AM +0

Re: [PATCH v3 6/6] line-range-highlight: copy URL to clipboard on click

2018-06-24 Thread Andy Green
On June 24, 2018 9:39:35 PM GMT+08:00, John Keeping wrote: >On Sun, Jun 24, 2018 at 08:00:08PM +0800, Andy Green wrote: >> >> >> On June 24, 2018 7:42:33 PM GMT+08:00, John Keeping > wrote: >> >On Sun, Jun 24, 2018 at 10:44:54AM +0800, Andy Green wrote: >> >> Since the only reason to click on

Re: [PATCH v3 6/6] line-range-highlight: copy URL to clipboard on click

2018-06-24 Thread John Keeping
On Sun, Jun 24, 2018 at 08:00:08PM +0800, Andy Green wrote: > > > On June 24, 2018 7:42:33 PM GMT+08:00, John Keeping > wrote: > >On Sun, Jun 24, 2018 at 10:44:54AM +0800, Andy Green wrote: > >> Since the only reason to click on the line number links > >> is to get the corresponding #URL to sha

Re: [PATCH] cgit.css: add dynamic age update

2018-06-24 Thread Andy Green
On June 24, 2018 7:52:53 PM GMT+08:00, John Keeping wrote: >Subject should be "cgit.js: " not cgit.css! > >On Sun, Jun 24, 2018 at 03:59:51PM +0800, Andy Green wrote: >> This patch updates the emitted "ages" dynamically on the client side. >> >> After updating on completion of the document loa

Re: [PATCH v3 6/6] line-range-highlight: copy URL to clipboard on click

2018-06-24 Thread Andy Green
On June 24, 2018 7:42:33 PM GMT+08:00, John Keeping wrote: >On Sun, Jun 24, 2018 at 10:44:54AM +0800, Andy Green wrote: >> Since the only reason to click on the line number links >> is to get the corresponding #URL to share, this patch >> makes that process more convenient by copying the >> hig

Re: [PATCH] cgit.css: add dynamic age update

2018-06-24 Thread John Keeping
Subject should be "cgit.js: " not cgit.css! On Sun, Jun 24, 2018 at 03:59:51PM +0800, Andy Green wrote: > This patch updates the emitted "ages" dynamically on the client side. > > After updating on completion of the document load, it sets a timer > to update according to the smallest age it found

Re: [PATCH v3 6/6] line-range-highlight: copy URL to clipboard on click

2018-06-24 Thread John Keeping
On Sun, Jun 24, 2018 at 10:44:54AM +0800, Andy Green wrote: > Since the only reason to click on the line number links > is to get the corresponding #URL to share, this patch > makes that process more convenient by copying the > highlit area, be it a single line or a range, to the > clipboard on eac

Re: [PATCH v3 5/6] line-range-highlight: onclick handler and range selection

2018-06-24 Thread John Keeping
On Sun, Jun 24, 2018 at 10:44:49AM +0800, Andy Green wrote: > This allows the user to select line ranges simply by clicking on the > line number links. > > - No selected highlit line, or a range already selected, causes the > click to highlight just the clicked line as usual. > > - Clicking on

Re: [PATCH v3 2/6] ui-shared: line range highlight: introduce javascript

2018-06-24 Thread John Keeping
The subject is "ui-shared: ..." but should be "cgit.js" now I think. On Sun, Jun 24, 2018 at 10:44:34AM +0800, Andy Green wrote: > diff --git a/cgit.js b/cgit.js > index e69de29..501c98f 100644 > --- a/cgit.js > +++ b/cgit.js > @@ -0,0 +1,53 @@ > +function cgit_line_range_highlight() > +{ > +

Re: [PATCH v3 1/6] config: add js

2018-06-24 Thread John Keeping
On Sun, Jun 24, 2018 at 10:44:29AM +0800, Andy Green wrote: > Just like the config allows setting css URL path, > add a config for setting the js URL path > > Setting the js path to an empty string disables > emitting the reference to it in the head section. > > Signed-off-by: Andy Green For th

[PATCH] cgit.css: add dynamic age update

2018-06-24 Thread Andy Green
This patch updates the emitted "ages" dynamically on the client side. After updating on completion of the document load, it sets a timer to update according to the smallest age it found. If there are any ages listed in minutes, then it will update again in 10s (this can never happen more than twe