Make JavaScript *actually* optional
[gitweb] / gitweb.cgi
index 099d2b39da01a5bbc6c5c125c82b1af8f2b80600..515d80cbded1e58b0ed9d2f5e34280752b23f4df 100755 (executable)
@@ -4310,10 +4310,10 @@ sub git_footer_html {
                insert_file($site_footer);
        }
 
-       print qq!<script type="text/javascript" src="!.esc_url($javascript).qq!"></script>\n!;
        if (defined $action &&
            $action eq 'blame_incremental') {
-               print qq!<script type="text/javascript">\n!.
+               print qq!<script src="!.esc_url($javascript).qq!"></script>\n!;
+               print qq!<script>\n!.
                      qq!startBlame("!. esc_attr(href(action=>"blame_data", -replay=>1)) .qq!",\n!.
                      qq!           "!. esc_attr(href()) .qq!");\n!.
                      qq!</script>\n!;
@@ -4321,17 +4321,20 @@ sub git_footer_html {
                my ($jstimezone, $tz_cookie, $datetime_class) =
                        gitweb_get_feature('javascript-timezone');
 
-               print qq!<script type="text/javascript">\n!.
-                     qq!window.onload = function () {\n!;
-               if (gitweb_check_feature('javascript-actions')) {
-                       print qq!       fixLinks();\n!;
-               }
-               if ($jstimezone && $tz_cookie && $datetime_class) {
-                       print qq!       var tz_cookie = { name: '$tz_cookie', expires: 14, path: '/' };\n!. # in days
-                             qq!       onloadTZSetup('$jstimezone', tz_cookie, '$datetime_class');\n!;
+               if (gitweb_check_feature('javascript-actions') || ($jstimezone && $tz_cookie && $datetime_class)) {
+                       print qq!<script src="!.esc_url($javascript).qq!"></script>\n!;
+                       print qq!<script>\n!.
+                               qq!window.onload = function () {\n!;
+                       if (gitweb_check_feature('javascript-actions')) {
+                               print qq!       fixLinks();\n!;
+                       }
+                       if ($jstimezone && $tz_cookie && $datetime_class) {
+                               print qq!       var tz_cookie = { name: '$tz_cookie', expires: 14, path: '/' };\n!. # in days
+                                       qq!     onloadTZSetup('$jstimezone', tz_cookie, '$datetime_class');\n!;
+                       }
+                       print qq!};\n!.
+                               qq!</script>\n!;
                }
-               print qq!};\n!.
-                     qq!</script>\n!;
        }
 
        print "</body>\n" .
@@ -4679,11 +4682,6 @@ sub git_print_log {
 
                print format_log_line_html($line) . "<br/>\n";
        }
-
-       if ($opts{'-final_empty_line'}) {
-               # end with single empty line
-               print "<br/>\n" unless $skip_blank_line;
-       }
 }
 
 # return link target (what link points to)
@@ -5925,13 +5923,12 @@ sub git_log_body {
                      $cgi->a({-href => href(action=>"commitdiff", hash=>$commit)}, "commitdiff") .
                      " | " .
                      $cgi->a({-href => href(action=>"tree", hash=>$commit, hash_base=>$commit)}, "tree") .
-                     "<br/>\n" .
                      "</div>\n";
                      git_print_authorship(\%co, -tag => 'span');
-                     print "<br/>\n</div>\n";
+                     print "</div>\n";
 
                print "<div class=\"log_body\">\n";
-               git_print_log($co{'comment'}, -final_empty_line=> 1);
+               git_print_log($co{'comment'});
                print "</div>\n";
        }
        if ($extra) {
@@ -8014,7 +8011,7 @@ sub git_commitdiff {
                print "<div class=\"page_body\">\n";
                if (@{$co{'comment'}} > 1) {
                        print "<div class=\"log\">\n";
-                       git_print_log($co{'comment'}, -final_empty_line=> 1, -remove_title => 1);
+                       git_print_log($co{'comment'}, -remove_title => 1);
                        print "</div>\n"; # class="log"
                }