您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Make the comment link on Hacker News front page match the story link formatting (external stories only). So that you can use Snap Links to easily Right Click and drag to mass open links if you like to read Comments page for stories.
// ==UserScript== // @name Hacker News - Match Comment Link Style to Story Link // @author MedX // @namespace MedX-AA // @license MIT // @icon https://news.ycombinator.com/favicon.ico // @version 1.2 // @description Make the comment link on Hacker News front page match the story link formatting (external stories only). So that you can use Snap Links to easily Right Click and drag to mass open links if you like to read Comments page for stories. // @match https://news.ycombinator.com/front* // @grant none // ==/UserScript== (function () { 'use strict'; function styleCommentLink(titleLink) { const href = titleLink.getAttribute('href'); if (!href) return; const isInternal = href.includes('ycombinator.com') || href.startsWith('item?id=') || href.startsWith('from?site='); if (isInternal) return; const titleRow = titleLink.closest('tr'); const subtextRow = titleRow?.nextElementSibling; const subtext = subtextRow?.querySelector('.subtext'); if (!subtext) return; const subLinks = subtext.querySelectorAll('a[href^="item?id="]'); if (subLinks.length === 0) return; const commentLink = subLinks[subLinks.length - 1]; if (!commentLink || !/\d+\s*comments|discuss/i.test(commentLink.textContent)) return; const computed = window.getComputedStyle(titleLink); commentLink.style.fontSize = computed.fontSize; commentLink.style.fontWeight = computed.fontWeight; commentLink.style.color = computed.color; commentLink.style.fontFamily = computed.fontFamily; commentLink.style.textDecoration = computed.textDecoration; if (titleLink.className) { commentLink.className = titleLink.className; } } // Run immediately on load document.querySelectorAll('.titleline > a').forEach(styleCommentLink); })();