Skip to content

Commit

Permalink
add time page
Browse files Browse the repository at this point in the history
Signed-off-by: github-actions <github-actions@github.com>
  • Loading branch information
github-actions committed Apr 16, 2024
1 parent 6105ff7 commit 5e3d311
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 1 deletion.
53 changes: 53 additions & 0 deletions _primaryindex/time.html
@@ -0,0 +1,53 @@
---
layout: common
title: Time
permalink: /time
---

<link rel="stylesheet" href="/assets/flipclock/flipclock.css">
<script src="/assets/flipclock/flipclock.js"></script>
<div class="clock" style="margin-bottom:2em;margin-top:2em;display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;">
</div>
<!--
- Ajax @para counts
- Jquery-return-value-undefined @link { https://stackoverflow.com/questions/13848123/jquery-return-value-undefined }
-->
<script>
function setInitialCount() {
var currentTime = new Date();
var hours = currentTime.getHours();
var minutes = currentTime.getMinutes();
var seconds = currentTime.getSeconds();

var totalSeconds = hours * 3600 + minutes * 60 + seconds;
return totalSeconds;
}

var clock;
let All_Counts = setInitialCount();

$(document).ready(function() {
// Instantiate a counter
clock = new FlipClock($('.clock'), All_Counts , {
clockFace: 'HourlyCounter', // 使用 HourlyCounter 显示小时、分钟和秒数
});

// Attach a click event to a button an increment the clock
$('.increment').click(function() {
clock.increment();
});

// Attach a click event to a button a decrement the clock
$('.decrement').click(function() {
clock.decrement();
});

$('.reset').click(function() {
clock.reset();
});
});
</script>
6 changes: 5 additions & 1 deletion assets/flipclock/flipclock.css
Expand Up @@ -203,7 +203,11 @@
right: -86px;
color: black;
text-shadow: none; }

@media (prefers-color-scheme: dark) {
.flip-clock-divider .flip-clock-label {
color: white; /* 在暗黑模式下设置颜色为白色 */
}
}
.flip-clock-divider.minutes .flip-clock-label {
right: -88px; }

Expand Down

0 comments on commit 5e3d311

Please sign in to comment.