向打工搬砖人致敬!

这是一个网页应用,使用JavaScript和jQuery库实现每日工作倒计时功能。对于996工作制的打工者来说,它显示距离下班的剩余时间,周末则提前至16:00下班。页面简洁,动态更新,帮助打工人们追踪工作日的结束。
摘要由CSDN通过智能技术生成

向打工搬砖人致敬

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>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值