国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

GITHUB下載慢解決辦法-插件解決

這篇具有很好參考價(jià)值的文章主要介紹了GITHUB下載慢解決辦法-插件解決。希望對(duì)大家有所幫助。如果存在錯(cuò)誤或未考慮完全的地方,請(qǐng)大家不吝賜教,您也可以點(diǎn)擊"舉報(bào)違法"按鈕提交疑問。

GITHUB下載慢解決辦法-插件解決

?在油猴上搜索此插件。

或者直接導(dǎo)入插件代碼如下

// ==UserScript==
// @name         Github 增強(qiáng) - 高速下載
// @name:zh-CN   Github 增強(qiáng) - 高速下載
// @name:zh-TW   Github 增強(qiáng) - 高速下載
// @name:en      Github Enhancement - High Speed Download
// @version      2.1.10
// @author       X.I.U
// @description  高速下載 Git Clone/SSH、Release、Raw、Code(ZIP) 等文件、項(xiàng)目列表單文件快捷下載 (?)
// @description:zh-CN  高速下載 Git Clone/SSH、Release、Raw、Code(ZIP) 等文件、項(xiàng)目列表單文件快捷下載 (?)
// @description:zh-TW  高速下載 Git Clone/SSH、Release、Raw、Code(ZIP) 等文件、項(xiàng)目列表單文件快捷下載 (?)
// @description:en  High-speed download of Git Clone/SSH, Release, Raw, Code(ZIP) and other files, project list file quick download (?)
// @match        *://github.com/*
// @icon         data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAACEUExURUxpcRgWFhsYGBgWFhcWFh8WFhoYGBgWFiUlJRcVFRkWFhgVFRgWFhgVFRsWFhgWFigeHhkWFvr6+h4eHv///xcVFfLx8SMhIUNCQpSTk/r6+jY0NCknJ97e3ru7u+fn51BOTsPCwqGgoISDg6empmpoaK2srNDQ0FhXV3eXcCcAAAAXdFJOUwCBIZXMGP70BuRH2Ze/LpIMUunHkpQR34sfygAAAVpJREFUOMt1U+magjAMDAVb5BDU3W25b9T1/d9vaYpQKDs/rF9nSNJkArDA9ezQZ8wPbc8FE6eAiQUsOO1o19JolFibKCdHGHC0IJezOMD5snx/yE+KOYYr42fPSufSZyazqDoseTPw4lGJNOu6LBXVUPBG3lqYAOv/5ZwnNUfUifzBt8gkgfgINmjxOpgqUA147QWNaocLniqq3QsSVbQHNp45N/BAwoYQz9oUJEiE4GMGfoBSMj5gjeWRIMMqleD/CAzUHFqTLyjOA5zjNnwa4UCEZ2YK3khEcBXHjVBtEFeIZ6+NxYbPqWp1DLKV42t6Ujn2ydyiPi9nX0TTNAkVVZ/gozsl6FbrktkwaVvL2TRK0C8Ca7Hck7f5OBT6FFbLATkL2ugV0tm0RLM9fedDvhWstl8Wp9AFDjFX7yOY/lJrv8AkYuz7fuP8dv9izCYH+x3/LBnj9fYPBTpJDNzX+7cAAAAASUVORK5CYII=
// @grant        GM_registerMenuCommand
// @grant        GM_unregisterMenuCommand
// @grant        GM_openInTab
// @grant        GM_getValue
// @grant        GM_setValue
// @grant        GM_notification
// @grant        window.onurlchange
// @license      GPL-3.0 License
// @run-at       document-end
// @namespace    https://greasyfork.org/scripts/412245
// @supportURL   https://github.com/XIU2/UserScript
// @homepageURL  https://github.com/XIU2/UserScript
// ==/UserScript==

