// ==UserScript== // @name 🫧404小站 — 🎬VIP追剧神器 | 完全免费 | 支持多平台 // @namespace http://tampermonkey.net/ // @version 3.1.0 // @description ▶在线VIP视频解析工具 | free | 支持多平台【爱奇艺】【腾讯视频】【优酷土豆】【芒果TV】【乐视视频】【哔哩哔哩】【搜狐视频】等常见平台。✨50+解析接口任选 ✨内嵌播放无广告 ✨智能切集追剧 ✨自定义播放器尺寸 ✨一键自动解析 制作不易,有问题可加微信咨询:Why15236444193 [如果加微信未能及时回复,请多多包涵哈!] // @author yyy. // @match *://*/* // @grant GM_registerMenuCommand // @grant GM_addStyle // @grant GM_notification // @grant GM_getValue // @grant GM_setValue // @grant GM_openInTab // @require https://cdn.jsdelivr.net/npm/sweetalert2@11 // @run-at document-start // @icon data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIzMiIgaGVpZ2h0PSIzMiIgdmlld0JveD0iMCAwIDMyIDMyIj48cmVjdCB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiBmaWxsPSIjZmZmIi8+PHBhdGggZD0iTTE2IDMuNWMtNi45IDAtMTIuNSA1LjYtMTIuNSAxMi41UzkuMSAyOC41IDE2IDI4LjUgMjguNSAyMi45IDI4LjUgMTYgMjIuOSAzLjUgMTYgMy41eiIgZmlsbD0iI2ZmNjliNCIvPjxwYXRoIGQ9Ik0xNiA2LjVjLTUuMiAwLTkuNSA0LjMtOS41IDkuNXM0LjMgOS41IDkuNSA5LjUgOS41LTQuMyA5LjUtOS41LTQuMy05LjUtOS41LTkuNXptMCAxNmMtMy42IDAtNi41LTIuOS02LjUtNi41czIuOS02LjUgNi41LTYuNSA2LjUgMi45IDYuNSA2LjUtMi45IDYuNS02LjUgNi41eiIgZmlsbD0iI2ZmZiIvPjxwYXRoIGQ9Ik0xMiAxNWgydjJoLTJ6bTQtMmgzdjJoLTN6IiBmaWxsPSIjZmZmIi8+PHBhdGggZD0iTTE0IDIyaC0ydjJoMnoiIGZpbGw9IiNmZmYiLz48cGF0aCBkPSJNMTggMjJoLTJ2MmgyeiIgZmlsbD0iI2ZmZiIvPjxwYXRoIGQ9Ik0xNSAyN2gydjJoLTJ6IiBmaWxsPSIjZmZmIi8+PC9zdmc+ // ==/UserScript== /*    ┏┓   ┏┓   ┏┛┻━━━━━━┛ ┻┓   ┃      ┃   ┃   ━   ┃   ┃ ┳┛ ┗┳  ┃   ┃      ┃   ┃   ┻   ┃   ┃      ┃   ┗━━━┓   ┏━┛Codes are far away from bugs with the animal protecting     ┃   ┃ 神兽保佑,代码无bug     ┃   ┃     ┃   ┗━━━┓     ┃      ┣┓     ┃     ┏┛     ┗┓┓┏━┳┓┏┛      ┃┫┫ ┃┫┫      ┗┻┛ ┗┻┛ */ (function() { 'use strict'; // ===== 防止在iframe中重复执行 ===== if (window.self !== window.top) { console.log('VIP解析脚本:检测到iframe环境,跳过执行'); return; } const parseApis = [ {"name": "789", "type": "1,3", "url": "https://jiexi.789jiexi.icu:4433/?url=", "recommended": true}, {"name": "虾米", "type": "1,3", "url": "https://jx.xmflv.cc/?url=", "recommended": true}, {"name": "HLS", "type": "1,3", "url": "https://jx.hls.one/?url="}, {"name": "极速", "type": "1,3", "url": "https://jx.2s0.cn/player/?url="}, {"name": "Play", "type": "1,3", "url": "https://jx.playerjy.com/?url="}, {"name": "冰豆", "type": "1,3", "url": "https://bd.jx.cn/?url="}, {"name": "973", "type": "1,3", "url": "https://jx.973973.xyz/?url="}, {"name": "麒麟", "type": "3", "url": "https://rdfplayer.mrgaocloud.com/player/?url="}, {"name": "纯净1", "type": "1,2,3", "url": "https://im1907.top/?jx="}, {"name": "B站1", "type": "1,3", "url": "https://jx.jsonplayer.com/player/?url="}, {"name": "爱豆", "type": "1,3", "url": "https://jx.aidouer.net/?url="}, {"name": "BL", "type": "1,3", "url": "https://vip.bljiex.com/?v="}, {"name": "百域", "type": "1,3", "url": "https://jx.618g.com/?url="}, {"name": "CK", "type": "1,3", "url": "https://www.ckplayer.vip/jiexi/?url="}, {"name": "CHok", "type": "1,3", "url": "https://www.gai4.com/?url="}, {"name": "ckmov", "type": "1,3", "url": "https://www.ckmov.vip/api.php?url="}, {"name": "H8", "type": "1,3", "url": "https://www.h8jx.com/jiexi.php?url="}, {"name": "JY", "type": "1,3", "url": "https://jx.playerjy.com/?url="}, {"name": "通用", "type": "1,3", "url": "https://ckmov.ccyjjd.com/ckmov/?url="}, {"name": "la", "type": "1,3", "url": "https://api.jiexi.la/?url="}, {"name": "老板", "type": "1,3", "url": "https://vip.laobandq.com/jiexi.php?url="}, {"name": "MAO", "type": "1,3", "url": "https://www.mtosz.com/m3u8.php?url="}, {"name": "M3U8", "type": "1,3", "url": "https://jx.m3u8.tv/jiexi/?url="}, {"name": "诺讯", "type": "1,3", "url": "https://www.nxflv.com/?url="}, {"name": "OK", "type": "1,3", "url": "https://okjx.cc/?url="}, {"name": "PM", "type": "1,3", "url": "https://www.playm3u8.cn/jiexi.php?url="}, {"name": "盘古", "type": "1,3", "url": "https://www.pangujiexi.cc/jiexi.php?url="}, {"name": "RDHK", "type": "1,3", "url": "https://jx.rdhk.net/?v="}, {"name": "人人迷", "type": "1,3", "url": "https://jx.blbo.cc:4433/?url="}, {"name": "思云", "type": "1,3", "url": "https://jx.ap2p.cn/?url="}, {"name": "思古3", "type": "1,3", "url": "https://jsap.attakids.com/?url="}, {"name": "听乐", "type": "1,3", "url": "https://jx.dj6u.com/?url="}, {"name": "维多", "type": "1,3", "url": "https://jx.ivito.cn/?url="}, {"name": "YT", "type": "1,3", "url": "https://jx.yangtu.top/?url="}, {"name": "云端", "type": "1,3", "url": "https://sb.5gseo.net/?url="}, {"name": "0523", "type": "1,3", "url": "https://go.yh0523.cn/y.cy?url="}, {"name": "17云", "type": "1,3", "url": "https://www.1717yun.com/jx/ty.php?url="}, {"name": "180", "type": "1,3", "url": "https://jx.000180.top/jx/?url="}, {"name": "4K", "type": "1,3", "url": "https://jx.4kdv.com/?url="}, {"name": "8090", "type": "1,3", "url": "https://www.8090g.cn/?url="}, {"name": "剖元", "type": "1,3", "url": "https://www.pouyun.com/?url="}, {"name": "全民", "type": "1,3", "url": "https://43.240.74.102:4433?url="}, {"name": "夜幕", "type": "1,3", "url": "https://www.yemu.xyz/?url="}, {"name": "M3U8TV", "type": "1,3", "url": "https://jx.m3u8.tv/jiexi/?url="}, {"name": "playm3u8", "type": "1,3", "url": "https://www.playm3u8.cn/jiexi.php?url="}, {"name": "综合", "type": "1,3", "url": "https://jx.jsonplayer.com/player/?url="}, {"name": "七七云", "type": "1,3", "url": "https://jx.77flv.cc/?url="}, {"name": "芒果TV1", "type": "1,3", "url": "https://video.isyour.love/player/getplayer?url="}, {"name": "七哥", "type": "1,3", "url": "https://jx.nnxv.cn/tv.php?url="}, {"name": "im1907", "type": "2", "url": "https://im1907.top/?jx="}, {"name": "云析(带选集)", "type": "2", "url": "https://jx.yparse.com/index.php?url="}, ]; const uniqueApis = []; const seenUrls = new Set(); parseApis.forEach(api => { if (!seenUrls.has(api.url)) { seenUrls.add(api.url); uniqueApis.push(api); } }); let customApis = GM_getValue("custom_parse_apis", []); let allApis = [...uniqueApis, ...customApis]; const vipBoxId = 'vip_jx_box_' + Math.ceil(Math.random() * 100000000); // 播放器容器配置(从别人的.txt整合) const PLAYER_CONTAINERS = [ { host: "v.qq.com", container: "#mod_player,#player-container,.container-player", displayNodes: ["#mask_layer", ".mod_vip_popup", "#mask_layer", ".panel-tip-pay"] }, { host: "m.v.qq.com", container: ".mod_player,#player", displayNodes: [".mod_vip_popup", "[class^=app_],[class^=app-],[class*=_app_],[class*=-app-],[class$=_app],[class$=-app]", "div[dt-eid=open_app_bottom]", "div.video_function.video_function_new", "a[open-app]", "section.mod_source", "section.mod_box.mod_sideslip_h.mod_multi_figures_h,section.mod_sideslip_privileges,section.mod_game_rec"] }, {host: "w.mgtv.com", container: "#mgtv-player-wrap", displayNodes: []}, {host: "www.mgtv.com", container: "#mgtv-player-wrap", displayNodes: []}, { host: "m.mgtv.com", container: ".video-area", displayNodes: ["div.adFixedContain,div.ad-banner,div.m-list-graphicxcy.fstp-mark", "div[class^=mg-app],div#comment-id.video-comment div.ft,div.bd.clearfix,div.v-follower-info", "div.ht.mgui-btn.mgui-btn-nowelt", "div.personal", "div[data-v-41c9a64e]"] }, {host: "www.bilibili.com", container: "#player_module,#bilibiliPlayer,#bilibili-player", displayNodes: []}, {host: "m.bilibili.com", container: ".player-wrapper,.player-container,.mplayer", displayNodes: []}, {host: "www.iqiyi.com", container: "#outlayer,.iqp-player-videolayer", displayNodes: ["#playerPopup", "#vipCoversBox" ,"div.iqp-player-vipmask", "div.iqp-player-paymask","div.iqp-player-loginmask", "div[class^=qy-header-login-pop]",".covers_cloudCover__ILy8R","#videoContent > div.loading_loading__vzq4j",".iqp-player-guide", ".defaultController_playCtrl__Smes8", ".tips_textsBackImg__svIhR", "[class*='defaultController']", "[class*='player-buttons']", "[class*='tips_']", ".qy-player-controller", ".qy-player-tips", "[class*='danmu']", "[class*='Danmu']", ".iqp-danmu", ".qy-player-danmu", "[class*='barrage']"]}, { host: "m.iqiyi.com", container: ".m-video-player-wrap,.iqp-player-videolayer", displayNodes: ["div.m-iqyGuide-layer", "a[down-app-android-url]", "div.iqp-player-vipmask", ".loading_loading__vzq4j","[name=m-extendBar]", "[class*=ChannelHomeBanner]", "section.m-hotWords-bottom"] }, {host: "www.iq.com", container: ".intl-video-wrap", displayNodes: []}, {host: "v.youku.com", container: "#playerMouseWheel", displayNodes: ["#iframaWrapper"]}, {host: "m.youku.com", container: "#playerMouseWheel,.h5-detail-player", displayNodes: []}, {host: "tv.sohu.com", container: "#player", displayNodes: []}, {host: "film.sohu.com", container: "#playerWrap", displayNodes: []}, {host: "www.le.com", container: "#le_playbox", displayNodes: []}, {host: "video.tudou.com", container: ".td-playbox", displayNodes: []}, {host: "v.pptv.com", container: "#pptv_playpage_box", displayNodes: []}, {host: "vip.pptv.com", container: ".w-video", displayNodes: []}, {host: "www.wasu.cn", container: "#flashContent", displayNodes: []}, {host: "www.acfun.cn", container: "#player", displayNodes: []}, {host: "vip.1905.com", container: "#player,#vodPlayer", displayNodes: []}, {host: "www.1905.com", container: "#player,#vodPlayer", displayNodes: []}, ]; const DEFAULT_STYLE = { bgColor: '#3f4149', fontColor: '#DCDCDC', opacity: 0.95, width: '380px' }; const DEFAULT_SHORTCUT = { toggle: 'v', refresh: 'r', style: 's' }; const CONFIG = { vipBoxId: vipBoxId, autoPlayerKey: "auto_player_key_" + window.location.host, autoPlayerVal: "auto_player_value_" + window.location.host, flag: "flag_vip", currentTypeKey: "current_type_key_" + window.location.host, panelPosKey: "vip_panel_pos_" + window.location.host, customStyleKey: "vip_custom_style_" + vipBoxId, customShortcutKey: "vip_custom_shortcut_" + vipBoxId, shortcut: GM_getValue("vip_custom_shortcut_" + vipBoxId, DEFAULT_SHORTCUT) }; const DOM_CACHE = { vipBox: null, vipList: null, vipTab: null, donateTab: null, simpleApiList: null, complexApiList: null, addApiForm: null, styleSetPanel: null, shortcutSetPanel: null, autoParseSetPanel: null, apiNameInput: null, apiUrlInput: null, apiTypeSelect: null }; // 全局播放器控制(简化,不需要那么多变量) let lastPageUrl = window.location.href; GM_addStyle(` #${CONFIG.vipBoxId} { cursor: pointer; position: fixed; top: 120px; left: 0px; z-index: 9999999; text-align: left; transition: left 0.3s ease; } #${CONFIG.vipBoxId}.visible { left: 0px; } #${CONFIG.vipBoxId} .img_box { width: 32px; height: 32px; line-height: 32px; text-align: center; background-color: lightgreen; margin: 10px 0px; color: white; font-size: 16px; font-weight: bold; border-radius: 5px; } #${CONFIG.vipBoxId} .vip_list { display: none; position: absolute; border-radius: 5px; left: 32px; top: 0; text-align: center; border: 1px solid white; padding: 10px 0px; max-height: 80vh; overflow-y: auto; opacity: 0; transform: translateX(-10px); transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1); } #${CONFIG.vipBoxId} .vip_list.visible { display: block; opacity: 1; transform: translateX(0); } #${CONFIG.vipBoxId} .vip_list ul { padding-left: 10px; margin: 0; } #${CONFIG.vipBoxId} .vip_list li { border-radius: 2px; font-size: 12px; text-align: center; width: calc(25% - 14px); line-height: 21px; float: left; border: 1px solid gray; padding: 0 4px; margin: 4px 2px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; -o-text-overflow: ellipsis; opacity: 0; transform: translateY(10px); cursor: pointer; } #${CONFIG.vipBoxId} .vip_list.visible li { opacity: 1; transform: translateY(0); transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1) 0.1s; } #${CONFIG.vipBoxId} .complex-api-list li { width: calc(50% - 14px); } #${CONFIG.vipBoxId} .vip_list li:hover { border: 1px solid #1c84c6; } #${CONFIG.vipBoxId} .vip_list::-webkit-scrollbar { width: 5px; height: 1px; } #${CONFIG.vipBoxId} .vip_list::-webkit-scrollbar-thumb { box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2); background: #A8A8A8; } #${CONFIG.vipBoxId} .vip_list::-webkit-scrollbar-track { box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2); background: #F1F1F1; } #${CONFIG.vipBoxId} li.selected { border: 1px solid #1c84c6; } #${CONFIG.vipBoxId} #vip_auto { background-color: #ff69b4; } #${CONFIG.vipBoxId} #add_api_btn, #${CONFIG.vipBoxId} #open-style-set-btn, #${CONFIG.vipBoxId} #open-shortcut-set-btn, #${CONFIG.vipBoxId} #open-auto-parse-set-btn { background-color: #36383f; color: #ccc; border: 1px solid #5a5a5a; font-size: 12px; width: auto; padding: 6px 12px; margin-top: 5px; border-radius: 3px; cursor: pointer; margin-left: 5px; } #${CONFIG.vipBoxId} #add_api_btn:hover, #${CONFIG.vipBoxId} #open-style-set-btn:hover, #${CONFIG.vipBoxId} #open-shortcut-set-btn:hover, #${CONFIG.vipBoxId} #open-auto-parse-set-btn:hover { background-color: #42444a; } .mode-toggle { cursor: pointer; margin-left: 2px; } .section-title { font-weight: bold; font-size: 14px; padding: 5px 0px; clear: both; opacity: 0; transform: translateY(10px); } #${CONFIG.vipBoxId} .vip_list.visible .section-title { opacity: 1; transform: translateY(0); transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1) 0.05s; } #${CONFIG.vipBoxId} #donate_section { clear: both; margin-top: 10px; padding: 10px; text-align: center; border-top: 1px solid #555; opacity: 0; transform: translateY(10px); } #${CONFIG.vipBoxId} .vip_list.visible #donate_section { opacity: 1; transform: translateY(0); transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1) 0.15s; } #${CONFIG.vipBoxId} #donate_section .donate-title { font-size: 12px; margin-bottom: 5px; } #${CONFIG.vipBoxId} #qr-code-img { max-width: 100px; max-height: 100px; margin-top: 5px; border: 1px solid #ddd; background: white; } #${CONFIG.vipBoxId} .tab-header { display: flex; } #${CONFIG.vipBoxId} .tab-button { flex: 1; padding: 5px 0; border: none; cursor: pointer; outline: none; font-size: 12px; background: none; } #${CONFIG.vipBoxId} .tab-button.active { font-weight: bold; color: #1c84c6 !important; } #${CONFIG.vipBoxId} .tab-divider { width: 1px; background-color: #5a5a5a; margin: 5px 0; } #${CONFIG.vipBoxId} .tab-content { display: none; } #${CONFIG.vipBoxId} .tab-content.active { display: block; } #${CONFIG.vipBoxId} .add-api-form { padding: 10px; border-radius: 4px; margin: 10px; display: none; } #${CONFIG.vipBoxId} .add-api-form input, #${CONFIG.vipBoxId} .add-api-form select, #vip-style-set-panel input, #vip-shortcut-set-panel input, #vip-auto-parse-set-panel select { width: 100%; padding: 6px; margin: 5px 0; border-radius: 3px; border: 1px solid #5a5a5a; background-color: #2c2e34; color: #ccc; } #${CONFIG.vipBoxId} .add-api-form button { padding: 8px 12px; margin: 5px 2px; border: none; border-radius: 3px; cursor: pointer; background-color: #1c84c6; color: white; font-size: 12px; } #${CONFIG.vipBoxId} .add-api-form .cancel-btn { background-color: #72747a; } #vip-style-set-panel, #vip-shortcut-set-panel, #vip-auto-parse-set-panel { padding: 10px; margin: 10px; border-top: 1px solid #555; display: none; } #vip-style-set-panel .style-item, #vip-shortcut-set-panel .shortcut-item, #vip-auto-parse-set-panel .auto-parse-item { display: flex; align-items: center; margin: 8px 0; gap: 8px; } #vip-style-set-panel .style-item label, #vip-shortcut-set-panel .shortcut-item label, #vip-auto-parse-set-panel .auto-parse-item label { font-size: 12px; width: 80px; text-align: left; } #vip-style-set-panel .style-item input, #vip-shortcut-set-panel .shortcut-item input, #vip-auto-parse-set-panel .auto-parse-item select { flex: 1; padding: 4px; } #vip-style-set-panel button, #vip-shortcut-set-panel button, #vip-auto-parse-set-panel button { width: 40%; padding: 8px 12px; margin: 5px 1%; border: none; border-radius: 3px; cursor: pointer; font-size: 12px; display: inline-block; } #reset-style-btn, #reset-shortcut-btn, #disable-auto-parse-btn { background: #ff69b4 !important; color: white !important; } #save-auto-parse-btn, #save-shortcut-btn, #save-style-btn { background: #1c84c6 !important; color: white !important; } .shortcut-tip { font-size: 10px; color: #ccc; margin-top: 5px; text-align: left; line-height: 1.4; } /* 播放器控制按钮样式 */ .vip-player-close-btn { position: absolute; top: 15px; right: 15px; z-index: 10000000; width: auto; height: auto; padding: 5px 10px; background: transparent; border: none; cursor: pointer; font-size: 32px; color: rgba(255, 255, 255, 0.8); transition: all 0.3s ease; opacity: 1; text-shadow: 0 2px 4px rgba(0,0,0,0.5); pointer-events: auto; } .vip-player-close-btn:hover { color: rgba(255, 255, 255, 1); transform: scale(1.2); } .vip-player-close-btn.hidden { opacity: 0; pointer-events: none; } .vip-player-tip { position: absolute; top: 20px; left: 50%; transform: translateX(-50%); z-index: 10000000; background: transparent; color: rgba(255, 255, 255, 0.9); padding: 0; border-radius: 0; font-size: 14px; border: none; transition: opacity 0.5s ease; text-shadow: 0 2px 4px rgba(0,0,0,0.8); pointer-events: none; } .vip-mouse-catcher { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 9999999; pointer-events: auto; } .vip-mouse-catcher.inactive { pointer-events: none; } .vip-original-player-mask { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 999998; pointer-events: auto; background: transparent; } `); function findTargetElement(targetContainer) { const body = window.document; let tabContainer; let tryTime = 0; const maxTryTime = 120; let startTimestamp; return new Promise((resolve, reject) => { function tryFindElement(timestamp) { if (!startTimestamp) { startTimestamp = timestamp; } const elapsedTime = timestamp - startTimestamp; if (elapsedTime >= 500) { tabContainer = body.querySelector(targetContainer); if (tabContainer) { resolve(tabContainer); } else if (++tryTime === maxTryTime) { reject(); } else { startTimestamp = timestamp; } } if (!tabContainer && tryTime < maxTryTime) { requestAnimationFrame(tryFindElement); } } requestAnimationFrame(tryFindElement); }); } function encodeVideoUrl(url) { if (!url) return ''; return encodeURIComponent(url).replace(/%20/g, '+'); } function renderApiLists() { if (!DOM_CACHE.vipTab) return; let simpleApisHtml = "
[内嵌播放+弹窗无选集]
"; const tabContent = DOM_CACHE.vipTab.innerHTML; const descText = tabContent.match(/(
[\s\S]*?<\/div>)/)[0]; DOM_CACHE.vipTab.innerHTML = simpleApisHtml + complexApisHtml + descText; DOM_CACHE.simpleApiList = DOM_CACHE.vipTab.querySelector('.simple-api-list'); DOM_CACHE.complexApiList = DOM_CACHE.vipTab.querySelector('.complex-api-list'); applyPanelStyle(); } function applyPanelStyle(style = null) { const customStyle = style || GM_getValue(CONFIG.customStyleKey, DEFAULT_STYLE); if (!DOM_CACHE.vipList) return; const fontColor = customStyle.fontColor; const bgColor = customStyle.bgColor; // 应用背景色和字体色 DOM_CACHE.vipList.style.backgroundColor = bgColor; DOM_CACHE.vipList.style.color = fontColor; DOM_CACHE.vipList.style.opacity = customStyle.opacity; DOM_CACHE.vipList.style.width = customStyle.width; // 应用到所有子元素 DOM_CACHE.vipList.querySelectorAll('.section-title').forEach(el => { el.style.color = fontColor; }); DOM_CACHE.vipList.querySelectorAll('.api-item').forEach(el => { el.style.color = fontColor; el.style.borderColor = 'rgba(128,128,128,0.5)'; }); DOM_CACHE.vipList.querySelectorAll('.mode-toggle').forEach(el => { el.style.color = '#1c84c6'; }); DOM_CACHE.vipList.querySelectorAll('.tab-button').forEach(el => { if (!el.classList.contains('active')) { el.style.color = fontColor; } }); DOM_CACHE.vipList.querySelectorAll('.tab-header').forEach(el => { el.style.backgroundColor = bgColor; }); DOM_CACHE.vipList.querySelectorAll('#donate_section').forEach(el => { el.style.color = fontColor; }); DOM_CACHE.vipList.querySelectorAll('.add-api-form').forEach(el => { el.style.backgroundColor = bgColor; }); // 应用到样式设置面板 if (DOM_CACHE.styleSetPanel) { DOM_CACHE.styleSetPanel.style.backgroundColor = bgColor; DOM_CACHE.styleSetPanel.style.color = fontColor; } // 应用到快捷键设置面板 if (DOM_CACHE.shortcutSetPanel) { DOM_CACHE.shortcutSetPanel.style.backgroundColor = bgColor; DOM_CACHE.shortcutSetPanel.style.color = fontColor; } // 应用到自动解析设置面板 if (DOM_CACHE.autoParseSetPanel) { DOM_CACHE.autoParseSetPanel.style.backgroundColor = bgColor; DOM_CACHE.autoParseSetPanel.style.color = fontColor; } GM_setValue(CONFIG.customStyleKey, customStyle); } function createStyleSetPanel() { if (DOM_CACHE.styleSetPanel) return; const customStyle = GM_getValue(CONFIG.customStyleKey, DEFAULT_STYLE); const panel = document.createElement('div'); panel.id = 'vip-style-set-panel'; panel.innerHTML = `
`; DOM_CACHE.donateTab.appendChild(panel); DOM_CACHE.styleSetPanel = panel; // 实时预览功能 panel.querySelector('#style-bgcolor').addEventListener('input', (e) => { applyPanelStyle({ ...GM_getValue(CONFIG.customStyleKey, DEFAULT_STYLE), bgColor: e.target.value }); }); panel.querySelector('#style-fontcolor').addEventListener('input', (e) => { applyPanelStyle({ ...GM_getValue(CONFIG.customStyleKey, DEFAULT_STYLE), fontColor: e.target.value }); }); panel.querySelector('#style-opacity').addEventListener('input', (e) => { applyPanelStyle({ ...GM_getValue(CONFIG.customStyleKey, DEFAULT_STYLE), opacity: e.target.value }); }); panel.querySelector('#style-width').addEventListener('blur', (e) => { if (!e.target.value) return; applyPanelStyle({ ...GM_getValue(CONFIG.customStyleKey, DEFAULT_STYLE), width: e.target.value }); }); // 保存按钮 panel.querySelector('#save-style-btn').addEventListener('click', () => { const bgColor = panel.querySelector('#style-bgcolor').value; const fontColor = panel.querySelector('#style-fontcolor').value; const opacity = panel.querySelector('#style-opacity').value; const width = panel.querySelector('#style-width').value; const newStyle = { bgColor, fontColor, opacity, width }; GM_setValue(CONFIG.customStyleKey, newStyle); applyPanelStyle(newStyle); Swal.fire({ title: '保存成功', text: '样式设置已保存', icon: 'success', timer: 1500, showConfirmButton: false }); }); // 重置按钮 panel.querySelector('#reset-style-btn').addEventListener('click', () => { applyPanelStyle(DEFAULT_STYLE); panel.querySelector('#style-bgcolor').value = DEFAULT_STYLE.bgColor; panel.querySelector('#style-fontcolor').value = DEFAULT_STYLE.fontColor; panel.querySelector('#style-opacity').value = DEFAULT_STYLE.opacity; panel.querySelector('#style-width').value = DEFAULT_STYLE.width; Swal.fire({ title: '重置成功', text: '已恢复默认样式', icon: 'success', timer: 1500, showConfirmButton: false }); }); } function createShortcutSetPanel() { if (DOM_CACHE.shortcutSetPanel) return; const customShortcut = GM_getValue(CONFIG.customShortcutKey, DEFAULT_SHORTCUT); const panel = document.createElement('div'); panel.id = 'vip-shortcut-set-panel'; panel.innerHTML = `
提示:仅支持单字母/数字,使用方式为 Alt + 自定义键
`; DOM_CACHE.donateTab.appendChild(panel); DOM_CACHE.shortcutSetPanel = panel; panel.querySelector('#save-shortcut-btn').addEventListener('click', () => { const toggle = panel.querySelector('#shortcut-toggle').value.trim().toLowerCase(); const refresh = panel.querySelector('#shortcut-refresh').value.trim().toLowerCase(); const style = panel.querySelector('#shortcut-style').value.trim().toLowerCase(); if (!toggle || !refresh || !style) { Swal.fire('提示', '快捷键不能为空!', 'warning'); return; } const newShortcut = { toggle, refresh, style }; GM_setValue(CONFIG.customShortcutKey, newShortcut); CONFIG.shortcut = newShortcut; Swal.fire({ title: '保存成功', text: '快捷键已保存,立即生效', icon: 'success', timer: 1500, showConfirmButton: false }); }); panel.querySelector('#reset-shortcut-btn').addEventListener('click', () => { GM_setValue(CONFIG.customShortcutKey, DEFAULT_SHORTCUT); CONFIG.shortcut = DEFAULT_SHORTCUT; panel.querySelector('#shortcut-toggle').value = DEFAULT_SHORTCUT.toggle; panel.querySelector('#shortcut-refresh').value = DEFAULT_SHORTCUT.refresh; panel.querySelector('#shortcut-style').value = DEFAULT_SHORTCUT.style; Swal.fire({ title: '重置成功', text: '已恢复默认快捷键', icon: 'success', timer: 1500, showConfirmButton: false }); }); } function createPlayerSizeSetPanel() { if (DOM_CACHE.playerSizeSetPanel) return; const customSize = GM_getValue(CONFIG.customPlayerSizeKey, DEFAULT_PLAYER_SIZE); // 提取数字部分 const widthNum = customSize.width.replace('px', ''); const heightNum = customSize.minHeight.replace('px', ''); const panel = document.createElement('div'); panel.id = 'vip-player-size-set-panel'; panel.innerHTML = `
px
px
提示:修改后立即生效,下次解析时应用新尺寸
`; DOM_CACHE.donateTab.appendChild(panel); DOM_CACHE.playerSizeSetPanel = panel; panel.querySelector('#save-player-size-btn').addEventListener('click', () => { const width = panel.querySelector('#player-width').value.trim(); const minHeight = panel.querySelector('#player-min-height').value.trim(); const aspectRatio = panel.querySelector('#player-aspect-ratio').value; if (!minHeight || !width) { Swal.fire('提示', '请输入宽度和最小高度!', 'warning'); return; } // 自动添加px单位 const newSize = { width: width + 'px', minHeight: minHeight + 'px', aspectRatio }; GM_setValue(CONFIG.customPlayerSizeKey, newSize); Swal.fire({ title: '保存成功', text: '播放器尺寸已保存,下次解析时生效', icon: 'success', timer: 1500, showConfirmButton: false }); }); panel.querySelector('#reset-player-size-btn').addEventListener('click', () => { GM_setValue(CONFIG.customPlayerSizeKey, DEFAULT_PLAYER_SIZE); panel.querySelector('#player-width').value = DEFAULT_PLAYER_SIZE.width.replace('px', ''); panel.querySelector('#player-min-height').value = DEFAULT_PLAYER_SIZE.minHeight.replace('px', ''); panel.querySelector('#player-aspect-ratio').value = DEFAULT_PLAYER_SIZE.aspectRatio; Swal.fire({ title: '重置成功', text: '已恢复默认尺寸', icon: 'success', timer: 1500, showConfirmButton: false }); }); } function createAutoParseSetPanel() { if (DOM_CACHE.autoParseSetPanel) return; const panel = document.createElement('div'); panel.id = 'vip-auto-parse-set-panel'; // 构建接口选项列表(只包含支持内嵌播放的接口) let optionsHtml = ''; allApis.forEach((api, index) => { if (api.type.includes("1")) { optionsHtml += ``; } }); const currentIndex = GM_getValue(CONFIG.autoPlayerVal, 0); const isAutoEnabled = !!GM_getValue(CONFIG.autoPlayerKey, null); panel.innerHTML = `
提示:选择后点击保存,然后通过顶部"开/关"按钮控制自动解析
`; DOM_CACHE.donateTab.appendChild(panel); DOM_CACHE.autoParseSetPanel = panel; // 设置当前选中的接口 const selectElement = panel.querySelector('#auto-parse-api-select'); selectElement.value = currentIndex; // 保存并开启按钮 panel.querySelector('#save-auto-parse-btn').addEventListener('click', () => { const selectedIndex = parseInt(selectElement.value); if (selectedIndex === -1) { Swal.fire('提示', '请先选择一个解析接口!', 'warning'); return; } const selectedApi = allApis[selectedIndex]; GM_setValue(CONFIG.autoPlayerVal, selectedIndex); Swal.fire({ title: '保存成功', html: `已设置 ${selectedApi.name} 为自动解析接口
通过顶部"开/关"按钮控制自动解析`, icon: 'success', timer: 2000, showConfirmButton: false }); // 更新自动解析按钮的提示 const autoBtn = DOM_CACHE.vipBox.querySelector("#vip_auto"); if (autoBtn && !!GM_getValue(CONFIG.autoPlayerKey, null)) { autoBtn.title = `自动解析源:${selectedApi.name}`; } }); // 关闭自动解析按钮 panel.querySelector('#disable-auto-parse-btn').addEventListener('click', () => { GM_setValue(CONFIG.autoPlayerKey, null); Swal.fire({ title: '已关闭自动解析', text: '刷新页面后生效', icon: 'info', timer: 1500, showConfirmButton: false }); // 更新自动解析按钮状态 const autoBtn = DOM_CACHE.vipBox.querySelector("#vip_auto"); if (autoBtn) { autoBtn.innerHTML = "关"; autoBtn.title = "点击开启自动解析"; } setTimeout(() => { window.location.reload(); }, 1500); }); } function createVipButton() { // ===== 修复3:防止重复创建浮标 ===== // 检查当前文档和顶层文档是否已存在浮标 if (document.getElementById(CONFIG.vipBoxId) || (window.top && window.top.document && window.top.document.getElementById(CONFIG.vipBoxId))) { console.log('VIP浮标已存在,跳过创建'); return; } let currentType = GM_getValue(CONFIG.currentTypeKey, "1"); let simpleApisHtml = "
[内嵌播放+弹窗无选集]
"; let customAndDonateHtml = `
`; let autoPlay = !!GM_getValue(CONFIG.autoPlayerKey, null) ? "开" : "关"; const vipBox = document.createElement('div'); vipBox.id = CONFIG.vipBoxId; vipBox.innerHTML = `
VIP
${simpleApisHtml} ${complexApisHtml}
📖 使用说明:
  1、解析视频:点击内嵌播放接口即可解析当前视频(推荐"789"或"虾米")
  2、播放模式:点击接口名称右侧的"内嵌/弹窗"可切换播放模式
  3、解析切集后:解析完切换新集数后会自动关闭旧播放器,如开启自动解析则自动解析新集数
  4、自动解析:在"自动解析设置"中选择接口(默认789),点击顶部"开/关"按钮控制
  5、自定义设置:可自定义面板样式、快捷键、添加解析接口等
  6、快捷键:Alt+V 呼出/隐藏浮标,Alt+R 刷新接口,Alt+S 打开样式设置
  7、播放器接管:解析时原播放器暂停,关闭解析后可继续播放原视频
${autoPlay}
`; const savePos = GM_getValue(CONFIG.panelPosKey, { top: 120, left: 0 }); vipBox.style.top = savePos.top + 'px'; vipBox.style.left = savePos.left + 'px'; // ===== 确保浮标只添加到顶层body ===== const targetBody = window.top.document.body || document.body; if (targetBody) { targetBody.appendChild(vipBox); initDOMCache(vipBox); if (!!GM_getValue(CONFIG.autoPlayerKey, null)) { setTimeout(() => { autoPlayVideo(); }, 2500); } } else { // 如果body还未加载,等待DOM加载完成 findTargetElement('body') .then((container) => { container.appendChild(vipBox); initDOMCache(vipBox); if (!!GM_getValue(CONFIG.autoPlayerKey, null)) { setTimeout(() => { autoPlayVideo(); }, 2500); } }) .catch(() => { document.body.appendChild(vipBox); initDOMCache(vipBox); if (!!GM_getValue(CONFIG.autoPlayerKey, null)) { setTimeout(() => { autoPlayVideo(); }, 2500); } }); } } function initDOMCache(vipBox) { DOM_CACHE.vipBox = vipBox; DOM_CACHE.vipList = vipBox.querySelector('.vip_list'); DOM_CACHE.vipTab = vipBox.querySelector('#vip-tab'); DOM_CACHE.donateTab = vipBox.querySelector('#donate-tab'); DOM_CACHE.addApiForm = vipBox.querySelector('#add-api-form'); DOM_CACHE.apiNameInput = vipBox.querySelector('#api-name'); DOM_CACHE.apiUrlInput = vipBox.querySelector('#api-url'); DOM_CACHE.apiTypeSelect = vipBox.querySelector('#api-type'); DOM_CACHE.simpleApiList = vipBox.querySelector('.simple-api-list'); DOM_CACHE.complexApiList = vipBox.querySelector('.complex-api-list'); createStyleSetPanel(); createShortcutSetPanel(); createAutoParseSetPanel(); applyPanelStyle(); bindEvents(); } function togglePlayMode(element) { const listItem = element.closest('.api-item'); const modes = listItem.dataset.modes.split(','); const currentMode = listItem.dataset.currentMode; let nextModeIndex = modes.indexOf(currentMode) + 1; if (nextModeIndex >= modes.length) nextModeIndex = 0; const nextMode = modes[nextModeIndex]; let modeText = nextMode === "1" ? "内嵌" : "弹窗"; element.textContent = modeText; listItem.dataset.currentMode = nextMode; } function bindEvents() { const vipBox = DOM_CACHE.vipBox; const vipList = DOM_CACHE.vipList; vipBox.querySelector(".vip_icon").addEventListener("mouseover", () => { vipBox.classList.add("visible"); vipList.classList.add("visible"); setTimeout(() => { const items = vipList.querySelectorAll('li, .section-title, #donate_section'); items.forEach((item, index) => { setTimeout(() => { item.style.transitionDelay = '0ms'; }, index * 30); }); }, 50); }); vipBox.querySelector(".vip_icon").addEventListener("mouseout", (e) => { // 检查鼠标是否移动到vipList上 const relatedTarget = e.relatedTarget; if (relatedTarget && (vipList.contains(relatedTarget) || relatedTarget === vipList)) { return; // 如果移动到列表上,不隐藏 } vipList.classList.remove("visible"); vipBox.classList.remove("visible"); const items = vipList.querySelectorAll('li, .section-title, #donate_section'); items.forEach(item => { item.style.transitionDelay = ''; }); }); // vipList的鼠标事件 vipList.addEventListener("mouseenter", () => { vipBox.classList.add("visible"); vipList.classList.add("visible"); }); vipList.addEventListener("mouseleave", () => { vipList.classList.remove("visible"); vipBox.classList.remove("visible"); const items = vipList.querySelectorAll('li, .section-title, #donate_section'); items.forEach(item => { item.style.transitionDelay = ''; }); }); const tabButtons = vipBox.querySelectorAll(".tab-button"); tabButtons.forEach(button => { button.addEventListener("click", function() { tabButtons.forEach(btn => btn.classList.remove("active")); vipBox.querySelectorAll(".tab-content").forEach(content => content.classList.remove("active")); this.classList.add("active"); const tabId = this.getAttribute("data-tab"); vipBox.querySelector(`#${tabId}-tab`).classList.add("active"); }); }); vipBox.querySelector('#open-style-set-btn').addEventListener('click', (e) => { e.stopPropagation(); const stylePanel = DOM_CACHE.styleSetPanel; const isVisible = stylePanel.style.display === 'block'; // 隐藏所有设置面板 DOM_CACHE.addApiForm.style.display = 'none'; DOM_CACHE.styleSetPanel.style.display = 'none'; DOM_CACHE.shortcutSetPanel.style.display = 'none'; DOM_CACHE.autoParseSetPanel.style.display = 'none'; // 切换当前面板 stylePanel.style.display = isVisible ? 'none' : 'block'; }); vipBox.querySelector('#open-shortcut-set-btn').addEventListener('click', (e) => { e.stopPropagation(); const shortcutPanel = DOM_CACHE.shortcutSetPanel; const isVisible = shortcutPanel.style.display === 'block'; // 隐藏所有设置面板 DOM_CACHE.addApiForm.style.display = 'none'; DOM_CACHE.styleSetPanel.style.display = 'none'; DOM_CACHE.shortcutSetPanel.style.display = 'none'; DOM_CACHE.autoParseSetPanel.style.display = 'none'; // 切换当前面板 shortcutPanel.style.display = isVisible ? 'none' : 'block'; }); vipBox.querySelector('#open-auto-parse-set-btn').addEventListener('click', (e) => { e.stopPropagation(); const autoParsePanel = DOM_CACHE.autoParseSetPanel; const isVisible = autoParsePanel.style.display === 'block'; // 隐藏所有设置面板 DOM_CACHE.addApiForm.style.display = 'none'; DOM_CACHE.styleSetPanel.style.display = 'none'; DOM_CACHE.shortcutSetPanel.style.display = 'none'; DOM_CACHE.autoParseSetPanel.style.display = 'none'; // 切换当前面板 autoParsePanel.style.display = isVisible ? 'none' : 'block'; }); const addApiBtn = vipBox.querySelector("#add_api_btn"); if (addApiBtn) { addApiBtn.addEventListener("click", function(e) { e.stopPropagation(); const isVisible = DOM_CACHE.addApiForm.style.display === "block"; // 隐藏所有设置面板 DOM_CACHE.addApiForm.style.display = 'none'; DOM_CACHE.styleSetPanel.style.display = 'none'; DOM_CACHE.shortcutSetPanel.style.display = 'none'; DOM_CACHE.autoParseSetPanel.style.display = 'none'; // 切换当前面板 DOM_CACHE.addApiForm.style.display = isVisible ? "none" : "block"; }); } const saveApiBtn = vipBox.querySelector("#save-api-btn"); if (saveApiBtn) { saveApiBtn.addEventListener("click", function(e) { e.stopPropagation(); const name = DOM_CACHE.apiNameInput.value.trim(); const url = DOM_CACHE.apiUrlInput.value.trim(); const type = DOM_CACHE.apiTypeSelect.value; if (!name || !url) { alert('请填写完整信息'); return; } if (!url.includes('?url=') && !url.includes('&url=')) { alert('接口地址必须包含 "?url=" 或 "&url=" 参数占位符'); return; } const newApi = { name, type, url }; customApis.push(newApi); allApis = [...uniqueApis, ...customApis]; GM_setValue("custom_parse_apis", customApis); DOM_CACHE.addApiForm.reset(); DOM_CACHE.addApiForm.style.display = "none"; renderApiLists(); Swal.fire('添加成功', '自定义接口已添加,直接使用无需刷新!', 'success'); }); } const cancelApiBtn = vipBox.querySelector("#cancel-api-btn"); if (cancelApiBtn) { cancelApiBtn.addEventListener("click", function(e) { e.stopPropagation(); DOM_CACHE.addApiForm.style.display = "none"; }); } vipBox.querySelector('#vip-tab').addEventListener("click", (e) => { if (e.target.classList.contains('mode-toggle')) { togglePlayMode(e.target); return; } const apiItem = e.target.closest('.api-item'); if (!apiItem) return; const index = parseInt(apiItem.getAttribute("data-index")); const videoObj = allApis[index]; let apiType; if (apiItem.classList.contains('combined-simple')) { apiType = apiItem.dataset.currentMode; } else { apiType = apiItem.getAttribute("data-mode"); } if (apiType === "1") { // 保存选中的接口索引(用于自动解析) GM_setValue(CONFIG.autoPlayerVal, index); GM_setValue(CONFIG.flag, "true"); // 标记手动解析过 playVideo(videoObj, true, encodeVideoUrl(window.location.href)); vipBox.querySelectorAll(".api-item").forEach(li => li.classList.remove("selected")); apiItem.classList.add("selected"); // 更新自动解析按钮的提示 if (!!GM_getValue(CONFIG.autoPlayerKey, null)) { vipBox.querySelector("#vip_auto").title = `自动解析源:${videoObj.name}`; } } else { const encodedUrl = encodeVideoUrl(window.location.href); const parseUrl = videoObj.url + encodedUrl; GM_openInTab(parseUrl, {active: true, insert: true, setParent: true}); } }); vipBox.querySelector("#vip_auto").addEventListener("click", function() { if (!!GM_getValue(CONFIG.autoPlayerKey, null)) { // 如果已开启,点击关闭 GM_setValue(CONFIG.autoPlayerKey, null); this.innerHTML = "关"; this.title = "点击开启自动解析"; Swal.fire({ title: '已关闭自动解析', text: '刷新页面后生效', icon: 'info', timer: 1500, showConfirmButton: false }); setTimeout(() => { window.location.reload(); }, 1500); } else { // 检查是否已设置接口 const selectedIndex = GM_getValue(CONFIG.autoPlayerVal, 0); const selectedApi = allApis[selectedIndex]; if (!selectedApi || !selectedApi.type.includes("1")) { Swal.fire({ title: '请先设置自动解析接口', text: '点击下方"自动解析设置"按钮选择解析接口', icon: 'info', confirmButtonText: '知道了' }); return; } // 开启自动解析 GM_setValue(CONFIG.autoPlayerKey, "true"); this.innerHTML = "开"; this.title = `自动解析源:${selectedApi.name}`; Swal.fire({ title: '已开启自动解析', html: `使用 ${selectedApi.name} 自动解析
刷新页面后生效`, icon: 'success', timer: 1500, showConfirmButton: false }); setTimeout(() => { window.location.reload(); }, 1500); } }); vipBox.addEventListener("mousedown", function(e) { if (e.button !== 0) return; const target = e.target; const vipIcon = vipBox.querySelector(".vip_icon"); const autoBtn = vipBox.querySelector("#vip_auto"); if (vipBox.querySelector(".vip_list").contains(target)) return; if (!vipIcon.contains(target) && target !== autoBtn) return; e.preventDefault(); vipBox.style.cursor = "move"; const oldTransition = vipBox.style.transition; vipBox.style.transition = "none"; const positionDiv = vipBox.getBoundingClientRect(); let distenceX = e.clientX - positionDiv.left; let distenceY = e.clientY - positionDiv.top; document.addEventListener("mousemove", moveHandler); document.addEventListener("mouseup", upHandler); function moveHandler(e) { let x = e.clientX - distenceX; let y = e.clientY - distenceY; const windowWidth = window.innerWidth; const windowHeight = window.innerHeight; if (x < 0) x = 0; else if (x > windowWidth - vipBox.offsetWidth - 100) { x = windowWidth - vipBox.offsetWidth - 100; } if (y < 0) y = 0; else if (y > windowHeight - vipBox.offsetHeight) { y = windowHeight - vipBox.offsetHeight; } vipBox.style.left = x + "px"; vipBox.style.top = y + "px"; } function upHandler() { document.removeEventListener("mousemove", moveHandler); document.removeEventListener("mouseup", upHandler); vipBox.style.cursor = "pointer"; vipBox.style.transition = oldTransition; GM_setValue(CONFIG.panelPosKey, { left: parseInt(vipBox.style.left), top: parseInt(vipBox.style.top) }); } }); } function addCustomApi() { Swal.fire({ title: '添加自定义解析接口', html: ` `, confirmButtonText: '添加', focusConfirm: false, preConfirm: () => { const name = document.getElementById('api-name').value; const url = document.getElementById('api-url').value; const type = document.getElementById('api-type').value; if (!name || !url) { Swal.showValidationMessage('请填写完整信息'); return false; } if (!url.includes('?url=') && !url.includes('&url=')) { Swal.showValidationMessage('接口地址必须包含 "?url=" 或 "&url=" 参数占位符'); return false; } return { name, url, type }; } }).then(result => { if (result.isConfirmed) { const newApi = { name: result.value.name, type: result.value.type, url: result.value.url }; customApis.push(newApi); allApis = [...uniqueApis, ...customApis]; GM_setValue("custom_parse_apis", customApis); renderApiLists(); Swal.fire('添加成功', '自定义接口已添加,直接使用无需刷新!', 'success'); } }); } // 使用别人的简单粗暴方式:直接清空容器+持续清理video function playVideo(videoObj, isEmbed, encodedUrl = null) { if (!isEmbed) return; const finalUrl = encodedUrl || encodeVideoUrl(window.location.href); const parseUrl = videoObj.url + finalUrl; // 获取当前网站的播放器容器配置 const host = window.location.hostname; const playerConfig = PLAYER_CONTAINERS.find(config => host.includes(config.host)); if (!playerConfig) { console.warn('未找到当前网站的播放器配置'); return; } // 隐藏displayNodes中的元素 if (playerConfig.displayNodes && playerConfig.displayNodes.length > 0) { // 立即隐藏一次 const hideElements = () => { playerConfig.displayNodes.forEach(selector => { try { const elements = document.querySelectorAll(selector); elements.forEach(el => { el.style.display = 'none'; el.style.visibility = 'hidden'; el.style.opacity = '0'; el.style.pointerEvents = 'none'; el.style.zIndex = '-9999'; }); } catch (e) { // 忽略选择器错误 } }); }; // 立即执行一次 hideElements(); // 持续隐藏机制:每500ms检查并隐藏这些元素 const hideInterval = setInterval(hideElements, 500); // 将定时器保存,以便后续清理 window._vipHideInterval = hideInterval; } // 查找原播放器容器 findTargetElement(playerConfig.container) .then((container) => { // 完全清空容器(和别人的代码一样) container.innerHTML = ''; // 持续移除video(和别人的util.reomveVideo()一样) const videoCleanupInterval = setInterval(() => { for (let video of document.getElementsByTagName("video")) { if (video.src) { video.removeAttribute("src"); video.muted = true; video.load(); video.pause(); } } }, 500); // 创建iframe容器 const iframeWrapper = document.createElement('div'); iframeWrapper.style.cssText = 'position:absolute;top:0;left:0;width:100%;height:100%;'; const iframe = document.createElement('iframe'); iframe.src = parseUrl; iframe.frameBorder = '0'; iframe.allow = 'autoplay; encrypted-media; fullscreen'; iframe.allowFullscreen = true; iframe.referrerPolicy = 'no-referrer'; iframe.style.cssText = 'width:100%;height:100%;border:none;'; // 创建鼠标捕获层(透明遮罩,用于捕获鼠标移动事件) const mouseCatcher = document.createElement('div'); mouseCatcher.style.cssText = ` position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 9999999; pointer-events: auto; background: transparent; `; // 创建关闭按钮 const closeBtn = document.createElement("div"); closeBtn.className = "vip-player-close-btn"; closeBtn.innerHTML = "×"; closeBtn.title = "关闭解析(刷新页面恢复原视频)"; closeBtn.style.cssText = ` position: absolute; top: 15px; right: 15px; z-index: 10000000; width: auto; height: auto; padding: 5px 10px; background: transparent; border: none; cursor: pointer; font-size: 32px; color: rgba(255, 255, 255, 0.8); transition: all 0.3s ease; text-shadow: 0 2px 4px rgba(0,0,0,0.5); opacity: 0; pointer-events: none; `; // 显示关闭按钮并设置3秒后自动隐藏 let hideTimer = null; const showCloseBtn = () => { clearTimeout(hideTimer); closeBtn.style.opacity = '1'; closeBtn.style.pointerEvents = 'auto'; // 鼠标在按钮上时,禁用鼠标捕获层,让按钮可以点击 mouseCatcher.style.pointerEvents = 'none'; hideTimer = setTimeout(() => { closeBtn.style.opacity = '0'; closeBtn.style.pointerEvents = 'none'; // 按钮隐藏后,重新启用鼠标捕获层 mouseCatcher.style.pointerEvents = 'auto'; }, 3000); }; // 在鼠标捕获层上监听鼠标移动和进入事件 mouseCatcher.onmousemove = showCloseBtn; mouseCatcher.onmouseenter = showCloseBtn; closeBtn.onmouseover = () => { clearTimeout(hideTimer); closeBtn.style.color = 'rgba(255, 255, 255, 1)'; closeBtn.style.transform = 'scale(1.2)'; }; closeBtn.onmouseout = () => { closeBtn.style.color = 'rgba(255, 255, 255, 0.8)'; closeBtn.style.transform = 'scale(1)'; showCloseBtn(); // 鼠标离开按钮时重新开始1秒倒计时 }; closeBtn.onclick = () => { clearInterval(videoCleanupInterval); // 清理持续隐藏的定时器 if (window._vipHideInterval) { clearInterval(window._vipHideInterval); window._vipHideInterval = null; } window.location.reload(); }; iframeWrapper.appendChild(iframe); iframeWrapper.appendChild(mouseCatcher); iframeWrapper.appendChild(closeBtn); container.appendChild(iframeWrapper); }) .catch(() => { console.warn('未找到播放器容器'); }); } function autoPlayVideo() { let index = GM_getValue(CONFIG.autoPlayerVal, 0); let autoObj = allApis[index]; if (autoObj && autoObj.type.includes("1")) { playVideo(autoObj, true, encodeVideoUrl(window.location.href)); const vipBox = DOM_CACHE.vipBox; if (vipBox) { const selectedItem = vipBox.querySelector(`.api-item[data-index="${index}"]`); if (selectedItem) { selectedItem.classList.add("selected"); } vipBox.querySelector("#vip_auto").title = `自动解析源:${autoObj.name}`; } } } // 监听URL变化(简化版,和别人的逻辑一样) function monitorUrlChange() { if (!!GM_getValue(CONFIG.autoPlayerKey, null)) { // 如果开启了自动解析,URL变化时刷新页面 const oldHref = window.location.href; setInterval(() => { let newHref = window.location.href; if (oldHref !== newHref) { window.location.reload(); } }, 500); } else { // 如果没开启自动解析,检测到手动解析后URL变化时刷新 let oldHref = window.location.href; setInterval(() => { let newHref = window.location.href; if (oldHref !== newHref) { oldHref = newHref; if (!!GM_getValue(CONFIG.flag, null)) { window.location.reload(); } } }, 1000); } } function waitForBody() { if (document.body) { createVipButton(); } else { requestAnimationFrame(waitForBody); } } document.addEventListener('keydown', (e) => { if (!e.altKey) return; const vipBox = DOM_CACHE.vipBox; if (!vipBox) return; switch (e.key.toLowerCase()) { case CONFIG.shortcut.toggle: e.preventDefault(); vipBox.style.display = vipBox.style.display === 'none' ? 'block' : 'none'; if (vipBox.style.display === 'block') { vipBox.classList.add('visible'); vipBox.querySelector('.vip_list').classList.add('visible'); } break; case CONFIG.shortcut.refresh: e.preventDefault(); customApis = GM_getValue("custom_parse_apis", []); allApis = [...uniqueApis, ...customApis]; renderApiLists(); Swal.fire('刷新成功', '接口列表已重新加载!', 'success'); break; case CONFIG.shortcut.style: e.preventDefault(); const stylePanel = DOM_CACHE.styleSetPanel; if (stylePanel) { stylePanel.style.display = stylePanel.style.display === 'block' ? 'none' : 'block'; DOM_CACHE.vipBox.querySelector('.tab-button[data-tab="donate"]').click(); } break; } }); (function registerMenu() { GM_registerMenuCommand('🎬 VIP解析窗口', function() { const vipBox = document.getElementById(CONFIG.vipBoxId); if (vipBox) { vipBox.style.display = "block"; vipBox.querySelector(".vip_list").style.display = "block"; } else { createVipButton(); } }, 'v'); GM_registerMenuCommand('📊 脚本状态', function() { const version = GM_info.script.version; alert('当前版本:' + version + '\\n解析工具已启动,支持多平台VIP视频解析\\n共整合 '+ allApis.length +' 个解析接口\\n支持样式自定义、快捷键自定义、接口动态添加!'); }); })(); const util = { findTargetEle: (targetEle) => findTargetElement(targetEle) }; const SUPPORT_HOSTS = [ "iqiyi.com", "youku.com", "v.qq.com", "mgtv.com", "bilibili.com", "le.com", "sohu.com", "pptv.com", "1905.com", "iq.com", "qq.com", "tudou.com" ]; const host = window.location.hostname; const isSupportSite = SUPPORT_HOSTS.some(h => host.includes(h)); if (isSupportSite) { // 确保只创建一次VIP浮标 let vipButtonCreated = false; // 初始化flag GM_setValue(CONFIG.flag, null); util.findTargetEle('body') .then(() => { if (!vipButtonCreated) { vipButtonCreated = true; createVipButton(); monitorUrlChange(); // 启动URL监听 } }) .catch(() => { if (document.readyState === "loading") { document.addEventListener("DOMContentLoaded", () => { if (!vipButtonCreated) { vipButtonCreated = true; waitForBody(); monitorUrlChange(); // 启动URL监听 } }); } else { if (!vipButtonCreated) { vipButtonCreated = true; waitForBody(); monitorUrlChange(); // 启动URL监听 } } }); } })();