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

2018-06-23 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 v3 6/6] line-range-highlight: copy URL to clipboard on click

2018-06-23 Thread Andy Green
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 each click of the line number links. Signed-off-by: Andy Green --- cgi

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

2018-06-23 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 v3 3/6] cgit.js: line range highlight: make responsive to url changes

2018-06-23 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 v3 2/6] ui-shared: line range highlight: introduce javascript

2018-06-23 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 v3 1/6] config: add js

2018-06-23 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 --- Makefile |1 + cgit.c |3 +++ cgit.h |1 + cgit.

[PATCH v3 0/6] line range highlight

2018-06-23 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 v2 3/5] ui-shared: introduce line range highlight javascript

2018-06-23 Thread Andy Green
On 06/23/2018 06:17 PM, John Keeping wrote: On Thu, Jun 21, 2018 at 05:34:59PM +0800, Andy Green wrote: This adds a small css class, a clientside js function in cgit.js, and ajs inline script caller in ui-shared functions to interpret the # part of the URL on the client, and apply a highlight

Re: [PATCH 2/2] ui-shared: emit root-desc-html and repo.desc-html after their text counterparts

2018-06-23 Thread John Keeping
On Sat, Jun 23, 2018 at 07:08:08PM +0800, Andy Green wrote: > > > On 06/23/2018 06:53 PM, John Keeping wrote: > > On Sat, Jun 23, 2018 at 06:33:38PM +0800, Andy Green wrote: > >> > >> > >> On 06/23/2018 06:28 PM, John Keeping wrote: > >>> On Thu, Jun 21, 2018 at 02:46:47PM +0800, Andy Green wrote

Re: [PATCH v4 00/16] Render READMEs inline in tree view

2018-06-23 Thread Andy Green
On 06/23/2018 07:04 PM, John Keeping wrote: On Wed, Jun 20, 2018 at 06:11:57PM +0800, Andy Green wrote: The following series adds config to allow rendering of selected READMEs inline after the tree view, where present in the directory being viewed. Particularly you can use completely relativ

Re: [PATCH 2/2] ui-shared: emit root-desc-html and repo.desc-html after their text counterparts

2018-06-23 Thread Andy Green
On 06/23/2018 06:53 PM, John Keeping wrote: On Sat, Jun 23, 2018 at 06:33:38PM +0800, Andy Green wrote: On 06/23/2018 06:28 PM, John Keeping wrote: On Thu, Jun 21, 2018 at 02:46:47PM +0800, Andy Green wrote: Where root-desc and repo.desc are used in the header region, also emit their html

Re: [PATCH v4 00/16] Render READMEs inline in tree view

2018-06-23 Thread John Keeping
On Wed, Jun 20, 2018 at 06:11:57PM +0800, Andy Green wrote: > The following series adds config to allow rendering of > selected READMEs inline after the tree view, where > present in the directory being viewed. > > Particularly you can use completely relative markdown to > inline pictures served f

Re: [PATCH 2/2] ui-shared: emit root-desc-html and repo.desc-html after their text counterparts

2018-06-23 Thread John Keeping
On Sat, Jun 23, 2018 at 06:33:38PM +0800, Andy Green wrote: > > > On 06/23/2018 06:28 PM, John Keeping wrote: > > On Thu, Jun 21, 2018 at 02:46:47PM +0800, Andy Green wrote: > >> Where root-desc and repo.desc are used in the header region, also > >> emit their html counterparts afterwards if they

Re: [PATCH] noheader: place branch combo on tabs if no header

2018-06-23 Thread John Keeping
On Wed, Jun 20, 2018 at 09:17:00PM +0800, Andy Green wrote: > noheader=1 stops the static page header from being emitted by > cgit, but along with that, the small form that lets the user > change branch context on the page is also lost. > > This isn't actually static since it contains a dynamic li

Re: [PATCH v2 1/5] config: add js

2018-06-23 Thread Andy Green
On 06/23/2018 06:20 PM, John Keeping wrote: On Thu, Jun 21, 2018 at 05:34:49PM +0800, Andy Green wrote: Just like the config allows setting css URL path, add a config for setting the js URL path Signed-off-by: Andy Green --- diff --git a/cgitrc.5.txt b/cgitrc.5.txt index 99fc799..a692aa5 10

Re: [PATCH 2/2] ui-shared: emit root-desc-html and repo.desc-html after their text counterparts

2018-06-23 Thread Andy Green
On 06/23/2018 06:28 PM, John Keeping wrote: On Thu, Jun 21, 2018 at 02:46:47PM +0800, Andy Green wrote: Where root-desc and repo.desc are used in the header region, also emit their html counterparts afterwards if they are defined. Where root-desc are repo.desc are used outside the header, eg

Re: [PATCH 2/2] ui-shared: emit root-desc-html and repo.desc-html after their text counterparts

2018-06-23 Thread John Keeping
On Thu, Jun 21, 2018 at 02:46:47PM +0800, Andy Green wrote: > Where root-desc and repo.desc are used in the header region, also > emit their html counterparts afterwards if they are defined. > > Where root-desc are repo.desc are used outside the header, > eg in the repo list, leave it as it is wit

Re: [PATCH v2 1/5] config: add js

2018-06-23 Thread John Keeping
On Thu, Jun 21, 2018 at 05:34:49PM +0800, Andy Green wrote: > Just like the config allows setting css URL path, > add a config for setting the js URL path > > Signed-off-by: Andy Green > --- > diff --git a/cgitrc.5.txt b/cgitrc.5.txt > index 99fc799..a692aa5 100644 > --- a/cgitrc.5.txt > +++ b/cg

Re: [PATCH v2 2/5] cgit.js: introduce

2018-06-23 Thread John Keeping
On Thu, Jun 21, 2018 at 05:34:54PM +0800, Andy Green wrote: > Similar to how cgit.css is handled, we will also provide and > reference a cgit.js for javascript from now on. > > Signed-off-by: Andy Green > --- I think we can merge this and the previous patch, along with the change to output a

Re: [PATCH v2 3/5] ui-shared: introduce line range highlight javascript

2018-06-23 Thread John Keeping
On Thu, Jun 21, 2018 at 05:34:59PM +0800, Andy Green wrote: > This adds a small css class, a clientside js function in > cgit.js, and ajs inline script caller in ui-shared > functions to interpret the # part of the URL > on the client, and apply a highlight to filtered source. > > Unlike blame hig

[PATCH v2] cgit.js: line range highlight: always hook hashchange in case hash added

2018-06-23 Thread Andy Green
Since the user might add a # to a URL that didn't initially have one, eg by clicking the line numbers, always register the hashchange listener. Signed-off-by: Andy Green --- cgit.js |4 ui-shared.c |5 - 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/cgit.js