git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Narebski <jnareb@gmail.com>
To: "Jürgen Kreileder" <jk@blackdown.de>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] gitweb: Don't append ';js=(0|1)' to external links
Date: Fri, 2 Dec 2011 21:44:44 +0100	[thread overview]
Message-ID: <201112022144.45531.jnareb@gmail.com> (raw)
In-Reply-To: <CAKD0UuyH3m0RR2=jk5apFjVMgbD5iWeztR94mE-m7q9dyYKR2Q@mail.gmail.com>

On Tue, 29 Nov 2011, Jürgen Kreileder wrote:
> On Tue, Nov 29, 2011 at 20:28, Jakub Narebski <jnareb@gmail.com> wrote:
> > Jürgen Kreileder <jk@blackdown.de> writes:
> [...]
> > Thanks for this, but I think a better solution would be to explicitly
> > mark the few external links we have e.g. with 'class="external"', and
> > use that to avoid adding ';js=(0|1)' to them.
> 
> This won't work because there are more than a few external links.  Think of
> links added in the header or footer or via a project specific README.html.

Thanks for noticing that.
 
> You would have to do it the other way round: Mark all internal links.

In this case your solution is better... provided that you either check
that all internal links generated by gitweb are absolute URLs in all cases
(they always include $my_url), or add ';js=(0|1)' also for relative
URLs (i.e. not starting with http:// or https://).


Well... the "mark external" idea would also work, provided that we rework
how ';js=(0|1)' is generated.  Instead of fixing links on load, we could
add an event handler[1] which on clicking the link[2] would add 
';js=(0|1)'... and there you can check if we are inside README.html etc.
by examining DOM (perhaps those externally added fragments would need to
be wrapped in div / span with "external" class, though).
 
[1] You assign event handler to 'html' or 'body' element, and check in
    handler where you clicked; that is what we do for JavaScript
    timezone stuff.

[2] I am not sure if "Open in new tab" from context menu or Ctrl-Click
    would trigger adding ';js=(0|1)' or not... and whether it is a bad
    thing or not.


> > This has the advantage that we can use different style to mark
> > outgoing external links.

I think this advantage might be worth it, even without changes to
javascript-detection.js

-- 
Jakub Narebski
Poland

      reply	other threads:[~2011-12-02 20:44 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-29  0:53 [PATCH] gitweb: Don't append ';js=(0|1)' to external links Jürgen Kreileder
2011-11-29 19:28 ` Jakub Narebski
2011-11-29 21:31   ` Jürgen Kreileder
2011-12-02 20:44     ` Jakub Narebski [this message]

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=201112022144.45531.jnareb@gmail.com \
    --to=jnareb@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=jk@blackdown.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
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;
as well as URLs for NNTP newsgroup(s).