From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jakub Narebski Subject: Re: [PATCH] gitweb: Don't append ';js=(0|1)' to external links Date: Fri, 2 Dec 2011 21:44:44 +0100 Message-ID: <201112022144.45531.jnareb@gmail.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: git@vger.kernel.org To: =?utf-8?q?J=C3=BCrgen_Kreileder?= X-From: git-owner@vger.kernel.org Fri Dec 02 21:44:56 2011 Return-path: Envelope-to: gcvg-git-2@lo.gmane.org Received: from vger.kernel.org ([209.132.180.67]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1RWZyZ-00053a-BK for gcvg-git-2@lo.gmane.org; Fri, 02 Dec 2011 21:44:55 +0100 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754948Ab1LBUou convert rfc822-to-quoted-printable (ORCPT ); Fri, 2 Dec 2011 15:44:50 -0500 Received: from mail-ww0-f44.google.com ([74.125.82.44]:53580 "EHLO mail-ww0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754852Ab1LBUou (ORCPT ); Fri, 2 Dec 2011 15:44:50 -0500 Received: by wgbdr13 with SMTP id dr13so1825612wgb.1 for ; Fri, 02 Dec 2011 12:44:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:subject:date:user-agent:cc:references:in-reply-to :mime-version:content-type:content-transfer-encoding :content-disposition:message-id; bh=Y2TZKNVhBIPnEk0C5BFF8YT0b/x5OFscytwzGYH7XHs=; b=WgrgGo29Kg5CimgxDLVM2UcDV6/20m1NMXmBvi/cBSeFshiMhV8Ikt8BEXXAfNBzvm LELch9o+Px1gLq1E7Mltl5zPZVOXa7Wv+IkEnYknw+gsLFhXbvH1J659vADo+ZIThrpb K5G90rRZsFkvldNWpBWp7uJlxrrSE+T3EkqBg= Received: by 10.227.207.201 with SMTP id fz9mr7297796wbb.25.1322858689042; Fri, 02 Dec 2011 12:44:49 -0800 (PST) Received: from [192.168.1.15] (abwh218.neoplus.adsl.tpnet.pl. [83.8.231.218]) by mx.google.com with ESMTPS id gd6sm12013851wbb.1.2011.12.02.12.44.46 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 02 Dec 2011 12:44:47 -0800 (PST) User-Agent: KMail/1.9.3 In-Reply-To: Content-Disposition: inline Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Archived-At: On Tue, 29 Nov 2011, J=C3=BCrgen Kreileder wrote: > On Tue, Nov 29, 2011 at 20:28, Jakub Narebski wrot= e: > > J=C3=BCrgen Kreileder writes: > [...] > > Thanks for this, but I think a better solution would be to explicit= ly > > mark the few external links we have e.g. with 'class=3D"external"',= and > > use that to avoid adding ';js=3D(0|1)' to them. >=20 > This won't work because there are more than a few external links. Th= ink of > links added in the header or footer or via a project specific README.= html. Thanks for noticing that. =20 > 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 ca= ses (they always include $my_url), or add ';js=3D(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 rewo= rk how ';js=3D(0|1)' is generated. Instead of fixing links on load, we co= uld add an event handler[1] which on clicking the link[2] would add=20 ';js=3D(0|1)'... and there you can check if we are inside README.html e= tc. by examining DOM (perhaps those externally added fragments would need t= o be wrapped in div / span with "external" class, though). =20 [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=3D(0|1)' or not... and whether it is a ba= d 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 --=20 Jakub Narebski Poland