您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Userscript that makes sure that GitHub stays a work tool and doesn't turn into a social media website
// ==UserScript== // @name GitHub Distractionless // @namespace Violentmonkey Scripts // @match https://github.com/* // @grant none // @version 0.1.1 // @author turtlebasket // @website https://github.com/turtlebasket/userscripts/tree/master/github-distractionless // @license MIT // @description Userscript that makes sure that GitHub stays a work tool and doesn't turn into a social media website // @run-at document-end // ==/UserScript== let hideEls = []; let focusing = false; // title bar links - custom behavior for now const titleBarExclude = ["Explore", "Marketplace", "Codespaces"]; let titleBarEls = document.getElementsByClassName("js-selected-navigation-item") for (let i = 0; i < titleBarEls.length; i++) { let el = titleBarEls[i]; if (titleBarExclude.includes(el.innerHTML.trim())) { hideEls.push(el); } } // general exclusion list [ ["mail-status unread", [0], /.*/], ["UnderlineNav-item", [1], /^\/$/], ] .forEach(([className, hideIndices, pageRegex]) => { hideIndices.forEach(i => { let el = document.getElementsByClassName(className)[i]; if (typeof el === 'undefined') { console.log(`focus mode: unable to find element ${className} [ ${i} ]`) } else { hideEls.push(el); } }); }) // hide all els in els function toggleFocus() { focusing = !focusing; for (let el of hideEls) { el.setAttribute( "style", focusing ? "display: none;" : "display: auto;"); } } // initial state toggleFocus(); // toggle switch coming later, currently bugged due to github content policy
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址