向打工搬砖人致敬
996是打工人的归宿。是一种福报~
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>每日搬砖倒计时</title>
<style>
.date {
margin: auto;
width: 1000px;
height: 30px;
line-height: 30px;
background-color: #fff;
color: red;
font-weight: bold;
font-size: 30px;
text-align: center;
padding-top: 25px;
}
#times {
margin: auto;
width: 1000px;
height: 250px;
line-height: 250px;
background-color: #fff;
color: #7afa5b;
font-size: 65px;
text-align: center;
padding-top: 25px;
}
</style>
<script src="https://ajax.aspnetcdn.com/ajax/jquery/jquery-3.7.0.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.countdown/2.2.0/jquery.countdown.min.js"></script>
</head>
<body>
<div class="date"></div>
<div id="times"></div>
<script>
setInterval(function () {
date = new Date();
year = date.getFullYear();
month = date.getMonth() + 1;
day = date.getDate();
week = date.getDay();
hours = date.getHours();
minutes = date.getMinutes();
weekArr = ["日", "一", "二", "三", "四", "五", "六"];
time = "18:00:00";
showTime = year + "/" + month + "/" + day + " 星期" + weekArr[week];
if (week == 6) {
time = "16:00:00";
}
endDate = year + "/" + month + "/" + day + " " + time;
$(".date").html(showTime);
if (week >= 1 && week <= 5) {
//周一至周五
if (hours < 9 || hours >= 18) {
$("#times").html("现在是休息时间٩(๑>◡<๑)۶");
} else if (hours >= 12 && hours <= 13) {
if (
(hours == 12 && minutes >= 0) ||
(hours == 13 && minutes <= 30)
) {
$("#times").html("现在是休息时间٩(๑>◡<๑)۶");
} else {
$("#times").countdown(endDate, function (event) {
$(this).html(
event.strftime("╭(╯^╰)╮距离下班时间还有 %H:%M:%S")
);
});
}
} else {
$("#times").countdown(endDate, function (event) {
$(this).html(event.strftime("╭(╯^╰)╮距离下班时间还有 %H:%M:%S"));
});
}
} else if (week == 6) {
//周六
if (hours < 9 || hours >= 16) {
$("#times").html("现在是休息时间٩(๑>◡<๑)۶");
} else if (hours >= 12 && hours <= 13) {
if (
(hours == 12 && minutes >= 0) ||
(hours == 13 && minutes <= 30)
) {
$("#times").html("现在是休息时间٩(๑>◡<๑)۶");
} else {
$("#times").countdown(endDate, function (event) {
$(this).html(
event.strftime("╭(╯^╰)╮距离下班时间还有 %H:%M:%S")
);
});
}
} else {
$("#times").countdown(endDate, function (event) {
$(this).html(event.strftime("╭(╯^╰)╮距离下班时间还有 %H:%M:%S"));
});
}
} else {
//周日
$("#times").html("今天是周日,全天休息٩(๑>◡<๑)۶");
}
}, 1000);
</script>
</body>
</html>