Auto Punch

clock checking

目前为 2024-08-10 提交的版本。查看 最新版本

// ==UserScript==
// @name         Auto Punch
// @namespace    http://tampermonkey.net/
// @version      2024-08-10
// @description  clock checking
// @author       You
// @match        *://timestar.insperity.com/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=insperity.com
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    const KEEP_CHECKING_TIME=240000;//每隔多少分钟去点击一下按钮并且检测是否够8:00
    const CHECK_LOGIN_TIME=1000;//检测登陆与否的间隔时间
    const CLOCK_IN_TIME="8:0";

    let i=1;
    let base = setInterval(function(){

        console.log("尝试次数"+ i);
        i++;
        if($(".header_punch_link").length>0){

            setInterval(function(){//负责控制seccion不过期
                if($(".clock_punch_category_btn ").length==0){
                    $(".header_punch_link").click()
                }
                let nowTime=new Date().getHours()+":"+new Date().getMinutes();
                console.log(nowTime);
                $(".header_link.timestar_link").text("更新时间---"+nowTime+":"+new Date().getSeconds())
                if(nowTime!=CLOCK_IN_TIME){
                    $(".company_logo_link").click()
                    // ui-icon-closethick
                }
            }, KEEP_CHECKING_TIME);
            clearInterval(base);
        }
    },CHECK_LOGIN_TIME);

    setInterval(function(){//打卡侦测

        let nowTime=new Date().getHours()+":"+new Date().getMinutes();
        if($(".clock_punch_category_btn ").length==0){
            $(".header_punch_link").click()
        }
        $(".clock_punch_category_btn").each(function(){
            if(this.innerText=="IN FOR DAY" && nowTime==CLOCK_IN_TIME){
                $(this).click();
            }else{
                console.log(nowTime+":"+new Date().getSeconds())
            }
        })
    },60000)

    // Your code here...
})();

QingJ © 2025

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