隐藏继续使用 Google 搜索前须知

隐藏继续使用 Google 搜索前须知的弹出提示

  1. // ==UserScript==
  2. // @name 隐藏继续使用 Google 搜索前须知
  3. // @version 1.0
  4. // @description 隐藏继续使用 Google 搜索前须知的弹出提示
  5. // @author ChatGPT
  6. // @match *://www.google.co.jp/*
  7. // @match *://www.google.com.hk/*
  8. // @match *://www.google.com/*
  9. // @run-at document-start
  10. // @namespace https://gf.qytechs.cn/users/452911
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. 'use strict';
  15.  
  16. // 定义一个计数器,用来记录执行次数
  17. let count = 0;
  18.  
  19. // 设置定时器,每隔300毫秒执行一次
  20. let intervalId = setInterval(function() {
  21. // 执行的脚本逻辑
  22. document.querySelectorAll('button, a').forEach(element => {
  23. if (element.textContent.includes('继续阅读') || element.textContent.includes('全部拒绝')) {
  24. element.click();
  25. }
  26. });
  27.  
  28. // 每执行一次计数器加1
  29. count++;
  30.  
  31. // 如果执行了10次,清除定时器
  32. if (count === 10) {
  33. clearInterval(intervalId);
  34. }
  35. }, 300);
  36.  
  37. // 添加隐藏元素的样式
  38. let style = document.createElement('style');
  39. style.innerHTML = `[aria-label='继续使用 Google 搜索前须知'] {display: none !important; visibility: hidden; opacity: 0; z-index: -999; width: 0; height: 0; pointer-events: none; position: absolute; left: -9999px; top: -9999px;}`;
  40. document.head.appendChild(style);
  41.  
  42. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址