]> bicyclesonthemoon.info Git - ott/bsta/commitdiff
generate timer
authorb <rowerynaksiezycu@gmail.com>
Sat, 7 Oct 2023 22:14:03 +0000 (22:14 +0000)
committerb <rowerynaksiezycu@gmail.com>
Sat, 7 Oct 2023 22:14:03 +0000 (22:14 +0000)
bsta_lib.1.pm

index 5697e6b30575a3c26d81954c7f1dee30a61a6ef3..2bcf82efcda4c29ebf98fd025c15c9acb656a34f 100644 (file)
@@ -754,10 +754,38 @@ sub print_viewer_page {
        my $access      = $context->{'access'};
        my $password_ok = $context->{'password_ok'};
        my $text_mode   = $context->{'text_mode'}
+       my $static      = $context->{'static'};
+       
+       my $timer_unlocked = int($context->{'timer_unlocked'});
+       my $timer          = int($context->{'timer'};
        
        my $last_frame = int($state->{'last'});
        my $ong_state  = int($state->{'state'});
        
+       my $timer_color_h = (($timer_unlocked >= 1) || ($ong_state >= STATE->{'ready'})) ? 'br' : 'ni';
+       my $timer_color_m = (($timer_unlocked >= 2) || ($ong_state >= STATE->{'ready'})) ? 'br' : 'ni';
+       my $timer_color_s = (($timer_unlocked >= 3) || ($ong_state >= STATE->{'ready'})) ? 'br' : 'ni';
+       
+       my $timer_h;
+       my $timer_m;
+       my $timer_s;
+       if ($timer > 0) {
+               $timer_s = sprintf('%02d', $timer % 60);
+               $timer_h = int($timer / 60);
+               $timer_m = sprintf('%02d', $timer_h % 60);
+               $timer_h = sprintf('%02d', $timer_h / 60);
+       }
+       elsif (($timer >= -15) && ($ong_state >= STATE->{'ready'})) {
+               $timer_h = '00';
+               $timer_m = '00';
+               $timer_s = 'NG';
+       }
+       else {
+               $timer_h = 'EE';
+               $timer_m = 'EE';
+               $timer_s = 'EE';
+       }
+       
        my $prev_available = (($frame > 0) && $access');
        my $next_available = ($password_ok' || ($next_frame <= $last_frame));
        my $prefetch_next  = (
@@ -830,7 +858,7 @@ sub print_viewer_page {
        $frame_url = $frame_indirect ?
                merge_url(
                        {'path' => CGI_FRAME_PATH()},
-                       {'path' => $context->{'frame'}}
+                       {'path' => $frame}
                ) :
                $frame_normal_url;
        $frame_full_url = merge_url(
@@ -959,7 +987,12 @@ sub print_viewer_page {
        }
        
        print $fh '<div id="command">'."\n";
-       # TODO
+       
+       if ($show_timer) {
+               print $fh '[<span id="ongh" class="'.$timer_color_h.'">'.$timer_h.'</span>';
+               print $fh ':<span id="ongm" class="'.$timer_color_m.'">'.$timer_m.'</span>';
+               print $fh ':<span id="ongm" class="'.$timer_color_s.'">'.$timer_s.'</span>]';
+       }
        
        print_html_body_end($fh);
        print_html_end($fh);