// ==UserScript== // @name 快点做正事! 结合Todoist帮助你专心工作 // @namespace * // @version 0.4 // @description 帮助提醒你限制娱乐时长,专心工作,同时提醒你每日任务,需要注册Todoist(https://todoist.com) // @include * // @author kwp // @match * // @grant GM_setValue // @grant GM_getValue // @grant GM_openInTab // @grant GM_registerMenuCommand // @require https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js // @downloadURL https://update.greasyfork.icu/scripts/379346/%E5%BF%AB%E7%82%B9%E5%81%9A%E6%AD%A3%E4%BA%8B%EF%BC%81%20%E7%BB%93%E5%90%88Todoist%E5%B8%AE%E5%8A%A9%E4%BD%A0%E4%B8%93%E5%BF%83%E5%B7%A5%E4%BD%9C.user.js // @updateURL https://update.greasyfork.icu/scripts/379346/%E5%BF%AB%E7%82%B9%E5%81%9A%E6%AD%A3%E4%BA%8B%EF%BC%81%20%E7%BB%93%E5%90%88Todoist%E5%B8%AE%E5%8A%A9%E4%BD%A0%E4%B8%93%E5%BF%83%E5%B7%A5%E4%BD%9C.meta.js // ==/UserScript== let block_urls = [ /https?:\/\/.*?\.bilibili\.com.*?/, /https?:\/\/.*?\.?weibo\..*?/, /https?:\/\/.*?steampowered\..*?/, /https?:\/\/.*?\.douyu\..*?/, /https?:\/\/.*?\.?nga\..*?/, /https?:\/\/.*?\.?acfun\..*?/, /https?:\/\/.*?\.?zhihu\..*?/, /https?:\/\/.*?\.?4399\..*?/, /https?:\/\/.*?\.?youku\..*?/, /https?:\/\/.*?\.?iqiyi\..*?/, /https?:\/\/.*?\.?youtube\..*?/, /https?:\/\/v\.qq.com.*?/, ]; (function () { 'use strict'; const todoist_token = GM_getValue("todoist_token", ""); const max_minutes = GM_getValue("max_minutes", 30); let first_launch = GM_getValue("first_lanuch", true); if (first_launch) { let idUrl = "https://todoist.com/prefs/integrations"; alert("欢迎使用!\n请在打开的窗口内复制API置换符,然后在油猴的配置中点击 \"设置 Todoist Token\" 以修改"); GM_openInTab(idUrl); GM_setValue("first_lanuch", false); return; } let ID = Date(); // 脚本ID GM_setValue("runID", ID); let today = new Date(); let key = today.getFullYear() + "-" + today.getMonth() + "-" + today.getDate(); let second = GM_getValue(key, 0); let url = location.href; let block = false; block_urls.some((pattern, i) => { if (url.match(pattern)) { console.log("match" + pattern); block = true; return true; } }); if (!block) return; let interval = setInterval(function () { let second = GM_getValue(key, 0); GM_setValue(key, second + 5); let id = GM_getValue("runID"); if (id !== ID) { clearInterval(interval) } }, 5000); if (second < max_minutes * 60) return; const confession = "我知道这样不好,但我还是要玩"; let mask = document.createElement("div"); mask.id = "mask"; $(mask).css("position", "fixed").css("left", "0").css("top", "0").css("right", "0") .css("bottom", "0").css("background", "white").css("z-index", "999999999"); mask.innerHTML = "
你还有这些任务没有做
加载中