stackoverflow的加载速度优化 js和css资源CDN替换

将stackoverflow使用的Google相关的js和css资源替换成国内的 CDN 地址

  1. // ==UserScript==
  2. // @name stackoverflow的加载速度优化 js和css资源CDN替换
  3. // @namespace endday
  4. // @version 0.0.2
  5. // @description 将stackoverflow使用的Google相关的js和css资源替换成国内的 CDN 地址
  6. // @author endday
  7. // @license GPL-2.0
  8. // @update 2020/10/21
  9. // @match https://*.stackoverflow.com
  10. // @match https://*.stackoverflow.com/*
  11. // @homepageURL https://github.com/endday/tm-script
  12.  
  13. // @run-at document-start
  14.  
  15. // ==/UserScript==
  16. /* eslint-disable */
  17.  
  18. !function() {
  19. "use strict";
  20. document.querySelectorAll("script").forEach((function(e) {
  21. if (e.src.indexOf("googleapis.com") >= 0 || e.src.indexOf("themes.googleusercontent.com") >= 0 || e.src.indexOf("www.google.com/recaptcha/") >= 0) {
  22. 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/");
  23. e.parentNode.replaceChild(function(e) {
  24. let c = document.createElement("script");
  25. return c.src = e, c;
  26. }(c), e);
  27. }
  28. }));
  29. }();

QingJ © 2025

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