您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
掘金沸点优化, 支持快捷键操作,屏蔽指定圈子
当前为
// ==UserScript== // @name 掘金沸点优化 // @namespace https://gf.qytechs.cn/en/scripts/532890-%E6%8E%98%E9%87%91%E5%B9%BF%E5%91%8A%E5%8E%BB%E9%99%A4 // @version 0.1 // @description 掘金沸点优化, 支持快捷键操作,屏蔽指定圈子 // @author Allen-1998 // @match *://juejin.cn/* // @license MIT // ==/UserScript== (function () { "use strict"; // 快捷键优化 { const keyboardConfig = [ { key: "j", description: "下一条", action: () => { scrollToItem("next"); }, }, { key: "k", description: "上一条", action: () => { scrollToItem("prev"); }, }, { key: "l", description: "点赞", action: () => { const target = document.querySelector( ".pin-list > li.active .like-action" ); if (target) { target.click(); } }, }, { key: "r", description: "回复", action: () => { const target = document.querySelector( ".pin-list > li.active .comment-action" ); if (target) { target.click(); } }, }, { key: "Enter", description: "详情", action: () => { const target = document.querySelector(".pin-list > li.active .pin"); if (target) { const id = target.getAttribute("data-pin-id"); window.open(`https://juejin.cn/pin/${id}`); } }, }, ]; // 监听快捷键 keyboardConfig.forEach((config) => { document.addEventListener("keydown", (e) => { if ( !document.activeElement.classList.contains("rich-editor") && !document.activeElement.classList.contains("rich-input") && window.location.pathname.startsWith("/pins") && e.key === config.key ) { config.action(); } }); }); // 点击空白区域取消选中 document.addEventListener("click", () => { const activeItem = document.querySelector(".pin-list > li.active"); if (activeItem) { activeItem.classList.remove("active"); } }); function scrollToItem(direction) { const activeItem = document.querySelector(".pin-list > li.active"); let target = null; if (activeItem) { target = direction === "next" ? activeItem.nextElementSibling : activeItem.previousElementSibling; } else { const items = document.querySelectorAll(".pin-list > li"); for (const item of items) { const rect = item.getBoundingClientRect(); if (rect.top + (rect.height / 3) * 2 > 0) { target = item; break; } } } if (target) { activeItem?.classList.remove("active"); target.classList.add("active"); const rect = target.getBoundingClientRect(); const scrollTop = document.documentElement.scrollTop; const offset = document.querySelector(".main-header").offsetHeight; const targetScrollTop = rect.top + scrollTop - offset; window.scrollTo({ top: targetScrollTop, }); } } const style = document.createElement("style"); style.textContent = ` .pin-list > li { border: 1px solid transparent; transition: border-color 0s !important; } .pin-list > li.active { border: 1px solid var(--juejin-font-brand1-normal); } .mask { display: none; } `; document.head.appendChild(style); } // 屏蔽圈子 { const blackClubs = ["Trae 用户交流圈"]; const observer = new MutationObserver((mutations) => { mutations.forEach((mutation) => { if (mutation.type === "childList") { filterBlackClubs(mutation.addedNodes); } }); }); function filterBlackClubs(nodes = []) { nodes.forEach((node) => { const club = node.querySelector(".pin-club-box .club span"); if (club && blackClubs.includes(club.textContent)) { node.remove(); } }); } // 检测selector是否已经渲染 function waitForSelector(selector) { return new Promise((resolve) => { const interval = setInterval(() => { if (document.querySelector(selector)) { clearInterval(interval); resolve(true); } }, 100); }); } async function createObserver() { observer.disconnect(); await waitForSelector(".pin-list > li"); filterBlackClubs(document.querySelectorAll(".pin-list > li")); observer.observe(document.querySelector(".pin-list"), { childList: true, }); } window.addEventListener("load", () => { createObserver(); }); const originalPushState = history.pushState; history.pushState = function () { originalPushState.apply(this, arguments); window.dispatchEvent(new Event("pushstate")); }; window.addEventListener("pushstate", () => { createObserver(); }); window.addEventListener("unload", () => { observer.disconnect(); }); } // hrd图片优化 { const head = document.querySelector("head"); const style = document.createElement("style"); style.setAttribute("type", "text/css"); style.innerText = ` img { filter: opacity(1); } `; head.append(style); } })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址