替换Teracloud分享页面Google资源为国内CDN地址

解决InfiniCLOUD(原Teracloud)因使用Google相关的js资源导致无法正常访问的问题

  1. // ==UserScript==
  2. // @name 替换Teracloud分享页面Google资源为国内CDN地址
  3. // @namespace https://axutongxue.com/
  4. // @version 0.0.1
  5. // @description 解决InfiniCLOUD(原Teracloud)因使用Google相关的js资源导致无法正常访问的问题
  6. // @author 阿虚同学
  7. // @license GPL-2.0
  8. // @update 2024/6/14
  9. // @match https://*.teracloud.jp/*
  10. // @homepageURL https://axutongxue.com/
  11. // @run-at document-start
  12. // ==/UserScript==
  13. /* eslint-disable */
  14.  
  15. !function() {
  16. "use strict";
  17. document.querySelectorAll("script").forEach((function(e) {
  18. if (e.src.indexOf("googleapis.com") >= 0 || e.src.indexOf("themes.googleusercontent.com") >= 0 || e.src.indexOf("www.google.com/recaptcha/") >= 0) {
  19. let c = e.src.replace("http://", "https://").replace("googleapis.com", "proxy.ustclug.org").replace("themes.googleusercontent.com", "google-themes.lug.ustc.edu.cn").replace("www.google.com/recaptcha/", "www.recaptcha.net/recaptcha/");
  20. e.parentNode.replaceChild(function(e) {
  21. let c = document.createElement("script");
  22. return c.src = e, c;
  23. }(c), e);
  24. }
  25. }));
  26. }();