From: jk@blackdown•de (Jürgen Kreileder)
To: git@vger•kernel.org
Subject: [PATCH 3/4] gitweb: Don't append ';js=(0|1)' to external links
Date: Mon, 08 Apr 2013 22:09:48 +0200 [thread overview]
Message-ID: <m2wqscbx83.fsf@blackdown.de> (raw)
Don't add js parameters to links outside of gitweb itself.
Signed-off-by: Jürgen Kreileder <jk@blackdown•de>
---
gitweb/gitweb.perl | 2 +-
gitweb/static/js/javascript-detection.js | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 1309196..f0912d7 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -4165,7 +4165,7 @@ sub git_footer_html {
print qq!<script type="text/javascript">\n!.
qq!window.onload = function () {\n!;
if (gitweb_check_feature('javascript-actions')) {
- print qq! fixLinks();\n!;
+ print qq! fixLinks('$my_url');\n!;
}
if ($jstimezone && $tz_cookie && $datetime_class) {
print qq! var tz_cookie = { name: '$tz_cookie', expires: 14, path: '/' };\n!. # in days
diff --git a/gitweb/static/js/javascript-detection.js b/gitweb/static/js/javascript-detection.js
index fa2596f..36964ad 100644
--- a/gitweb/static/js/javascript-detection.js
+++ b/gitweb/static/js/javascript-detection.js
@@ -29,11 +29,11 @@ var jsExceptionsRe = /[;?]js=[01](#.*)?$/;
*
* @globals jsExceptionsRe
*/
-function fixLinks() {
+function fixLinks(baseurl) {
var allLinks = document.getElementsByTagName("a") || document.links;
for (var i = 0, len = allLinks.length; i < len; i++) {
var link = allLinks[i];
- if (!jsExceptionsRe.test(link)) {
+ if (!jsExceptionsRe.test(link) && !link.href.indexOf(baseurl)) {
link.href = link.href.replace(/(#|$)/,
(link.href.indexOf('?') === -1 ? '?' : ';') + 'js=1$1');
}
--
1.7.10.4
next reply other threads:[~2013-04-08 20:10 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-08 20:09 Jürgen Kreileder [this message]
2013-04-09 15:16 ` [PATCH 3/4] gitweb: Don't append ';js=(0|1)' to external links Jakub Narębski
2013-04-09 17:54 ` Jürgen Kreileder
2013-04-09 17:59 ` Jakub Narębski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m2wqscbx83.fsf@blackdown.de \
--to=jk@blackdown$(echo .)de \
--cc=git@vger$(echo .)kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox