您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Converts Nyaa.si torrent timestamps from 24-hour to 12-hour format
// ==UserScript== // @name Nyaa Timestamp 12-Hour Format // @namespace https://nyaa.si/ // @version 1.0 // @description Converts Nyaa.si torrent timestamps from 24-hour to 12-hour format // @icon https://nyaa.si/static/favicon.png // @author MDTI // @match https://nyaa.si/* // @grant none // @license MIT // ==/UserScript== (function () { 'use strict'; function convertTo12Hour(time24) { const [date, time] = time24.split(' '); let [hours, minutes] = time.split(':').map(Number); const period = hours >= 12 ? 'PM' : 'AM'; hours = hours % 12 || 12; return `${date} ${hours}:${minutes.toString().padStart(2, '0')} ${period}`; } function updateTimestamps() { const tdElements = document.querySelectorAll('td.text-center'); tdElements.forEach(td => { const text = td.textContent.trim(); if (/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}$/.test(text)) { td.textContent = convertTo12Hour(text); } }); } updateTimestamps(); const observer = new MutationObserver(updateTimestamps); observer.observe(document.body, { childList: true, subtree: true }); })();