QidianTimer

Open qidian website automatically

当前为 2020-05-06 提交的版本,查看 最新版本

// ==UserScript==
// @name         QidianTimer
// @namespace    https://saltbo.cn/
// @version      0.2
// @description  Open qidian website automatically
// @author       saltbo
// @match        http*://*/*
// @exclude      /^https?://my\.qidian\.com/*
// @grant        GM_openInTab
// @grant        GM_setValue
// @grant        GM_getValue

// ==/UserScript==

(function() {
    'use strict';

    let timeIntervals = [0, 300, 600, 1200, 1800, 3600, 3600, 3600]
    let todayCntKey = "today_cnt"
    let lastCheckTimeKey = "last_check_time"
    let nowTime = new Date().getTime();

    let todayCnt = GM_getValue(todayCntKey, 0)
    let lastCheckTime = GM_getValue(lastCheckTimeKey, nowTime)
    let nowInterval = (nowTime-lastCheckTime)/1000

    console.log("QidianTimer: ", nowInterval, timeIntervals[todayCnt])
    if(nowInterval >= timeIntervals[todayCnt]){
        let tab = GM_openInTab("https://my.qidian.com/level", true)
        setTimeout(tab.close, 5000)
        todayCnt++
        if(todayCnt > timeIntervals.length){
            todayCnt=0
        }

        GM_setValue(todayCntKey, todayCnt)
        GM_setValue(lastCheckTimeKey, nowTime)
    }
})();

QingJ © 2025

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