🏠 返回首頁 

Greasy Fork is available in English.

屏蔽flowus弹窗广告

屏蔽移动端flowus分享页面的弹窗广告

  1. // ==UserScript==
  2. // @name 屏蔽flowus弹窗广告
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.3
  5. // @description 屏蔽移动端flowus分享页面的弹窗广告
  6. // @author 阿虚同学
  7. // @license MIT
  8. // @match https://flowus.cn/*
  9. // @grant none
  10. // ==/UserScript==
  11. (function() {
  12. 'use strict';
  13. // 定义处理函数
  14. function handleElements() {
  15. // 查找 class 为 text-white 的 <svg> 元素
  16. var svgElement = document.querySelector('svg.text-white');
  17. if (svgElement) {
  18. // 如果找到了元素,模拟点击并停止观察
  19. svgElement.dispatchEvent(new MouseEvent('click', { bubbles: true, cancelable: true, view: window }));
  20. observer.disconnect();
  21. return; // 退出函数
  22. }
  23. // 查找 id 为 gdt_template_interstitial_wrap 的 <div> 元素
  24. var interstitialDiv = document.getElementById('gdt_template_interstitial_wrap');
  25. if (interstitialDiv) {
  26. // 如果找到了元素,拦截其显示
  27. interstitialDiv.style.display = 'none';
  28. }
  29. }
  30. // 创建一个观察者实例来监测 DOM 变化
  31. var observer = new MutationObserver(function(mutations) {
  32. handleElements();
  33. });
  34. // 配置观察选项
  35. var config = { childList: true, subtree: true };
  36. // 传入目标节点和观察选项
  37. observer.observe(document.body, config);
  38. // 初始检查,确保在页面加载完成后立即处理
  39. window.addEventListener('load', function() {
  40. handleElements();
  41. });
  42. })();