Browse Source

Merge branch 'ps/gitweb-js-with-lineno'

* ps/gitweb-js-with-lineno:
  gitweb: Fix links to lines in blobs when javascript-actions are enabled
maint
Junio C Hamano 14 years ago
parent
commit
59b32ff338
  1. 8
      gitweb/static/js/javascript-detection.js

8
gitweb/static/js/javascript-detection.js

@ -16,7 +16,7 @@
* and other reasons to not add 'js=1' param at the end of link * and other reasons to not add 'js=1' param at the end of link
* @constant * @constant
*/ */
var jsExceptionsRe = /[;?]js=[01]$/; var jsExceptionsRe = /[;?]js=[01](#.*)?$/;


/** /**
* Add '?js=1' or ';js=1' to the end of every link in the document * Add '?js=1' or ';js=1' to the end of every link in the document
@ -33,9 +33,9 @@ function fixLinks() {
var allLinks = document.getElementsByTagName("a") || document.links; var allLinks = document.getElementsByTagName("a") || document.links;
for (var i = 0, len = allLinks.length; i < len; i++) { for (var i = 0, len = allLinks.length; i < len; i++) {
var link = allLinks[i]; var link = allLinks[i];
if (!jsExceptionsRe.test(link)) { // =~ /[;?]js=[01]$/; if (!jsExceptionsRe.test(link)) {
link.href += link.href = link.href.replace(/(#|$)/,
(link.href.indexOf('?') === -1 ? '?' : ';') + 'js=1'; (link.href.indexOf('?') === -1 ? '?' : ';') + 'js=1$1');
} }
} }
} }

Loading…
Cancel
Save