X-Git-Url: https://git.ladys.computer/Gitweb/blobdiff_plain/66d984589fe19ceefaf5a2d5840d3843664b7f12753457ca516354553b2236da..bb4147f079a40ce6926233cddb401eaaa55c9d0ebcd1563bc49865d0378f4ddd:/gitweb.perl diff --git a/gitweb.perl b/gitweb.perl index ca3d1a9..8338cb9 100755 --- a/gitweb.perl +++ b/gitweb.perl @@ -492,6 +492,18 @@ our %feature = ( 'override' => 0, 'default' => [0]}, + # Enable and configure ability to change common timezone for dates + # in gitweb output via JavaScript. Enabled by default. + # Project specific override is not supported. + 'javascript-timezone' => { + 'override' => 0, + 'default' => [ + 'local', # default timezone: 'utc', 'local', or '(-|+)HHMM' format, + # or undef to turn off this feature + 'gitweb_tz', # name of cookie where to store selected timezone + 'datetime', # CSS class used to mark up dates for manipulation + ]}, + # Syntax highlighting support. This is based on Daniel Svensson's # and Sham Chukoury's work in gitweb-xmms2.git. # It requires the 'highlight' program present in $PATH, @@ -3886,9 +3898,20 @@ sub git_footer_html { qq!startBlame("!. href(action=>"blame_data", -replay=>1) .qq!",\n!. qq! "!. href() .qq!");\n!. qq!\n!; - } elsif (gitweb_check_feature('javascript-actions')) { + } else { + my ($jstimezone, $tz_cookie, $datetime_class) = + gitweb_get_feature('javascript-timezone'); + print qq!\n!; } @@ -4096,6 +4119,12 @@ sub format_timestamp_html { my $date = shift; my $strtime = $date->{'rfc2822'}; + my (undef, undef, $datetime_class) = + gitweb_get_feature('javascript-timezone'); + if ($datetime_class) { + $strtime = qq!$strtime!; + } + my $localtime_format = '(%02d:%02d %s)'; if ($date->{'hour_local'} < 6) { $localtime_format = '(%02d:%02d %s)';