您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Show top 🔝 links of Hackernews
当前为
"use strict"; // ==UserScript== // @name Hackernews best // @namespace https://github.com/scambier/userscripts // @author Simon Cambier // @version 0.0.1 // @description Show top 🔝 links of Hackernews // @license ISC // @require https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.js // @include https://news.ycombinator.com/* // @grant none // @run-at document-end // ==/UserScript== (() => { // Show arrows on top 20% const count = [...$('tr.athing')].length; // Select lines [...$('tr.athing')] // Filter out ads .filter(tr => $(tr).find('td.votelinks').length) // Get id and score .map(tr => { var _a; return { id: $(tr).attr('id'), score: Number((_a = $(tr).next().find('.score')[0].textContent) === null || _a === void 0 ? void 0 : _a.split(' ')[0]) }; }) // Sort by score descending .sort((a, b) => b.score - a.score) // Keep the top items .slice(0, count * 0.2) // Mark those lines .forEach(o => { const link = $(`tr#${o.id}`).find('a.storylink'); link.text('🔝 ' + link.text()); }); })();