Åbn Github -linket på JSdelivr for hurtigt at downloade filer
- // ==UserScript==
- // @name Open jsDelivr link on Github
- // @name:ar افتح رابط JSDelivr على Github
- // @name:bg Отворете JSDELIVR връзка на GitHub
- // @name:cs Otevřete odkaz JSDelivr na GitHubu
- // @name:da Åbn JSdelivr -link på GitHub
- // @name:de Öffnen Sie den JSDelivr -Link auf GitHub
- // @name:el Ανοίξτε τον σύνδεσμο JSDELIVR στο GitHub
- // @name:en Open jsDelivr link on Github
- // @name:eo Malfermu JSDelivr -ligon sur github
- // @name:es Abra el enlace JSDelivr en Github
- // @name:fi Avaa JSDELIVR -linkki GitHubissa
- // @name:fr Ouvrir le lien jsdelivr sur github
- // @name:fr-CA Ouvrir le lien jsdelivr sur github
- // @name:he פתח את קישור JSDELIVR ב- GitHub
- // @name:hr Otvorite JSDELIVR LINK na GitHub
- // @name:hu Nyissa meg a JSdelivr linket a GitHub -on
- // @name:id Buka tautan JSDELIVR di GitHub
- // @name:it Apri il collegamento JSDelivr su GitHub
- // @name:ja GithubでJSDelivrリンクを開きます
- // @name:ka გახსენით JSDelivr ბმული Github- ზე
- // @name:ko GitHub에서 JSDELIVR 링크를 엽니 다
- // @name:nb Åpne JSDelivr -lenke på GitHub
- // @name:nl Open JSDelivr -link op GitHub
- // @name:pl Otwórz link jsdelivr na github
- // @name:pt-BR Abra o link JSDelivr no GitHub
- // @name:ro Deschideți link JSDelivr pe Github
- // @name:ru Откройте ссылку JSDelivr на GitHub
- // @name:sk Otvorte odkaz JSDELIVR na GitHub
- // @name:sr Отворите Линк ЈСДеливр на ГитХуб-у
- // @name:sv Öppna JSDelivr -länken på GitHub
- // @name:th เปิดลิงก์ JSDELIVR บน GitHub
- // @name:tr Github’da JSDELIVR bağlantısını açın
- // @name:ug GitHub دىكى JSDELIVR ئۇلىنىشى
- // @name:uk Відкрийте посилання jsdelivr на github
- // @name:vi Mở liên kết JSDELIVR trên GitHub
- // @name:zh 在Github上打开jsDelivr链接
- // @name:zh-CN 在Github上打开jsDelivr链接
- // @name:zh-HK 在Github上打開jsDelivr鏈接
- // @name:zh-SG 在Github上打开jsDelivr链接
- // @name:zh-TW 在Github上打開jsDelivr鏈接
- // @description Open the GitHub link on jsDelivr to quickly download files
- // @description:ar افتح رابط Github على JSDelivr لتنزيل الملفات بسرعة
- // @description:bg Отворете връзката на GitHub на JSDelivr, за да изтеглите бързо файлове
- // @description:cs Otevřete odkaz GitHub na JSDelivr a rychle si stáhněte soubory
- // @description:da Åbn Github -linket på JSdelivr for hurtigt at downloade filer
- // @description:de Öffnen Sie den GitHub -Link auf JSDelivr, um Dateien schnell herunterzuladen
- // @description:el Ανοίξτε το σύνδεσμο GitHub στο JSDELIVR για να κατεβάσετε γρήγορα αρχεία
- // @description:en Open the GitHub link on jsDelivr to quickly download files
- // @description:eo Malfermu la ligon GitHub ĉe JSDelivR por rapide elŝuti dosierojn
- // @description:es Abra el enlace GitHub en JSDELIVR para descargar rápidamente archivos
- // @description:fi Avaa GitHub -linkki JSDELIVR: llä ladataksesi tiedostot nopeasti
- // @description:fr Ouvrez le lien GitHub sur JSdelivr pour télécharger rapidement des fichiers
- // @description:fr-CA Ouvrez le lien GitHub sur JSdelivr pour télécharger rapidement des fichiers
- // @description:he פתח את קישור GitHub ב- JSDelivr כדי להוריד במהירות קבצים
- // @description:hr Otvorite GitHub vezu na jsdelivr da biste brzo preuzeli datoteke
- // @description:hu Nyissa meg a GitHub linket a JSdelivr -en a fájlok gyors letöltéséhez
- // @description:id Buka tautan github di jsdelivr untuk mengunduh file dengan cepat
- // @description:it Apri il link GitHub su JSDELIVR per scaricare rapidamente i file
- // @description:ja jsdelivrでgithubリンクを開き、すばやくファイルをダウンロードします
- // @description:ka გახსენით Github ბმული JSDelivr– ზე, რომ სწრაფად ჩამოტვირთოთ ფაილები
- // @description:ko jsdelivr에서 github 링크를 열려면 파일을 신속하게 다운로드하십시오.
- // @description:nb Åpne GitHub -lenken på JSDelivr for raskt å laste ned filer
- // @description:nl Open de GitHub -link op JSDelivr om snel bestanden te downloaden
- // @description:pl Otwórz link Github na JSDElivr, aby szybko pobrać pliki
- // @description:pt-BR Abra o link do github no JSDelivr para baixar rapidamente arquivos
- // @description:ro Deschideți linkul GitHub pe JSDelivr pentru a descărca rapid fișierele
- // @description:ru Откройте ссылку GitHub на JSDelivr, чтобы быстро загрузить файлы
- // @description:sk Otvorte odkaz GitHub na JSDELIVR na rýchle sťahovanie súborov
- // @description:sr Отворите ГитХуб линк на ЈСДЕЛИВР-у да бисте брзо преузели датотеке
- // @description:sv Öppna Github -länken på JSDelivr för att snabbt ladda ner filer
- // @description:th เปิดลิงค์ GitHub บน JSDELIVR เพื่อดาวน์โหลดไฟล์อย่างรวดเร็ว
- // @description:tr Dosyaları hızlı bir şekilde indirmek için JSDelivr üzerindeki GitHub bağlantısını açın
- // @description:ug Jsdelivr دىكى GitHub ئۇلىنىشىنى ئېچىڭ
- // @description:uk Відкрийте посилання Github на jsdelivr, щоб швидко завантажити файли
- // @description:vi Mở liên kết GitHub trên JSDELIVR để nhanh chóng tải xuống các tệp
- // @description:zh 打开jsDelivr上的GitHub链接,用于快速下载文件
- // @description:zh-CN 打开jsDelivr上的GitHub链接,用于快速下载文件
- // @description:zh-HK 打開jsDelivr上的GitHub鏈接,用於快速下載文件
- // @description:zh-SG 打开jsDelivr上的GitHub链接,用于快速下载文件
- // @description:zh-TW 打開jsDelivr上的GitHub鏈接,用於快速下載文件
- // @author hungtcs,人民的勤务员 <china.qinwuyuan@gmail.com>
- // @namespace https://github.com/#####GodMan/UserScripts
- // @supportURL https://github.com/#####GodMan/UserScripts/issues
- // @homepageURL https://github.com/#####GodMan/UserScripts
- // @license MIT
- // @match https://github.com/**/*
- // @icon https://camo.githubusercontent.com/6a5d2046028682a99b5fa88ef0f3399c9bced1d514179686a3973a323b###f44/68747470733a2f2f7777772e6a7364656c6976722e636f6d2f69636f6e5f323536783235362e706e67
- // @compatible firefox
- // @compatible edge
- // @compatible opera
- // @compatible safari
- // @version 2025.02.24.06.00
- // @Created 2025-02-24 06:00:00
- // @modified 2025-02-24 06:00:00
- // ==/UserScript==
- (function () {
- 'use strict'
- const iconUrl = 'https://camo.githubusercontent.com/6a5d2046028682a99b5fa88ef0f3399c9bced1d514179686a3973a323b###f44/68747470733a2f2f7777772e6a7364656c6976722e636f6d2f69636f6e5f323536783235362e706e67'
- function run() {
- const copyPathButton = document.querySelector('[aria-label="Copy path"]')
- if (!copyPathButton) {
- return
- }
- const url = new URL(window.location.href)
- const { pathname } = url
- const isFile = pathname.includes('/blob/')
- const isFolder = pathname.includes('/tree/')
- let link
- if (isFolder) {
- const index = pathname.indexOf('/tree/')
- const author = pathname.slice(1, index)
- let rest = pathname.slice(index + 6)
- const version = rest.slice(0, rest.indexOf('/'))
- const filepath = rest.slice(rest.indexOf('/'))
- link = `https://cdn.jsdelivr.net/gh/${author}@${version}${filepath}/`
- } else if (isFile) {
- const index = pathname.indexOf('/blob/')
- const author = pathname.slice(1, index)
- let rest = pathname.slice(index + 6)
- const version = rest.slice(0, rest.indexOf('/'))
- const filepath = rest.slice(rest.indexOf('/'))
- link = `https://cdn.jsdelivr.net/gh/${author}@${version}${filepath}`
- } else {
- return
- }
- let actionButton = document.querySelector('button[aria-label="Open JsDelivr Link"]')
- if (!actionButton) {
- const copyPathButtonWrapper = copyPathButton.parentElement
- const container = copyPathButtonWrapper.parentElement
- const actionNode = copyPathButtonWrapper.cloneNode(true)
- actionButton = actionNode.querySelector('button')
- actionButton.setAttribute('title', 'Open JsDelivr Link')
- actionButton.setAttribute('aria-label', 'Open JsDelivr Link')
- actionButton.innerHTML = `<img src=${iconUrl} style="height: 16px;" />`
- container.appendChild(actionNode)
- Array.from(actionNode.children).forEach(child => child.getAttribute('title') !== 'Open JsDelivr Link' && actionNode.removeChild(child))
- }
- actionButton.onclick = () => {
- window.open(link)
- }
- }
- setInterval((event) => {
- run()
- }, 1000)
- })()