GitHub 加速 (Gist)

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

Du musst eine Erweiterung wie Tampermonkey, Greasemonkey oder Violentmonkey installieren, um dieses Skript zu installieren.

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 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.

Sie müssten eine Skript Manager Erweiterung installieren damit sie dieses Skript installieren können

(Ich habe schon ein Skript Manager, Lass mich es installieren!)

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.

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

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

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

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

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

// ==UserScript==
// @name         GitHub 加速 (Gist)
// @namespace    https://mogeko.me
// @version      0.1.7
// @author       Zheng Junyi
// @description  通过代理为 GitHub Gist 的 Raw Assets 提供加速
// @license      MIT
// @icon         https://besticon.herokuapp.com/icon?size=80..120..200&url=github.com
// @homepage     https://github.com/mogeko/userscripts/tree/master/packages/ghproxy-gist-raw#readme
// @homepageURL  https://github.com/mogeko/userscripts/tree/master/packages/ghproxy-gist-raw#readme
// @source       https://github.com/mogeko/userscripts.git
// @supportURL   https://github.com/mogeko/userscripts/issues
// @match        https://gist.github.com/**
// @grant        none
// @run-at       document-end
// ==/UserScript==

(function () {
  'use strict';

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

})();