// ==UserScript== // @name 腾讯视频vip解析 - 带顶部日志 // @namespace https://jixiejidiguan.top/A2zml/ // @version 2025-08-05 // @description 在腾讯视频页面顶部显示日志面板,用于调试和信息展示 // @author jixiejidiguan.top // @match https://v.qq.com/x/cover/* // @icon https://www.google.com/s2/favicons?sz=64&domain=qq.com // @grant none // @license MT // @downloadURL https://update.greasyfork.icu/scripts/544648/%E8%85%BE%E8%AE%AF%E8%A7%86%E9%A2%91vip%E8%A7%A3%E6%9E%90%20-%20%E5%B8%A6%E9%A1%B6%E9%83%A8%E6%97%A5%E5%BF%97.user.js // @updateURL https://update.greasyfork.icu/scripts/544648/%E8%85%BE%E8%AE%AF%E8%A7%86%E9%A2%91vip%E8%A7%A3%E6%9E%90%20-%20%E5%B8%A6%E9%A1%B6%E9%83%A8%E6%97%A5%E5%BF%97.meta.js // ==/UserScript== (function () { 'use strict'; // 视频解析接口配置 const videoParsers = [ { id: 'parser1', name: '解析接口 1', url: 'https://jx.playerjy.com/?ads=0&url=' }, { id: 'parser2', name: '解析接口 2', url: 'https://jx.xmflv.com/?url=' }, { id: 'parser3', name: '解析接口 3', url: 'https://z1.190000000007.top/?jx=' }, { id: 'parser4', name: '解析接口 4', url: 'https://jx.dmflv.cc/?url=' }, { id: 'parser5', name: '解析接口 5', url: 'https://www.yemu.xyz/?url=' }, { id: 'parser6', name: '解析接口 6', url: 'https://jx.nnxv.cn/tv.php?url=' } ]; // 日志管理模块 const LogManager = { panel: null, content: null, hideTimeout: null, // 初始化日志面板 init() { if (this.isAlreadyInjected('tampermonkey-log-panel')) { this.content = document.getElementById('tampermonkey-log-content'); return this.content; } this.panel = document.createElement('div'); this.panel.id = 'tampermonkey-log-panel'; this.panel.style.cssText = ` position: fixed; top: 0; left: 0; right: 0; background: #1e1e1e79; color: #fff; z-index: 99999; padding: 10px; font-family: monospace; font-size: 14px; border-bottom: 2px solid #007acc; max-height: 200px; overflow-y: auto; `; const title = document.createElement('div'); title.textContent = '🔧 TamperMonkey 脚本日志'; title.style.cssText = ` font-weight: bold; margin-bottom: 8px; color: #00d4ff; `; this.panel.appendChild(title); this.content = document.createElement('div'); this.content.id = 'tampermonkey-log-content'; this.content.style.cssText = ` white-space: pre-wrap; word-break: break-word; line-height: 1.4; `; this.panel.appendChild(this.content); // 将日志面板添加到页面顶部 document.body.appendChild(this.panel); // 全局日志方法 window.logToPage = (msg, type = 'info') => this.log(msg, type); return this.content; }, // 检查元素是否已注入 isAlreadyInjected(id) { return document.getElementById(id) !== null; }, // 记录日志 log(msg, type = 'info') { if (!this.content) return; const time = new Date().toLocaleTimeString(); const prefix = { error: '[❌ ERROR]', warn: '[⚠️ WARN]', info: '[ℹ️ INFO]', log: '[💬 LOG]' }[type] || '[💬 LOG]'; // 创建新的日志行元素 const logLine = document.createElement('div'); logLine.textContent = `${time} ${prefix} ${msg}`; // 添加日志行到内容容器 this.content.appendChild(logLine); // 显示日志面板 this.show(); // 清除之前的隐藏定时器 if (this.hideTimeout) { clearTimeout(this.hideTimeout); } // 5秒后隐藏日志面板 this.hideTimeout = setTimeout(() => this.hide(), 3000); }, // 显示日志面板 show() { if (this.panel) { this.panel.style.display = "block"; } }, // 隐藏日志面板 hide() { if (this.panel) { this.panel.style.display = "none"; } } }; // 工具栏按钮模块 const ToolbarButton = { element: null, // 初始化工具栏按钮 init() { if (LogManager.isAlreadyInjected('custom-popup-button')) return; const btnContainer = document.createElement('div'); btnContainer.id = 'custom-popup-button'; btnContainer.style.cssText = ` position: fixed; top: 50%; left: 20px; transform: translateY(-50%); z-index: 99999; `; const btn = document.createElement('button'); btn.textContent = '🔧 打开弹窗'; btn.style.cssText = ` writing-mode: vertical-rl; text-orientation: mixed; padding: 12px 8px; background: #1976d2; color: white; border: none; border-radius: 4px; font-weight: bold; cursor: pointer; box-shadow: 0 2px 6px rgba(0,0,0,0.2); transition: background 0.2s; font-size: 14px; `; // 添加事件监听器 btn.addEventListener('mouseover', () => { btn.style.background = '#1565c0'; }); btn.addEventListener('mouseout', () => { btn.style.background = '#1976d2'; }); btn.addEventListener('click', ModalManager.show); btnContainer.appendChild(btn); document.body.appendChild(btnContainer); this.element = btnContainer; LogManager.log('🔧 工具按钮已添加', 'info'); }, // 移除工具栏按钮 remove() { if (this.element && this.element.parentNode) { this.element.parentNode.removeChild(this.element); this.element = null; } } }; // 模态框管理模块 const ModalManager = { overlay: null, // 显示模态框 show() { this.overlay = document.createElement('div'); this.overlay.id = 'custom-modal-overlay'; this.overlay.style.cssText = ` position: fixed; inset: 0; background: rgba(0,0,0,0.5); display: flex; justify-content: center; align-items: center; z-index: 100000; `; const modal = document.createElement('div'); modal.style.cssText = ` background: white; padding: 24px; border-radius: 8px; box-shadow: 0 4px 20px rgba(0,0,0,0.3); min-width: 400px; max-width: 500px; font-family: sans-serif; position: relative; `; modal.innerHTML = `
请输入需要解析的视频地址,然后选择一个解析接口
`; // 创建并添加视频解析区域 const parserSection = VideoParser.createSection(); modal.insertBefore(parserSection, modal.querySelector('#close-modal-btn')); this.overlay.appendChild(modal); document.body.appendChild(this.overlay); // 关闭按钮事件 - 使用箭头函数确保this指向正确 const closeModalBtn = modal.querySelector('#close-modal-btn'); if (closeModalBtn) { closeModalBtn.addEventListener('click', (e) => { ModalManager.hide(); LogManager.log('🔧 关闭按钮触发关闭', 'info'); }); // 添加once选项防止多次触发 } // 点击背景关闭 this.overlay.addEventListener('click', (e) => { if (e.target === this.overlay) { ModalManager.hide(); LogManager.log('🔧 背景点击触发关闭', 'info'); } }); // 添加once选项 LogManager.log('🔧 视频解析工具已打开', 'info'); }, // 隐藏模态框 hide() { const existingVideoContainer = document.getElementById('custom-modal-overlay'); if (existingVideoContainer) { if (existingVideoContainer.parentNode) { existingVideoContainer.parentNode.removeChild(existingVideoContainer); } else { existingVideoContainer.remove(); } } } }; // 视频解析模块 const VideoParser = { // 创建视频解析区域 createSection() { const parserContainer = document.createElement('div'); parserContainer.style.cssText = ` margin-top: 20px; padding-top: 20px; border-top: 1px solid #eee; `; // 标题和输入框 parserContainer.innerHTML = `输入视频URL并选择解析接口