// ==UserScript== // @name 埋堆堆播放页 · 去除试看/登录提示条 // @namespace local.mddcloud.player.clean // @version 1.0.0 // @description 隐藏播放器左下角「试看中,登录后同步相关权益 / 登录观看」等提示条。只清理界面,不改变登录与会员鉴权,也不影响播放。 // @author WorkBuddy // @match *://*.mddcloud.com.cn/* // @match *://mddcloud.com.cn/* // @run-at document-start // @noframes // @grant GM_getValue // @grant GM_setValue // @grant GM_registerMenuCommand // @license MIT // ==/UserScript== (function () { 'use strict'; // 想临时恢复原站提示:在油猴菜单里点一下开关即可;也可用下面的常量做默认关闭。 var DEFAULT_HIDE = true; var KEY = 'mdd_hide_try_toast'; var STYLE_ID = 'mdd-hide-try-toast-style'; // 站点提示条的真实类名(来自播放页组件 .try-toast / .try-toast.toastDown) // 同一个组件在 VIP 分支会显示「VIP会员观看完整版 / 开通VIP」,一并隐藏。 var CSS = [ '.try-toast,', '.try-toast.toastDown,', '[class*="try-toast"] {', ' display: none !important;', ' visibility: hidden !important;', ' pointer-events: none !important;', '}' ].join('\n'); function apply() { var on = GM_getValue(KEY, DEFAULT_HIDE); var st = document.getElementById(STYLE_ID); if (!on) { if (st) st.parentNode.removeChild(st); return; } if (!st) { st = document.createElement('style'); st.id = STYLE_ID; st.textContent = CSS; (document.head || document.documentElement).appendChild(st); } } // 页面是 Vue 动态渲染的:若站点用内联样式把提示条重新挂上来,这里再兜一次。 function watch() { var mo = new MutationObserver(function () { if (!GM_getValue(KEY, DEFAULT_HIDE)) return; var list = document.querySelectorAll('.try-toast, [class*="try-toast"]'); for (var i = 0; i < list.length; i++) { if (list[i].style.display !== 'none') { list[i].style.setProperty('display', 'none', 'important'); } } }); mo.observe(document.documentElement, { childList: true, subtree: true }); } apply(); if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', function () { apply(); watch(); }); } else { watch(); } // 菜单开关:切换后刷新页面,保证状态与菜单文字一致。 var on = GM_getValue(KEY, DEFAULT_HIDE); GM_registerMenuCommand( on ? '试看提示:已隐藏(点击恢复显示)' : '试看提示:显示中(点击隐藏)', function () { GM_setValue(KEY, !GM_getValue(KEY, DEFAULT_HIDE)); location.reload(); } ); })();