GitHub 加速 (Gist)

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

Mint 2021.05.31.. Lásd a legutóbbi verzió

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.

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
// @description  通过代理为 GitHub Gist 的 Raw Assets 提供加速
// @author       Mogeko
// @supportURL   https://github.com/Mogeko/user-script-ghproxy/issues
// @match        https://gist.github.com/*
// @icon         https://github.githubassets.com/pinned-octocat.svg
// @updataURL    https://cdn.jsdelivr.net/gh/Mogeko/user-script-ghproxy@master/agentGistRaw/agentGistRaw.user.js
// @run-at       document-end
// @grant        none
// @license      MIT
// ==/UserScript==

const PROXY_URL = 'https://ghproxy.com/';

const agentGistRaw = proxy => {
    const links = document
        .querySelectorAll('.file-actions a, .ml-2:nth-last-child(1) a');
    links.forEach(link => {
        link.href = proxy + link.href
    });
}

(function() {
    'use strict';
    agentGistRaw(PROXY_URL);
    document.addEventListener('pjax:success', () => {
        agentGistRaw(PROXY_URL);
    });
})();