「GM_脚本」获取 GitHub 项目文件的 jsDelivr CDN 地址「好像没啥用系列」

基本信息:

name:「 GitHub 」获取文件的 jsDelivr 地址

desc:获取项目文件的 CDN 地址

url: https://github.com/wdssmq/userscript/blob/master/Git/jsDelivr.user.js

可以直接通过这个链接安装:

https://cdn.jsdelivr.net/gh/wdssmq/userscript@master/Git/jsDelivr.user.js

重要 · 需要配合下边浏览器扩展使用:

https://github.com/EnixCoda/Gitako

↓ 效果如下图

001.png
function fnGetCDNUrl(url) {
  const arrMap = [
    ["https://github.com/", "https://cdn.jsdelivr.net/gh/"],
    ["/blob/", "@"]
  ]
  let cdnUrl = url;
  arrMap.forEach(line => {
    cdnUrl = cdnUrl.replace(line[0], line[1]);
  });
  return cdnUrl;
}

原文链接:https://www.wdssmq.com/post/20210724854.html

井盖口令:「我的咸鱼心」

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容