您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Deobfuscate the "n days ago" dates on Hacker News with YYYY-MM-DD tooltips
当前为
- // ==UserScript==
- // @name Hacker News Date Tooltips
- // @description Deobfuscate the "n days ago" dates on Hacker News with YYYY-MM-DD tooltips
- // @author chocolateboy
- // @copyright chocolateboy
- // @version 1.1.0
- // @namespace https://github.com/chocolateboy/userscripts
- // @license GPL: https://www.gnu.org/copyleft/gpl.html
- // @include https://news.ycombinator.com/*
- // @require https://cdn.jsdelivr.net/npm/cash-dom@8.1.0/dist/cash.min.js
- // @require https://unpkg.com/dayjs@1.10.4/dayjs.min.js
- // @grant GM_log
- // ==/UserScript==
- const DATES = 'span.age a'
- const DELTA = 1, UNIT = 2
- function isoDate (ago) {
- const match = ago.match(/^(\d+)\s+(\w+)\s+ago$/)
- return match
- ? dayjs().subtract(match[DELTA], match[UNIT]).format('YYYY-MM-DD')
- : null
- }
- $(DATES).each(function () {
- const $this = $(this)
- const ago = $this.text().trim()
- const date = isoDate(ago)
- if (date) {
- $this.attr('title', date)
- }
- })
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址