From mboxrd@z Thu Jan 1 00:00:00 1970 From: andy at warmcat.com (Andy Green) Date: Mon, 25 Jun 2018 13:49:38 +0800 Subject: [PATCH v4 0/6] line range highlight In-Reply-To: References: Message-ID: <152990555757.7905.14197867245146259317.stgit@mail.warmcat.com> 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 specify its url, defaulting to "/cgit.js". It can be disabled by setting the "js" config to an empty string. Since v3 the JS had a cleanup from comments, and there is now a clipboard icon (unrelated to clippy...) that appears for 5s after clicking on a line number link to change the highlight. If you click on it, it copies the current highlight #URL to the clipboard so you can share it. You can find the patches as a usable tree here https://warmcat.com/git/cgit/log/ Examples: https://libwebsockets.org/git/libwebsockets/tree/lib/core/private.h#n152 https://libwebsockets.org/git/libwebsockets/tree/lib/core/private.h#n39-47 --- Andy Green (6): config: add js cgit.js: line range highlight: introduce javascript cgit.js: line range highlight: make responsive to url changes cgit.js: line range highlight: improve vertical scroll logic line-range-highlight: onclick handler and range selection line-range-highlight: copy URL to clipboard UI Makefile | 1 cgit.c | 3 + cgit.css | 27 ++++++ cgit.h | 1 cgit.js | 244 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ cgitrc.5.txt | 5 + ui-blame.c | 2 ui-shared.c | 5 + ui-tree.c | 2 9 files changed, 288 insertions(+), 2 deletions(-) create mode 100644 cgit.js -- Signature