From: Jakub Narebski Date: Fri, 24 Jul 2009 22:44:10 GMT Subject: [PATCH/RFC 10/10] gitweb: Create links leading to 'blame_incremental' using JavaScript Message-ID: <1248475450-5668-11-git-send-email-jnareb@gmail.com> In-Reply-To: <1248475450-5668-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" . ""; } @@ -4794,6 +4811,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