aio

个人实用小插件

  1. // ==UserScript==
  2. // @name aio
  3. // @namespace http://tampermonkey.net/
  4. // @version 2025-03-28
  5. // @description 个人实用小插件
  6. // @author jiejiejie
  7. // @match *://*.juquge.com/*
  8. // @match *://geek-docs.com/*
  9. // @match *://weixin110.qq.com/*
  10. // @match *://cowork.apexsoft.com.cn/*
  11. // @icon https://www.google.com/s2/favicons?sz=64&domain=juquge.com
  12. // @grant none
  13. // ==/UserScript==
  14. var timer = null;
  15. var aio = () => {
  16. // 等待页面加载完成
  17. // 获取当前用户 url
  18. const getCurrentUrl = () => window.location.href;
  19. const getWebSite = (url) => {
  20. let juqugeReg = /juquge/;
  21. let geekDocsReg = /geek-docs/;
  22. let coworkReg = /cowork/;
  23. if (juqugeReg.test(url)) {
  24. return "juquge";
  25. } else if (geekDocsReg.test(url)) {
  26. return "geekDocs";
  27. } else if (coworkReg.test(url)) {
  28. return "cowork";
  29. }
  30. };
  31. // 处理笔趣阁样式
  32. const DealJuquge = () => {
  33. console.log("juquge-aio-loaded");
  34. const init = () => {
  35. };
  36. const main = () => {
  37. };
  38. init();
  39. main();
  40. };
  41. // 处理极客文档
  42. const DealGeekDocs = () => {
  43. console.log("geekDocs-aio-loaded");
  44. // 解锁无法滚动
  45. const unlockScroll = () => {
  46. document.body.setAttribute("style", "overflow: auto");
  47. console.log("滚动条已解锁");
  48. };
  49. // 删除广告
  50. const deleteAds = () => {
  51. // 删除开屏广告
  52. let viewAdEle = document.querySelector(".fc-message-root");
  53. viewAdEle?.parentElement?.removeChild(viewAdEle);
  54. // 删除右侧广告
  55. let rightAds = document.querySelector(".tbrside");
  56. rightAds?.parentElement?.removeChild(rightAds);
  57. // 删除底部广告
  58. let bottomAds = document.querySelector(".adsbygoogle");
  59. bottomAds?.parentElement?.removeChild(bottomAds);
  60. // 去除文章中广告
  61. let contentAds = document.querySelectorAll(".eaa_desktop");
  62. contentAds.forEach((item) => {
  63. item.parentElement?.removeChild(item);
  64. });
  65. console.log("广告已删除");
  66. };
  67. // 平铺文章
  68. const fullContent = () => {
  69. let contentWrapEle = document.querySelector(".content-wrap");
  70. let contentEle = document.querySelector(".content");
  71. contentWrapEle.setAttribute("style", "margin-right: 0 !important");
  72. contentEle.setAttribute("style", "margin-right: 0 !important");
  73. console.log("文章已平铺");
  74. };
  75. const init = () => {
  76. let clearButton = document.createElement("button");
  77. clearButton.innerHTML = "清除广告";
  78. clearButton.setAttribute("style", "position: fixed; bottom: 100px; right: 0; z-index: 9999999999;");
  79. clearButton.onclick = main;
  80. document.body.appendChild(clearButton);
  81. // deal_geekDocs()
  82. };
  83. const main = () => {
  84. unlockScroll();
  85. deleteAds();
  86. fullContent();
  87. };
  88. init();
  89. };
  90. // 处理 cowork 在 firefox 上的样式问题
  91. const DealCowork = () => {
  92. console.log("cowork-aio-loaded");
  93. let iframeEle = document.querySelector("iframe").contentWindow;
  94. const dealAlert = () => {
  95. iframeEle.alert = () => {
  96. };
  97. window.alert = () => {
  98. };
  99. };
  100. const dealStyle = () => {
  101. let fixButton = document.createElement("button");
  102. fixButton.innerHTML = "修复样式";
  103. fixButton.onclick = () => {
  104. let contentEle = iframeEle.document.querySelector(".mainContainer");
  105. contentEle.setAttribute("style", "width:-webkit-fill-available;height: 100%;");
  106. };
  107. let mountNodeLength = iframeEle.document.querySelectorAll(".left_menu").length;
  108. let buttonForm = iframeEle.document.querySelectorAll(".left_menu")[mountNodeLength - 1 > 0 ? mountNodeLength - 1 : 0];
  109. buttonForm.appendChild(fixButton);
  110. };
  111. dealAlert();
  112. dealStyle();
  113. };
  114. if (!window || !window.addEventListener) {
  115. if (timer) {
  116. console.log("by aio: window dont exist and timer is empty");
  117. clearTimeout(timer);
  118. }
  119. timer = setTimeout(() => {
  120. console.log("by aio: aio will run after 2s");
  121. aio();
  122. }, 2000);
  123. } else {
  124. if (timer) {
  125. console.log("by aio: window exist and timer is not empty, timer will be cleared");
  126. clearTimeout(timer);
  127. }
  128. window.addEventListener("load", () => {
  129. console.log("by aio: window loaded");
  130. let currentUrl = getCurrentUrl();
  131. let webSite = getWebSite(currentUrl);
  132. console.log(webSite);
  133. switch (webSite) {
  134. case "juquge":
  135. DealJuquge();
  136. break;
  137. case "geekDocs":
  138. DealGeekDocs();
  139. break;
  140. case "cowork":
  141. DealCowork();
  142. break;
  143. default:
  144. console.log("当前页面无法处理");
  145. }
  146. window.removeEventListener("load", () => {
  147. });
  148. });
  149. }
  150. };
  151. aio();

QingJ © 2025

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