您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
基于超展开对随便看看进行内容扩充
当前为
// ==UserScript== // @name Bangumi随便看看扩展 // @namespace http://tampermonkey.net/ // @version 1.0 // @description 基于超展开对随便看看进行内容扩充 // @author age // @match https://bgm.tv/group/discover // @match https://bangumi.tv/group/discover // @match https://chii.in/group/discover // @license MIT // ==/UserScript== (function() { 'use strict'; const validDomains = ['bgm.tv', 'bangumi.tv', 'chii.in']; const currentDomain = window.location.hostname; const currentPath = window.location.pathname; if (!validDomains.includes(currentDomain) || currentPath !== '/group/discover') { return; } const apiUrl = `https://${currentDomain}/rakuen/topiclist?type=group`; async function fetchRakuenData() { try { const response = await fetch(apiUrl, { credentials: 'include' }); if (!response.ok) throw new Error(`HTTP error! status: ${response.status}`); return await response.text(); } catch (e) { console.error('数据获取失败:', e); return null; } } // 时间转换函数 function parseRelativeTime(timeStr) { // 清理字符串 const cleaned = timeStr .replace(/\.\.\./g, '') .replace(/ago/gi, '') .trim(); const matches = Array.from(cleaned.matchAll(/(\d+)([mhd])/g)); if (!matches.length) return new Date(); const now = new Date(); matches.forEach(match => { const value = parseInt(match[1], 10); const unit = match[2]; switch (unit) { case 'd': now.setDate(now.getDate() - value); break; case 'h': now.setHours(now.getHours() - value); break; case 'm': now.setMinutes(now.getMinutes() - value); break; } }); return now; } function formatTime(date) { const pad = n => n.toString().padStart(2, '0'); return `${date.getFullYear()}-${date.getMonth()+1}-${date.getDate()} ` + `${pad(date.getHours())}:${pad(date.getMinutes())}`; } // 创建 function createTableRow(item) { const tr = document.createElement('tr'); tr.dataset.itemUser = item.userId; const tdTitle = document.createElement('td'); tdTitle.className = item.rowClass; const titleLink = document.createElement('a'); titleLink.href = `/group/topic/${item.topicId}`; titleLink.className = 'l'; titleLink.textContent = item.title; const replySpan = document.createElement('small'); replySpan.className = 'grey'; replySpan.textContent = ` ${item.replies}`; tdTitle.append(titleLink, replySpan); // 小组列 const tdGroup = document.createElement('td'); tdGroup.className = item.rowClass; const groupLink = document.createElement('a'); groupLink.href = item.groupUrl; groupLink.textContent = item.groupName; tdGroup.appendChild(groupLink); // 用户列 const tdUser = document.createElement('td'); tdUser.className = item.rowClass; const userLink = document.createElement('a'); userLink.href = `/user/${item.userId}`; userLink.textContent = item.userName; tdUser.appendChild(userLink); // 实际时间 const tdTime = document.createElement('td'); tdTime.className = item.rowClass; tdTime.setAttribute('align', 'right'); const timeSpan = document.createElement('small'); timeSpan.className = 'grey'; timeSpan.textContent = formatTime(item.realTime); tdTime.appendChild(timeSpan); tdTitle.style.width = '53%'; tdGroup.className = item.rowClass; tdGroup.style.width = '20%'; tr.append(tdTitle, tdGroup, tdUser, tdTime); return tr; } // 更新主题数据(直接加在后面,不影响前15条) async function updateTable() { try { const [originalTable, apiData] = await Promise.all([ new Promise(res => setTimeout(() => res(document.querySelector('table.topic_list')), 300)), fetchRakuenData() ]); if (!originalTable || !apiData) return; const parser = new DOMParser(); const apiDoc = parser.parseFromString(apiData, 'text/html'); const apiItems = Array.from(apiDoc.querySelectorAll('#eden_tpc_list > ul > li')).slice(16); // 获取或创建第二个tbody const existingTbodies = originalTable.querySelectorAll('tbody'); let targetTbody = existingTbodies[1]; if (!targetTbody) { targetTbody = document.createElement('tbody'); if (existingTbodies[0]) { existingTbodies[0].insertAdjacentElement('afterend', targetTbody); } else { originalTable.appendChild(targetTbody); } } // 添加新数据 apiItems.forEach(li => { const timeElement = li.querySelector('.time'); const realTime = parseRelativeTime(timeElement.textContent); const item = { rowClass: li.classList.contains('line_odd') ? 'odd' : 'even', userId: li.dataset.itemUser, topicId: li.querySelector('a[href^="/rakuen/topic/group"]').href.match(/\/group\/(\d+)/)[1], title: li.querySelector('.title').textContent.trim(), replies: li.querySelector('.grey').textContent, groupUrl: li.querySelector('.row > a').href, groupName: li.querySelector('.row > a').textContent, userName: li.querySelector('.avatar').title, realTime: realTime }; targetTbody.appendChild(createTableRow(item)); }); } catch (e) { console.error('更新失败:', e); } } window.addEventListener('load', updateTable); })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址