// ==UserScript== // @name 国外静态资源js和css资源CDN替换国内 // @namespace 辉哥博客 // @version 0.0.2 // @description 将国外的静态资源js和css资源替换成国内的 CDN 地址 // @author 辉哥博客 // @license GPL-2.0 // @update 2022/6/27 // @match *://*/* // @homepageURL https://www.haah.net // @downloadURL none // ==/UserScript== /* eslint-disable */ !function() { "use strict"; document.querySelectorAll("script").forEach((function(e) { if (e.src.indexOf("themes.googleusercontent.com") >= 0 || e.src.indexOf("fonts.gstatic.com") >= 0 || e.src.indexOf("www.google.com/recaptcha/") >= 0 || e.src.indexOf("secure.gravatar.com") >= 0 || e.src.indexOf("ajax.googleapis.com") >= 0 || e.src.indexOf("fonts.googleapis.com") >= 0 || e.src.indexOf("cdnjs.cloudflare.com") >= 0 || e.src.indexOf("cdn.jsdelivr.net") >= 0 || e.src.indexOf("www.gstatic.com") >= 0) { let c = e.src.replace("http://", "https://").replace("themes.googleusercontent.com", "gtheme.cdn.haah.net").replace("fonts.gstatic.com", "gfont.cdn.haah.net").replace("secure.gravatar.com", "gravatar.cdn.haah.net").replace("ajax.googleapis.com", "gajax.cdn.haah.net").replace("fonts.googleapis.com", "gfont.cdn.haah.net").replace("cdnjs.cloudflare.com", "cdnjs.cdn.haah.net").replace("www.google.com/recaptcha/", "www.recaptcha.net/recaptcha/").replace("cdn.jsdelivr.net", "js.cdn.haah.net").replace("www.gstatic.com", "wgstatic.cdn.haah.net"); e.parentNode.replaceChild(function(e) { let c = document.createElement("script"); return c.src = e, c; }(c), e); } })); }();