微步下班倒计时

try to take over the world!

目前为 2023-08-13 提交的版本。查看 最新版本

// ==UserScript==
// @name         微步下班倒计时
// @namespace    http://tampermonkey.net/
// @version      2023年8月13日19点57分
// @description  try to take over the world!
// @author       wwsuixin
// @match        https://x.threatbook.com/
// @icon         https://www.google.com/s2/favicons?sz=64&domain=threatbook.com
// @grant        none
// ==/UserScript==

(function () {

    window.onload = setTimeout(click_item, 500);
    function click_item() {
        var xpath = '//*[@id="app"]/div[1]/div[1]/div[2]/div[6]/div[2]';
        var element = document.evaluate(xpath, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
        var newData = document.createElement('div');
        // 给这个div添加css
        newData.style.color = "red";
        newData.style.fontSize = "16px";
        newData.style.fontWeight = "bold";
        newData.style.fontFamily = "楷体";


        if (element) {

            // 执行上面的代码
            var 下班时间 = new Date();
            下班时间.setHours(22, 0, 0, 0);
            var 上班时间 = new Date();
            上班时间.setHours(8, 30, 0, 0);
            setInterval(function () {
                let 当前时间 = new Date();
                let 距离上班时间间隔 = 当前时间 - 上班时间;
                let 距离下班时间间隔 = 下班时间 - 当前时间;
                var 提示信息 = "";
                var 下班提示信息 = "";
                var 上班提示信息 = "";
                if (距离下班时间间隔 < 0) {
                    下班提示信息 = "警告:工作时间已经结束!"
                } else {
                    let days = Math.floor(距离下班时间间隔 / (1000 * 60 * 60 * 24));
                    let hours = Math.floor((距离下班时间间隔 % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
                    let minutes = Math.floor((距离下班时间间隔 % (1000 * 60 * 60)) / (1000 * 60));
                    let seconds = Math.floor((距离下班时间间隔 % (1000 * 60)) / 1000);
                    下班提示信息 = "🕙 距离下班:" + hours + "小时 " + minutes + "分钟 " + seconds + "秒"
                }

                let days = Math.floor(距离上班时间间隔 / (1000 * 60 * 60 * 24));
                let hours = Math.floor((距离上班时间间隔 % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
                let minutes = Math.floor((距离上班时间间隔 % (1000 * 60 * 60)) / (1000 * 60));
                let seconds = Math.floor((距离上班时间间隔 % (1000 * 60)) / 1000);
                上班提示信息 = "🕢 已经工作:" + hours + "小时 " + minutes + "分钟 " + seconds + "秒";

                提示信息 = "<span>"+上班提示信息 +"</span><br /><span>"+ 下班提示信息+"</span>"

                newData.innerHTML = 提示信息;
                element.appendChild(newData);
                //console.log(提示信息)
            },1000);
        } else {
            setTimeout(click_item, 300) //300 毫秒
        }
    }
})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址