summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMonty Taylor <mordred@redhat.com>2019-02-06 20:25:23 -0600
committertechknowlogick <matti@mdranta.net>2019-02-06 21:25:23 -0500
commit44d6a904d3c2e54c68759f062b28a626fd9f9254 (patch)
tree07e211a105877cfb372cf104f56cb98a7cdff898
parentda1edbfb79566e9d31f43ee85eb2e9fc9b52695b (diff)
downloadgitea-44d6a904d3c2e54c68759f062b28a626fd9f9254.tar.gz
gitea-44d6a904d3c2e54c68759f062b28a626fd9f9254.zip
Support n as a line highlight prefix (#5987)
We're working on rolling out gitea as a replacement for a fairly large cgit installation. Part of this involves a metric ton of mod_rewrite rules so that links people have out in the wild will still work. Unfortunately, cgit uses #n1 in the url to indicate a single line highlight, which doesn't get passed to the server and therefore can't be rewritten. We've got a local workaround by shoving a script block into a custom header template, but thought it might be nicer to upstream a simple patch to support #n as a prefix for single line highlights. (luckily for simplicity, cgit does not support ranges) Signed-off-by: Monty Taylor <mordred@inaugust.com>
-rw-r--r--public/js/index.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/public/js/index.js b/public/js/index.js
index cbfca147a7..5810647296 100644
--- a/public/js/index.js
+++ b/public/js/index.js
@@ -1602,9 +1602,9 @@ function initCodeView() {
$("html, body").scrollTop($first.offset().top - 200);
return;
}
- m = window.location.hash.match(/^#(L\d+)$/);
+ m = window.location.hash.match(/^#(L|n)(\d+)$/);
if (m) {
- $first = $list.filter('.' + m[1]);
+ $first = $list.filter('.L' + m[2]);
selectRange($list, $first);
$("html, body").scrollTop($first.offset().top - 200);
}