GitHub 加速 (Gist)

通过代理为 GitHub Gist 的 Raw Assets 提供加速

اعتبارا من 26-08-2022. شاهد أحدث إصدار.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

ستحتاج إلى تثبيت إضافة مثل Stylus لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتتمكن من تثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

(لدي بالفعل مثبت أنماط للمستخدم، دعني أقم بتثبيته!)

// ==UserScript==
// @name        GitHub 加速 (Gist)
// @description 通过代理为 GitHub Gist 的 Raw Assets 提供加速
// @namespace   https://mogeko.me
// @supportURL  https://github.com/mogeko/userscripts/issues
// @match       https://gist.github.com/**
// @icon        https://besticon.herokuapp.com/icon?size=80..120..200&url=github.com
// @run-at      document-end
// @author      Mogeko
// @license     MIT
// @version     0.1.2
// @grant       none
// ==/UserScript==
(function () {
  'use strict';

  var PROXY_URL = "https://ghproxy.com/";
  function agentGistRaw(proxy) {
      var links = document.querySelectorAll(".file-actions a, .ml-2:nth-last-child(1) a");
      links.forEach(function(link) {
          link.href = proxy + link.href;
      });
  }
  agentGistRaw(PROXY_URL);
  document.addEventListener("pjax:success", function() {
      agentGistRaw(PROXY_URL);
  });

})();