您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
屏蔽分心网站,显示全屏提醒以保持专注
当前为
// ==UserScript== // @name Site Blocker, to be more focused // @namespace https://gf.qytechs.cn/users/1111205-geekfox // @version 1.1 // @description 屏蔽分心网站,显示全屏提醒以保持专注 // @author GeekFox // @match *://*/* // @grant none // @run-at document-start // @license MIT // ==/UserScript== (function () { 'use strict'; // ======= 配置区域 ======= // 在这里添加需要屏蔽的网站域名(支持子域名) const BLOCKED_SITES = [ "jandan.net", "zhihu.com" // 添加更多需要屏蔽的网站... ]; const WARNING_TEXT = "Be Focused!"; // 警告文本 const BACKGROUND_COLOR = "#ff0000"; // 背景颜色(红色) const TEXT_COLOR = "#ffffff"; // 文字颜色(白色) // ====================== // 检查当前网站是否在屏蔽列表中 function isBlockedSite() { const hostname = window.location.hostname.toLowerCase(); return BLOCKED_SITES.some(site => { const domain = site.toLowerCase().replace(/^www\./, ''); return ( hostname === domain || hostname.endsWith(`.${domain}`) ); }); } // 创建全屏警告 function createFullscreenWarning() { const overlay = document.createElement('div'); overlay.id = 'focusBlockerOverlay'; overlay.style.cssText = ` position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: ${BACKGROUND_COLOR}; z-index: 999999; display: flex; justify-content: center; align-items: center; flex-direction: column; cursor: default; `; const textElement = document.createElement('div'); textElement.textContent = WARNING_TEXT; textElement.style.cssText = ` color: ${TEXT_COLOR}; font-size: 10vw; font-weight: bold; text-align: center; text-shadow: 0 0 10px rgba(0,0,0,0.5); user-select: none; max-width: 90vw; line-height: 1.2; `; const hintElement = document.createElement('div'); hintElement.textContent = "Press ESC to temporarily access (5 mins)"; hintElement.style.cssText = ` color: rgba(255,255,255,0.7); font-size: 2vw; margin-top: 40px; text-align: center; user-select: none; `; overlay.appendChild(textElement); overlay.appendChild(hintElement); document.documentElement.appendChild(overlay); return overlay; } // 主函数 function main() { if (!isBlockedSite()) return; const overlay = createFullscreenWarning(); // 添加临时访问功能(按ESC键) let temporaryAccess = false; document.addEventListener('keydown', (e) => { if (e.key === 'Escape') { overlay.style.display = 'none'; temporaryAccess = true; // 5分钟后重新显示警告 setTimeout(() => { if (temporaryAccess) { overlay.style.display = 'flex'; temporaryAccess = false; } }, 5 * 60 * 1000); // 5分钟 } }); } // 确保在DOM加载前执行 if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', main); } else { main(); } })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址