Search: #去重

  1. 今日实用 UserScript: 野果短剧跳过片头广告

    今日实用 UserScript: 野果短剧跳过片头广告

    vibe 的
    AI 真是太好用了

    只写了个适配 https://harbor.fgeaqvlf.cc 的
    用镜像站的自己改下就行

    // ==UserScript==
    // @name         野果短剧跳过片头广告
    // @namespace    harbor-userscripts
    // @version      1.0.0
    // @description  自动关闭播放前置广告,支持刷新和站内切集。
    // @match        https://harbor.fgeaqvlf.cc/*
    // @run-at       document-start
    // @grant        none
    // @sandbox      raw
    // @inject-into  page
    // @noframes
    // ==/UserScript==
    
    (() => {
      'use strict';
    
      const closed = new WeakSet();
    
      // shortcut: 依赖当前 Vue 组件名及 VNode 结构,网站重构播放器时需更新。
      function visit(vnode) {
        if (!vnode) return;
    
        const instance = vnode.component;
        if (instance?.type?.__name === 'PrerollAd') {
          if (instance.isMounted && !instance.isUnmounted && !closed.has(instance)) {
            closed.add(instance);
            instance.emit('close');
          }
          return;
        }
    
        visit(instance?.subTree);
        visit(vnode.suspense?.activeBranch);
        if (Array.isArray(vnode.children)) vnode.children.forEach(visit);
      }
    
      function skipAd() {
        if (!location.pathname.startsWith('/drama/video/')) return;
        visit(document.getElementById('__nuxt')?._vnode);
      }
    
      new MutationObserver(skipAd).observe(document, { childList: true, subtree: true });
      skipAd();
    })();


    合集 恰饭推荐 群组 联系推广

    #去广告 #野果短剧 #UserScript #脚本

    • ❤️1