您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Modify Boosty title with timestamp
// ==UserScript== // @name Boosty Title Modifier // @version 0.31 // @description Modify Boosty title with timestamp // @match https://boosty.to/* // @grant none // @namespace https://gf.qytechs.cn/users/789838 // ==/UserScript== (function() { 'use strict'; if (!window.location.pathname.includes('/posts/')) return; // Месяцы для преобразования const months = { 'янв': '01', 'фев': '02', 'мар': '03', 'апр': '04', 'май': '05', 'июн': '06', 'июл': '07', 'авг': '08', 'сен': '09', 'окт': '10', 'ноя': '11', 'дек': '12' }; function parseBoostyDate(dateStr) { const parts = dateStr.split(' '); let day, month, year, time; if (dateStr.includes(' в ')) { if (parts.length === 5) { // С годом [day, month, year, , time] = parts; } else { // Без года [day, month, , time] = parts; year = new Date().getFullYear(); } } else { return dateStr; } // Удаляем все двоеточия из времени time = time.replace(/:/g, ''); // Форматируем компоненты day = day.padStart(2, '0'); month = months[month] || '01'; time = time.padStart(4, '0'); return `${year}.${month}.${day} ${time.slice(0, 2)} ${time.slice(2)}`; } function getPostTime() { const timeElement = document.querySelector('[data-test-id="COMMON_CREATEDAT:ROOT"]') || document.querySelector('[class*="CreatedAt"][class*="headerLink"]'); return timeElement?.textContent?.trim() || ''; } function getPostTitle() { return document.querySelector('h1')?.textContent?.trim() || document.querySelector('[class*="Post_title"]')?.textContent?.trim() || document.title; } function updateTitle() { const rawTime = getPostTime(); if (!rawTime) return false; const formattedTime = parseBoostyDate(rawTime); const postTitle = getPostTitle(); if (formattedTime && postTitle) { const newTitle = `${formattedTime} - ${postTitle}`; if (document.title !== newTitle) { document.title = newTitle; return true; } } return false; } function main() { if (updateTitle()) return; const observer = new MutationObserver(() => { if (updateTitle()) observer.disconnect(); }); observer.observe(document.body, { childList: true, subtree: true }); setTimeout(() => { observer.disconnect(); updateTitle(); }, 3000); } if (document.readyState === 'complete') { main(); } else { window.addEventListener('load', main); } })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址