From: Jakub Narebski Date: Thu, 06 Aug 2009 17:11:52 GMT Subject: [PATCHv2/RFC 3/3] gitweb: Create links leading to 'blame_incremental' using JavaScript Message-ID: <1249578712-3862-4-git-send-email-jnareb@gmail.com> In-Reply-To: <1249578712-3862-1-git-send-email-jnareb@gmail.com> The new 'blame_incremental' view requires JavaScript to run. Not all web browsers implement JavaScript (e.g. text browsers such as Lynx), and not all users have JavaScript enabled. Therefore instead of unconditionally link to 'blame_incremental' view, we use JavaScript to convert those links to lead to view utilizing JavaScript, by adding 'js=1' to link. The only JavaScript-aware/using view is currently 'blame_incremental'. As first, it might want to have links to non-JavaScript version, and second, it should also use window.onload, we do not add nor run fixLinks() for such views (currently hardcoded 'blame_incremental') Possible enhancement would be to do JavaScript redirect by setting window.location instead of modifying $format and $action in git_blame_common() subroutine. This idea was originally implemented by Petr Baudis in http://article.gmane.org/gmane.comp.version-control.git/47614 but it added +HTML + } + print "\n" . ""; } @@ -4793,6 +4810,10 @@ sub git_tag { sub git_blame_common { my $format = shift || 'porcelain'; + if ($format eq 'porcelain' && $cgi->param('js')) { + $format = 'incremental'; + $action = 'blame_incremental'; # for page title etc + } # permissions gitweb_check_feature('blame') -- 1.6.3.3