🏠 Home 

Åbn JSdelivr -link på GitHub

Åbn Github -linket på JSdelivr for hurtigt at downloade filer

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