ACT.谷歌.MO.Stay

留在网络而非应用,移除谷歌微件和APP推广横幅。

  1. // ==UserScript==
  2. // @name ACT.Google.MO.Stay
  3. // @name:zh-CN ACT.谷歌.MO.Stay
  4. // @description Stay in web not app, Google Widget and APP Banner Remove.
  5. // @description:zh-CN 留在网络而非应用,移除谷歌微件和APP推广横幅。
  6. // @author ACTCD
  7. // @version 20220722.1
  8. // @license GPL-3.0-or-later
  9. // @namespace ACTCD/Userscripts
  10. // @supportURL https://github.com/ACTCD/Userscripts#contact
  11. // @homepageURL https://github.com/ACTCD/Userscripts
  12. // @match *://*.google.com/*
  13. // @match *://*.google.com.hk/*
  14. // @grant none
  15. // @inject-into content
  16. // @run-at document-start
  17. // ==/UserScript==
  18.  
  19. (function () {
  20. "use strict";
  21.  
  22. function cleaner() {
  23. const careful_remove = (e) =>
  24. !e ||
  25. e.className == "main" ||
  26. e.id == "gb-main" ||
  27. e.remove() ||
  28. console.info("REMOVE:", e);
  29. // Index - Bottom App Banner
  30. document.querySelectorAll("mobile-promo").forEach((e) => {
  31. // console.info('GOTCHA:', e); // DEBUG
  32. careful_remove(e.closest("body>div"));
  33. });
  34. document.querySelectorAll("g-raised-button").forEach((e) => {
  35. if (e.textContent.includes("Try it") || e.textContent.includes("试用")) {
  36. // console.info('GOTCHA:', e); // DEBUG
  37. careful_remove(e.closest("body>div[style]"));
  38. }
  39. });
  40. // Search - Bottom Widget Banner
  41. document.querySelectorAll("button").forEach((e) => {
  42. if (e.textContent == "Get the app" || e.textContent == "获取该应用") {
  43. // console.info('GOTCHA:', e); // DEBUG
  44. careful_remove(e.closest("body>div[id][style]"));
  45. }
  46. });
  47. }
  48.  
  49. new MutationObserver(cleaner).observe(document, {
  50. subtree: true,
  51. childList: true,
  52. });
  53.  
  54. function DOMContentLoaded() {
  55. cleaner();
  56. }
  57.  
  58. if (document.readyState === "loading") {
  59. document.addEventListener("DOMContentLoaded", DOMContentLoaded);
  60. } else {
  61. DOMContentLoaded();
  62. }
  63.  
  64. const style = document.createElement("style");
  65. style.textContent = `/* Global style */
  66. #center_col #taw { display: none !important; } /* AD */
  67. #center_col #tads { display: none !important; } /* AD */
  68. `;
  69.  
  70. if (document.head) {
  71. document.head.append(style);
  72. } else {
  73. new MutationObserver((mutationList, observer) => {
  74. document.head && (observer.disconnect(), document.head.append(style));
  75. }).observe(document, { subtree: true, childList: true });
  76. }
  77. })();

QingJ © 2025

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