(function() {
    'use strict';
    var backColor = '#ffffff', fontColor = '#888888', menu_raw_fast = GM_getValue('xiu2_menu_raw_fast'), menu_menu_raw_fast_ID, menu_feedBack_ID;
    const download_url_us = [
        ['https://gh.gh2233.ml/https://github.com', '美國(guó)', '[美國(guó) Cloudflare CDN] - 該公益加速源由 [@X.I.U/XIU2] 提供'],
        //['https://gh.api.99988866.xyz/https://github.com', '美國(guó)', '[美國(guó) Cloudflare CDN] - 該公益加速源由 [hunshcn/gh-proxy] 提供'], // 官方演示站用的人太多了
        ['https://gh.ddlc.top/https://github.com', '美國(guó)', '[美國(guó) Cloudflare CDN] - 該公益加速源由 [@mtr-static-official] 提供'], // 2023-01-14
        ['https://gh2.yanqishui.work/https://github.com', '美國(guó)', '[美國(guó) Cloudflare CDN] - 該公益加速源由 [@HongjieCN] 提供'],
        ['https://ghdl.feizhuqwq.cf/https://github.com', '美國(guó)', '[美國(guó) Cloudflare CDN] - 該公益加速源由 [feizhuqwq.com] 提供'],
        ['https://gh-proxy-misakano7545.koyeb.app/https://github.com', '美國(guó)', '[美國(guó) Cloudflare CDN]'],
        ['https://gh.flyinbug.top/gh/https://github.com', '美國(guó)', '[美國(guó) Cloudflare CDN] - 該公益加速源由 [Mintimate] 提供'],
        ['https://github.91chi.fun/https://github.com', '美國(guó)', '[美國(guó) Cloudflare CDN]'],
        ['https://proxy.zyun.vip/https://github.com', '美國(guó)', '[美國(guó) Cloudflare CDN] - 該公益加速源由 [知了小站] 提供'],
        ['https://git.xfj0.cn/https://github.com', '美國(guó)', '[美國(guó) Cloudflare CDN]'],
        ['https://gh.con.sh/https://github.com', '美國(guó)', '[美國(guó) Cloudflare CDN]'],
        ['https://ghps.cc/https://github.com', '美國(guó)', '[美國(guó) Cloudflare CDN]'],
        ['https://cors.isteed.cc/github.com', '美國(guó)', '[美國(guó) Cloudflare CDN] - 該公益加速源由 [Lufs\'s] 提供'],
        ['https://cdn.githubjs.cf', '美國(guó)', '[美國(guó) Cloudflare CDN]'],
        //['https://download.njuu.cf', '美國(guó)', '[美國(guó) 拉斯維加斯] - 該公益加速源由 [LibraryCloud] 提供'],
        ['https://download.yzuu.cf', '美國(guó)', '[美國(guó) Cloudflare CDN] - 該公益加速源由 [LibraryCloud] 提供'],
        ['https://download.nuaa.cf', '美國(guó)', '[美國(guó) Cloudflare CDN] - 該公益加速源由 [LibraryCloud] 提供']
        //['https://download.cithub.icu', '美國(guó)', '[美國(guó) 洛杉磯]', 'https://archive.cithub.icu']
    ], download_url = [
        ['https://download.fastgit.org', '日本', '[日本 東京] - 該公益加速源由 [FastGit] 提供', 'https://archive.fastgit.org'],
        ['https://ghproxy.com/https://github.com', '韓國(guó)', '[韓國(guó) 首爾] - 該公益加速源由 [ghproxy] 提供,有不同地區(qū)的服務(wù)器,不過國(guó)內(nèi)一般分配為韓國(guó)']
    ], clone_url = [
        ['https://gitclone.com', '國(guó)內(nèi)', '[中國(guó) 國(guó)內(nèi)] - 該公益加速源由 [GitClone] 提供

 - 緩存:有
 - 首次比較慢,緩存后較快'],
        ['https://kgithub.com', '新加坡', '[新加坡] - 該公益加速源由 [KGitHub] 提供

 - 緩存:無(或時(shí)間很短)'],
        ['https://github.moeyy.xyz/https://github.com', '新加坡', '[新加坡、香港、日本等](CDN 不固定) - 該公益加速源由 [Moeyy] 提供

 - 緩存:無(或時(shí)間很短)'],
        // ['https://hub.fastgit.xyz', '日本', '[日本 東京] - 該公益加速源由 [FastGit] 提供'],
        ['https://ghproxy.com/https://github.com', '韓國(guó)', '[韓國(guó) 首爾] - 該公益加速源由 [ghproxy] 提供,有不同地區(qū)的服務(wù)器,不過國(guó)內(nèi)一般分配為韓國(guó)'],
        //['https://gh.gcdn.mirr.one', '俄羅斯', '[俄羅斯 G-Core Labs CDN]'],
        //['https://cithub.icu', '美國(guó)', '[美國(guó) 洛杉磯]'],
        ['https://hub.njuu.cf', '美國(guó)', '[美國(guó) 拉斯維加斯] - 該公益加速源由 [LibraryCloud] 提供'],
        ['https://hub.yzuu.cf', '美國(guó)', '[美國(guó) Cloudflare CDN] - 該公益加速源由 [LibraryCloud] 提供']
        //['https://hub.nuaa.cf', '美國(guó)', '[美國(guó) Cloudflare CDN] - 該公益加速源由 [LibraryCloud] 提供']
        //['https://hub.0z.gs', '美國(guó)', '[美國(guó) Cloudflare CDN]'],
        //['https://hub.shutcm.cf', '美國(guó)', '[美國(guó) Cloudflare CDN]']
    ], clone_ssh_url = [
        ['git@ssh.fastgit.org', '香港', '[中國(guó) 香港] - 該公益加速源由 [FastGit] 提供'],
        ['git@git.zhlh6.cn', '美國(guó)', '[美國(guó) 洛杉磯]']
    ], raw_url = [
        ['https://raw.githubusercontent.com', 'Github 原生', '[日本 東京]'],
        ['https://jsd.cdn.zzko.cn/gh', '國(guó)內(nèi) 1', '[中國(guó) 國(guó)內(nèi)] - 該公益加速源由 [ayao] 提供

 - 緩存:有'],
        ['https://js.cdn.haah.net/gh', '國(guó)內(nèi) 2', '[中國(guó) 國(guó)內(nèi)] - 該公益加速源由 [haah] 提供

 - 緩存:有'],
        ['https://raw.iqiq.io', '香港 1', '[中國(guó) 香港] - 該公益加速源由 [iQDNS/iQZone] 提供

 - 緩存:無(或時(shí)間很短)'],
        ['https://raw.kgithub.com', '新加坡 1', '[新加坡] - 該公益加速源由 [KGitHub] 提供

 - 緩存:無(或時(shí)間很短)'],
        //['https://ghproxy.com/https://raw.githubusercontent.com', '韓國(guó)', '[韓國(guó) 首爾] - 該公益加速源由 [ghproxy] 提供

 - 緩存:無(或時(shí)間很短)'],
        ['https://fastly.jsdelivr.net/gh', '日本 1', '[日本 東京] - 該公益加速源由 [JSDelivr CDN] 提供

 - 緩存:有
 - 不支持大小超過 50 MB 的文件
 - 不支持版本號(hào)格式的分支名(如 v1.2.3)'],
        ['https://cdn.staticaly.com/gh', '日本 2', '[日本 東京] - 該公益加速源由 [Statically CDN] 提供

 - 緩存:有
 - 不支持大小超過 30 MB 的文件'],
        ['https://raw.fastgit.org', '日本 3', '[日本 東京] - 該公益加速源由 [FastGit] 提供

 - 緩存:無(或時(shí)間很短)'],
        //['https://ghproxy.net/https://raw.githubusercontent.com', '日本 4', '[日本 大阪]

 - 緩存:無(或時(shí)間很短)'],
        //['https://raw.njuu.cf', '美國(guó)', '[美國(guó) 拉斯維加斯] - 該公益加速源由 [LibraryCloud] 提供

 - 緩存:無(或時(shí)間很短)'],
        //['https://raw.cithub.icu', '美國(guó)', '[美國(guó) 洛杉磯]

 - 緩存:無(或時(shí)間很短)'],
        //['https://git.yumenaka.net/https://raw.githubusercontent.com', '美國(guó)', '[美國(guó) 圣何塞]

 - 緩存:無(或時(shí)間很短)'],
        ['https://gcore.jsdelivr.net/gh', '其他 1', '[移動(dòng)走香港、電信走日本] - 該公益加速源由 [JSDelivr CDN] 提供

 - 緩存:有
 - 不支持大小超過 50 MB 的文件
 - 不支持版本號(hào)格式的分支名(如 v1.2.3)'],
        ['https://raw.githubusercontents.com', '其他 2', '[香港、新加坡、美國(guó)等](CDN 不固定)

 - 緩存:有
 - 該加速源不支持大小超過 1 MB 的文件'],
        ['https://github.moeyy.xyz/https://raw.githubusercontent.com', '其他 3', '[新加坡、香港、日本等](CDN 不固定)

 - 緩存:無(或時(shí)間很短)']
        //['https://raw-gh.gcdn.mirr.one', '俄羅斯', '[俄羅斯 G-Core Labs CDN]

 - 緩存:有']
    ], svg = [
        '<svg class="octicon octicon-file-zip mr-2" aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true"><path fill-rule="evenodd" d="M3.5 1.75a.25.25 0 01.25-.25h3a.75.75 0 000 1.5h.5a.75.75 0 000-1.5h2.086a.25.25 0 01.177.073l2.914 2.914a.25.25 0 01.073.177v8.586a.25.25 0 01-.25.25h-.5a.75.75 0 000 1.5h.5A1.75 1.75 0 0014 13.25V4.664c0-.464-.184-.909-.513-1.237L10.573.513A1.75 1.75 0 009.336 0H3.75A1.75 1.75 0 002 1.75v11.5c0 .649.353 1.214.874 1.515a.75.75 0 10.752-1.298.25.25 0 01-.126-.217V1.75zM8.75 3a.75.75 0 000 1.5h.5a.75.75 0 000-1.5h-.5zM6 5.25a.75.75 0 01.75-.75h.5a.75.75 0 010 1.5h-.5A.75.75 0 016 5.25zm2 1.5A.75.75 0 018.75 6h.5a.75.75 0 010 1.5h-.5A.75.75 0 018 6.75zm-1.25.75a.75.75 0 000 1.5h.5a.75.75 0 000-1.5h-.5zM8 9.75A.75.75 0 018.75 9h.5a.75.75 0 010 1.5h-.5A.75.75 0 018 9.75zm-.75.75a1.75 1.75 0 00-1.75 1.75v3c0 .414.336.75.75.75h2.5a.75.75 0 00.75-.75v-3a1.75 1.75 0 00-1.75-1.75h-.5zM7 12.25a.25.25 0 01.25-.25h.5a.25.25 0 01.25.25v2.25H7v-2.25z"></path></svg>',
        '<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-copy js-clipboard-copy-icon d-inline-block"><path fill-rule="evenodd" d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 010 1.5h-1.5a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-1.5a.75.75 0 011.5 0v1.5A1.75 1.75 0 019.25 16h-7.5A1.75 1.75 0 010 14.25v-7.5z"></path><path fill-rule="evenodd" d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0114.25 11h-7.5A1.75 1.75 0 015 9.25v-7.5zm1.75-.25a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-7.5a.25.25 0 00-.25-.25h-7.5z"></path></svg><svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-check js-clipboard-check-icon color-fg-success d-inline-block d-sm-none"><path fill-rule="evenodd" d="M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z"></path></svg>',
        '<svg class="octicon octicon-cloud-download" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path d="M9 12h2l-3 3-3-3h2V7h2v5zm3-8c0-.44-.91-3-4.5-3C5.08 1 3 2.92 3 5 1.02 5 0 6.52 0 8c0 1.53 1 3 3 3h3V9.7H3C1.38 9.7 1.3 8.28 1.3 8c0-.17.05-1.7 1.7-1.7h1.3V5c0-1.39 1.56-2.7 3.2-2.7 2.55 0 3.13 1.55 3.2 1.8v1.2H12c.81 0 2.7.22 2.7 2.2 0 2.09-2.25 2.2-2.7 2.2h-2V11h2c2.08 0 4-1.16 4-3.5C16 5.06 14.08 4 12 4z"></path></svg>'
    ], style = ['padding:0 6px; margin-right: -1px; border-radius: 2px; background-color: var(--XIU2-back-Color); border-color: rgba(27, 31, 35, 0.1); font-size: 11px; color: var(--XIU2-font-Color);'];

    if (menu_raw_fast == null){menu_raw_fast = 1; GM_setValue('xiu2_menu_raw_fast', 1)};
    registerMenuCommand();
    // 注冊(cè)腳本菜單
    function registerMenuCommand() {
        if (menu_feedBack_ID) { // 如果反饋菜單ID不是 null,則刪除所有腳本菜單
            GM_unregisterMenuCommand(menu_menu_raw_fast_ID);
            GM_unregisterMenuCommand(menu_feedBack_ID);
            menu_raw_fast = GM_getValue('xiu2_menu_raw_fast');
        }
        if (menu_raw_fast > raw_url.length - 1) { // 避免在減少 raw 數(shù)組后,用戶儲(chǔ)存的數(shù)據(jù)大于數(shù)組而報(bào)錯(cuò)
            menu_raw_fast = 0
        }
        menu_menu_raw_fast_ID = GM_registerMenuCommand(`${menu_num(menu_raw_fast)} [ ${raw_url[menu_raw_fast][1]} ] 加速源 (?) - 點(diǎn)擊切換`, menu_toggle_raw_fast);
        menu_feedBack_ID = GM_registerMenuCommand('?? 反饋 & 建議 [Github]', function () {window.GM_openInTab('https://github.com/XIU2/UserScript', {active: true,insert: true,setParent: true});window.GM_openInTab('https://greasyfork.org/zh-CN/scripts/412245/feedback', {active: true,insert: true,setParent: true});});
    }

    // 切換加速源
    function menu_toggle_raw_fast() {
        // 如果當(dāng)前加速源位置大于等于加速源總數(shù),則改為第一個(gè)加速源,反之遞增下一個(gè)加速源
        if (menu_raw_fast >= raw_url.length - 1) {menu_raw_fast = 0;} else {menu_raw_fast += 1;}
        GM_setValue('xiu2_menu_raw_fast', menu_raw_fast);
        delRawDownLink(); // 刪除舊加速源
        addRawDownLink(); // 添加新加速源
        GM_notification({text: "已切換加速源為:" + raw_url[menu_raw_fast][1], timeout: 3000}); // 提示消息
        registerMenuCommand(); // 重新注冊(cè)腳本菜單
    };

    // 菜單數(shù)字圖標(biāo)
    function menu_num(num) {
        return ['0??','1??','2??','3??','4??','5??','6??','7??','8??','9??','??'][num]
    }

    colorMode(); // 適配白天/夜間主題模式
    if (location.pathname.indexOf('/releases')) addRelease(); // Release 加速
    setTimeout(addDownloadZIP, 2000); // Download ZIP 加速
    setTimeout(addGitClone, 2000); //    Git Clone 加速
    setTimeout(addGitCloneSSH, 2000); // Git Clone SSH 加速
    addRawFile(); //                     Raw 加速
    setTimeout(addRawDownLink, 2000); // Raw 單文件快捷下載(?),延遲 2 秒執(zhí)行,避免被 pjax 刷掉

    // Tampermonkey v4.11 版本添加的 onurlchange 事件 grant,可以監(jiān)控 pjax 等網(wǎng)頁的 URL 變化
    if (window.onurlchange === undefined) addUrlChangeEvent();
    window.addEventListener('urlchange', function() {
        colorMode(); // 適配白天/夜間主題模式
        if (location.pathname.indexOf('/releases')) addRelease(); // Release 加速
        setTimeout(addDownloadZIP, 2000); // Download ZIP 加速
        setTimeout(addGitClone, 2000); //    Git Clone 加速
        setTimeout(addGitCloneSSH, 2000); // Git Clone SSH 加速
        addRawFile(); //                     Raw 加速
        setTimeout(addRawDownLink, 2000); // Raw 單文件快捷下載(?),延遲 2 秒執(zhí)行,避免被 pjax 刷掉
        addRawDownLink_(); // 在瀏覽器返回/前進(jìn)時(shí)重新添加 Raw 下載鏈接(?)鼠標(biāo)事件
    });


    // Github Release 改版為動(dòng)態(tài)加載文件列表,因此需要監(jiān)控網(wǎng)頁元素變化
    const callback = (mutationsList, observer) => {
        if (location.pathname.indexOf('/releases') === -1) return
        for (const mutation of mutationsList) {
            for (const target of mutation.addedNodes) {
                if (target.nodeType !== 1) return
                if (target.tagName === 'DIV' && target.dataset.viewComponent === 'true' && target.classList[0] === 'Box') addRelease();
            }
        }
    };
    const observer = new MutationObserver(callback);
    observer.observe(document, { childList: true, subtree: true });


    // download_url 加速源隨機(jī)
    function get_New_download_url() {
        let a = Math.floor(Math.random()*download_url_us.length), b, c, d, new_download_url=[]
        do {b = Math.floor(Math.random()*download_url_us.length)} // 隨機(jī)第二個(gè)
        while (b == a);
        do {c = Math.floor(Math.random()*download_url_us.length)} // 隨機(jī)第三個(gè)
        while (c == a || c == b);
        do {d = Math.floor(Math.random()*download_url_us.length)} // 隨機(jī)第四個(gè)
        while (d == a || d == b || d == c);
        //return download_url_us.concat(download_url) // 調(diào)試用
        return [download_url_us[a],download_url_us[b],download_url_us[c],download_url_us[d]].concat(download_url)
    }

    // Release
    function addRelease() {
        let html = document.querySelectorAll('.Box-footer'); if (html.length == 0 || location.pathname.indexOf('/releases') == -1) return
        let divDisplay = 'margin-left: -90px;', new_download_url = get_New_download_url();
        if (document.documentElement.clientWidth > 755) {divDisplay = 'margin-top: -3px;margin-left: 8px;display: inherit;';}; // 調(diào)整小屏幕時(shí)的樣式
        for (const current of html) {
            if (current.querySelector('.XIU2-RS')) continue
            current.querySelectorAll('li.Box-row a').forEach(function (_this) {
                let href = _this.href.split(location.host),
                    url = '', _html = `<div class="XIU2-RS" style="${divDisplay}">`;

                for (let i=0;i<new_download_url.length;i++) {
                    if (new_download_url[i][3] !== undefined && url.indexOf('/archive/') !== -1) {
                        url = new_download_url[i][3] + href[1]
                    } else {
                        url = new_download_url[i][0] + href[1]
                    }
                    if (location.host !== 'github.com') url = url.replace(location.host,'github.com')
                    _html += `<a style="${style[0]}" class="btn" href="${url}" title="${new_download_url[i][2]}" rel="noreferrer noopener nofollow">${new_download_url[i][1]}</a>`
                }
                _this.parentElement.nextElementSibling.insertAdjacentHTML('beforeend', _html + '</div>');
            });
        }
    }


    // Download ZIP
    function addDownloadZIP() {
        if (document.querySelector('.XIU2-DZ')) return
        let html = document.querySelector('.dropdown-menu.dropdown-menu-sw.p-0 ul li:last-child');if (!html) return
        let href = html.getElementsByTagName('a')[0].href,
            url = '', _html = '', new_download_url = get_New_download_url();
        for (let i=0;i<new_download_url.length;i++) {
            if (new_download_url[i][3] === '') continue

            if (new_download_url[i][3] !== undefined) {
                url = new_download_url[i][3] + href.split(location.host)[1]
            } else {
                url = new_download_url[i][0] + href.split(location.host)[1]
            }
            if (location.host !== 'github.com') url = url.replace(location.host,'github.com')
            _html += `<li class="Box-row Box-row--hover-gray p-3 mt-0 XIU2-DZ"><a class="d-flex flex-items-center color-fg-default text-bold no-underline" rel="noreferrer noopener nofollow" href="${url}" title="${new_download_url[i][2]}">${svg[0]}Download ZIP ${new_download_url[i][1]}</a></li>`
        }
        html.insertAdjacentHTML('afterend', _html);
    }


    // Git Clone
    function addGitClone() {
        if (document.querySelector('.XIU2-GC')) return
        let html = document.querySelector('[role="tabpanel"]:nth-child(2) div.input-group');if (!html) return
        let href_split = html.getElementsByTagName('input')[0].getAttribute('value').split(location.host),
            url = '', _html = '';

        for (let i=0;i<clone_url.length;i++) {
            if (clone_url[i][0] === 'https://gitclone.com') {
                url = clone_url[i][0] + '/github.com' + href_split[1]
            } else {
                url = clone_url[i][0] + href_split[1]
            }
            _html += `<div class="input-group XIU2-GC" style="margin-top: 4px;" title="加速源:${clone_url[i][1]} (點(diǎn)擊可直接復(fù)制)"><input value="${url}" aria-label="${url}" title="${clone_url[i][2]}" type="text" class="form-control input-monospace input-sm color-bg-subtle" data-autoselect="" readonly=""><div class="input-group-button"><clipboard-copy value="${url}" aria-label="Copy to clipboard" class="btn btn-sm js-clipboard-copy tooltipped-no-delay ClipboardButton" tabindex="0" role="button">${svg[1]}</clipboard-copy></div></div>`
        }
        html.insertAdjacentHTML('afterend', _html);
    }


    // Git Clone SSH
    function addGitCloneSSH() {
        if (document.querySelector('.XIU2-GCS')) return
        let html = document.querySelector('[role="tabpanel"]:nth-child(3) div.input-group');if (!html) return
        let href_split = html.getElementsByTagName('input')[0].getAttribute('value').split(':'),
            _html = '';

        if (href_split[0] != 'git@github.com') return

        for (let i=0;i<clone_ssh_url.length;i++) {
            _html += `<div class="input-group XIU2-GCS" style="margin-top: 4px;" title="加速源:${clone_ssh_url[i][1]} (點(diǎn)擊可直接復(fù)制)"><input value="${clone_ssh_url[i][0] + ':' + href_split[1]}" aria-label="${clone_ssh_url[i][0] + ':' + href_split[1]}" title="${clone_ssh_url[i][2]}" type="text" class="form-control input-monospace input-sm color-bg-subtle" data-autoselect="" readonly=""><div class="input-group-button"><clipboard-copy value="${clone_ssh_url[i][0] + ':' + href_split[1]}" aria-label="Copy to clipboard" class="btn btn-sm js-clipboard-copy tooltipped-no-delay ClipboardButton" tabindex="0" role="button">${svg[1]}</clipboard-copy></div></div>`
        }
        html.insertAdjacentHTML('afterend', _html);
    }


    // Raw
    function addRawFile() {
        if (document.querySelector('.XIU2-RF')) return
        let html = document.getElementById('raw-url');if (!html) return
        let href = location.href.replace(`https://${location.host}`,''),
            href2 = href.replace('/blob/','/'),
            url = '', _html = '';

        for (let i=1;i<raw_url.length;i++) {
            if (raw_url[i][0].indexOf('/gh') != -1 && raw_url[i][0].indexOf('cdn.staticaly.com') === -1) {
                url = raw_url[i][0] + href.replace('/blob/','@');
            } else {
                url = raw_url[i][0] + href2;
            }
            _html += `<a href="${url}" title="${raw_url[i][2]}" target="_blank" role="button" rel="noreferrer noopener nofollow" class="btn-sm btn BtnGroup-item XIU2-RF">${raw_url[i][1].replace(/ \d/,'')}</a>`
        }
        html.insertAdjacentHTML('afterend', _html);
    }


    // Raw 單文件快捷下載(?)
    function addRawDownLink() {
        // 如果不是項(xiàng)目文件頁面,就返回,如果網(wǎng)頁有 Raw 下載鏈接(?)就返回
        let files = document.querySelectorAll('div.Box-row svg.octicon.octicon-file');if(files.length === 0) return;if (location.pathname.indexOf('/tags') > -1) return
        let files1 = document.querySelectorAll('a.fileDownLink');if(files1.length > 0) return;

        // 鼠標(biāo)指向則顯示
        var mouseOverHandler = function(evt) {
            let elem = evt.currentTarget,
                aElm_new = elem.querySelectorAll('.fileDownLink'),
                aElm_now = elem.querySelectorAll('svg.octicon.octicon-file');
            aElm_new.forEach(el=>{el.style.cssText = 'display: inline'});
            aElm_now.forEach(el=>{el.style.cssText = 'display: none'});
        };

        // 鼠標(biāo)離開則隱藏
        var mouseOutHandler = function(evt) {
            let elem = evt.currentTarget,
                aElm_new = elem.querySelectorAll('.fileDownLink'),
                aElm_now = elem.querySelectorAll('svg.octicon.octicon-file');
            aElm_new.forEach(el=>{el.style.cssText = 'display: none'});
            aElm_now.forEach(el=>{el.style.cssText = 'display: inline'});
        };

        // 循環(huán)添加
        files.forEach(function(fileElm, i) {
            let trElm = fileElm.parentNode.parentNode,
                cntElm_a = trElm.querySelector('[role="rowheader"] > .css-truncate.css-truncate-target.d-block.width-fit > a'),
                cntElm_svg = trElm.querySelector('.mr-3.flex-shrink-0 svg.octicon.octicon-file'),
                Name = cntElm_a.innerText,
                href = cntElm_a.getAttribute('href'),
                href2 = href.replace('/blob/','/'), url, url_name, url_tip = '';
            if (raw_url[menu_raw_fast][0].indexOf('/gh') != -1 && raw_url[menu_raw_fast][0].indexOf('cdn.staticaly.com') === -1) {
                url = raw_url[menu_raw_fast][0] + href.replace('/blob/','@');
            } else {
                url = raw_url[menu_raw_fast][0] + href2;
            }

            url_name = raw_url[menu_raw_fast][1]; url_tip = raw_url[menu_raw_fast][2];
            cntElm_svg.insertAdjacentHTML('afterend', `<a href="${url}" download="${Name}" target="_blank" rel="noreferrer noopener nofollow" class="fileDownLink" style="display: none;" title="「${url_name}」&#10;&#10;[Alt + 左鍵] 或 [右鍵 - 另存為...] 下載文件。&#10;注意:鼠標(biāo)點(diǎn)擊 [?] 圖標(biāo),而不是左側(cè)的文件名!&#10;&#10;${url_tip}提示:點(diǎn)擊瀏覽器右上角 Tampermonkey 擴(kuò)展圖標(biāo) - [ ${raw_url[menu_raw_fast][1]} ] 加速源 (?) 即可切換。">${svg[2]}</a>`);
            // 綁定鼠標(biāo)事件
            trElm.onmouseover = mouseOverHandler;
            trElm.onmouseout = mouseOutHandler;
        });
    }


    // 移除 Raw 單文件快捷下載(?)
    function delRawDownLink() {
        let aElm = document.querySelectorAll('.fileDownLink');if(aElm.length === 0) return;
        aElm.forEach(function(fileElm) {fileElm.remove();})
    }


    // 在瀏覽器返回/前進(jìn)時(shí)重新添加 Raw 單文件快捷下載(?)鼠標(biāo)事件
    function addRawDownLink_() {
        // 如果不是項(xiàng)目文件頁面,就返回,如果網(wǎng)頁沒有 Raw 下載鏈接(?)就返回
        let files = document.querySelectorAll('div.Box-row svg.octicon.octicon-file');if(files.length === 0) return;
        let files1 = document.querySelectorAll('a.fileDownLink');if(files1.length === 0) return;

        // 鼠標(biāo)指向則顯示
        var mouseOverHandler = function(evt) {
            let elem = evt.currentTarget,
                aElm_new = elem.querySelectorAll('.fileDownLink'),
                aElm_now = elem.querySelectorAll('svg.octicon.octicon-file');
            aElm_new.forEach(el=>{el.style.cssText = 'display: inline'});
            aElm_now.forEach(el=>{el.style.cssText = 'display: none'});
        };

        // 鼠標(biāo)離開則隱藏
        var mouseOutHandler = function(evt) {
            let elem = evt.currentTarget,
                aElm_new = elem.querySelectorAll('.fileDownLink'),
                aElm_now = elem.querySelectorAll('svg.octicon.octicon-file');
            aElm_new.forEach(el=>{el.style.cssText = 'display: none'});
            aElm_now.forEach(el=>{el.style.cssText = 'display: inline'});
        };

        // 循環(huán)添加
        files.forEach(function(fileElm, i) {
            let trElm = fileElm.parentNode.parentNode;
            // 綁定鼠標(biāo)事件
            trElm.onmouseover = mouseOverHandler;
            trElm.onmouseout = mouseOutHandler;
        });
    }


    // 適配白天/夜間主題模式
    function colorMode() {
        let style_Add;
        if (document.getElementById('XIU2-Github')) {style_Add = document.getElementById('XIU2-Github')} else {style_Add = document.createElement('style'); style_Add.id = 'XIU2-Github'; style_Add.type = 'text/css';}
        backColor = '#ffffff'; fontColor = '#888888';

        if (document.getElementsByTagName('html')[0].getAttribute('data-color-mode') === 'dark') { // 如果是夜間模式
            if (document.getElementsByTagName('html')[0].getAttribute('data-dark-theme') === 'dark_dimmed') {
                backColor = '#272e37'; fontColor = '#768390';
            } else {
                backColor = '#161a21'; fontColor = '#97a0aa';
            }
        } else if (document.getElementsByTagName('html')[0].getAttribute('data-color-mode') === 'auto') { // 如果是自動(dòng)模式
            if (window.matchMedia('(prefers-color-scheme: dark)').matches || document.getElementsByTagName('html')[0].getAttribute('data-light-theme').indexOf('dark') > -1) { // 如果瀏覽器是夜間模式 或 白天模式是 dark 的情況
                if (document.getElementsByTagName('html')[0].getAttribute('data-dark-theme') === 'dark_dimmed') {
                    backColor = '#272e37'; fontColor = '#768390';
                } else if (document.getElementsByTagName('html')[0].getAttribute('data-dark-theme').indexOf('light') == -1) { // 排除夜間模式是 light 的情況
                    backColor = '#161a21'; fontColor = '#97a0aa';
                }
            }
        }

        document.lastElementChild.appendChild(style_Add).textContent = `.XIU2-RS a {--XIU2-back-Color: ${backColor}; --XIU2-font-Color: ${fontColor};}`;
    }


    // 自定義 urlchange 事件(用來監(jiān)聽 URL 變化),針對(duì)非 Tampermonkey 油猴管理器
    function addUrlChangeEvent() {
        history.pushState = ( f => function pushState(){
            var ret = f.apply(this, arguments);
            window.dispatchEvent(new Event('pushstate'));
            window.dispatchEvent(new Event('urlchange'));
            return ret;
        })(history.pushState);

        history.replaceState = ( f => function replaceState(){
            var ret = f.apply(this, arguments);
            window.dispatchEvent(new Event('replacestate'));
            window.dispatchEvent(new Event('urlchange'));
            return ret;
        })(history.replaceState);

        window.addEventListener('popstate',()=>{
            window.dispatchEvent(new Event('urlchange'))
        });
    }
})();

使用后 從 幾kb到幾百kb,提升較大。我打3顆星文章來源地址http://www.zghlxwxcb.cn/news/detail-504840.html

到了這里,關(guān)于GITHUB下載慢解決辦法-插件解決的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來自互聯(lián)網(wǎng)用戶投稿,該文觀點(diǎn)僅代表作者本人,不代表本站立場(chǎng)。本站僅提供信息存儲(chǔ)空間服務(wù),不擁有所有權(quán),不承擔(dān)相關(guān)法律責(zé)任。如若轉(zhuǎn)載,請(qǐng)注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實(shí)不符,請(qǐng)點(diǎn)擊違法舉報(bào)進(jìn)行投訴反饋,一經(jīng)查實(shí),立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費(fèi)用

相關(guān)文章

  • github打不開的解決辦法

    github打不開的解決辦法

    最近需要下載項(xiàng)目,但是github是個(gè)神網(wǎng)啊,里面什么都有,并且都開源,就是這個(gè)網(wǎng)址不是太友好,一會(huì)兒慢,一會(huì)兒打不開,找了各種解決辦法,在此記錄一下。 1、通過站長(zhǎng)工具找出DNS地址:進(jìn)入站長(zhǎng)工具網(wǎng)站的域名解析網(wǎng)址:http://tool.chinaz.com/dns/ ,在A類型的查詢中輸入

    2024年02月10日
    瀏覽(23)
  • 【工具】Github統(tǒng)計(jì)代碼行數(shù)工具推薦(VScode插件、兼容任何平臺(tái)、不用下載安裝包)

    【工具】Github統(tǒng)計(jì)代碼行數(shù)工具推薦(VScode插件、兼容任何平臺(tái)、不用下載安裝包)

    需求: 1)被要求統(tǒng)計(jì)代碼行數(shù); 2)不想打開Linux,懶得下載Windows版本GitStats; 3)打開了Linux但也不記得find命令行怎么用; 4)打開了Linux,裝好了Gitstats但自己沒有圖形化界面所以無法打開其輸出結(jié)果; 5)習(xí)慣用VScode編程。 其他工具: 1)Linux愿意使用Gitstats的請(qǐng)直接轉(zhuǎn)到

    2024年02月05日
    瀏覽(34)
  • 解決Github訪問比較慢的辦法

    解決Github訪問比較慢的辦法

    目錄 前言 一、Github出錯(cuò)的原因 二、解決辦法 1.修改hosts文件 ? ? ? ?1.1? 打開文件: ? ? ? ?1.2? 添加ip地址 ? ? ? ?1.3? dns刷新 2.Github鏡像 總結(jié) ? ? ? ? ?無論是在學(xué)習(xí)中還是在以后的工作中,我們都需要通過做一些經(jīng)典的項(xiàng)目來鞏固自己的計(jì)算 機(jī)基礎(chǔ)知識(shí),github是一個(gè)

    2024年02月11日
    瀏覽(19)
  • 解決GitHub不能訪問的幾個(gè)辦法

    GitHub頁面時(shí)而能訪問,時(shí)而不能。不是慢,而是不能訪問。當(dāng)然,下載它的比如倉庫Release下的壓縮包比較慢則是另一回事。蛋疼的影響不限于打不開頁面,更多的在于不能git pull和git push等操作。范圍方面,凡國(guó)內(nèi)不管是家寬、移動(dòng)網(wǎng)絡(luò)還是云上的,都受到一致的影響。 1、

    2024年02月13日
    瀏覽(17)
  • github版面混亂加載不出的解決辦法

    github版面混亂加載不出的解決辦法

    最近出現(xiàn)打開github 界面加載不成功,網(wǎng)頁訪問亂碼,打開chrome的檢查發(fā)現(xiàn) github的github.githubassets.com 拒絕訪問, 解法: 1.先打開hosts文件所在的目錄 C:WindowsSystem32driversetc 2.右鍵點(diǎn)擊hosts文件-選擇用記事本或者Notepad++打開該host文件 3.在該hosts文件新增如下IP信息(直接把如下內(nèi)

    2024年02月13日
    瀏覽(21)
  • GitHub經(jīng)常打不開或者訪問解決辦法

    GitHub經(jīng)常打不開或者訪問解決辦法

    訪問慢或無法訪問的原因:DNS解析是最為基礎(chǔ)的一個(gè)環(huán)節(jié)。由于Github的服務(wù)器在全球各地,域名解析所需的時(shí)間也會(huì)不同,這就導(dǎo)致了在特定地區(qū)可能會(huì)出現(xiàn)Github無法正常訪問的情況。 解決:查詢到github對(duì)應(yīng)的IP,然后在hosts中配置IP和域名的對(duì)應(yīng)關(guān)系,就相當(dāng)于告訴瀏覽器目

    2024年02月05日
    瀏覽(16)
  • 寶塔安裝mongodb插件失敗的解決辦法

    寶塔安裝mongodb插件失敗的解決辦法

    安裝時(shí)始終不成功。 進(jìn)入控制臺(tái)進(jìn)行安裝 /www/server/php/71# pecl install mongodb WARNING: channel \\\"pecl.php.net\\\" has updated its protocols, use \\\"pecl channel-update pecl.php.net\\\" to update pecl/mongodb requires PHP (version = 7.2.0, version = 8.99.99), installed version is 7.1.33 No valid packages found install failed 安裝72版本再安裝?

    2024年02月08日
    瀏覽(17)
  • #解決辦法:Github訪問異常(無法訪問或訪問速度緩慢)

    #解決辦法:Github訪問異常(無法訪問或訪問速度緩慢)

    無法訪問,加載速度緩慢 ? 異常原因: ? 當(dāng)我們?cè)L問GitHub 的網(wǎng)址時(shí),會(huì)向服務(wù)器發(fā)送一個(gè)請(qǐng)求,獲取到 GitHub 網(wǎng)站所在的服務(wù)器 IP 地址,但是這個(gè)國(guó)際的開源代碼平臺(tái)解析出來的IP有的是不能訪問,導(dǎo)致我們?cè)L問不了或者訪問效率比較低。 分析: ? 據(jù)此原因分析,我們可通

    2024年01月23日
    瀏覽(94)
  • IDEA右側(cè)沒有顯示Maven插件解決辦法

    IDEA右側(cè)沒有顯示Maven插件解決辦法

    【前言】 每個(gè)項(xiàng)目的文件結(jié)構(gòu)可能不同,打開項(xiàng)目用打開文件夾的形式時(shí),可能會(huì)出現(xiàn)打開之后右邊沒有maven的情況。 【內(nèi)容】 1、確定項(xiàng)目中是否有pom.xml文件 有可能導(dǎo)入的文件中沒有pom.xml文件,IDEA不能識(shí)別當(dāng)前項(xiàng)目是maven項(xiàng)目,所以沒有maven,要打開當(dāng)前文件夾下有pom.

    2024年02月16日
    瀏覽(21)
  • VScode 安裝中文插件,不生效的解決辦法

    一、問題描述: 安裝中文插件后,中文并沒有如期出現(xiàn) 二、解決: 方法一: 點(diǎn)擊 Uninstall ,重新安裝,再重啟 vscode 如果還不生效的話,可以采用方法二 方法二: 在vscode中,按住 ctr+shift+p ,在出現(xiàn)的輸入框中,輸入 Configure Display Language ,在彈出的語言中,選中zh-cn,軟件彈出提

    2024年02月16日
    瀏覽(19)

覺得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請(qǐng)作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包