-
-
Notifications
You must be signed in to change notification settings - Fork 41
/
Copy pathgithub-folder-downloader.user.js
218 lines (218 loc) · 22.9 KB
/
github-folder-downloader.user.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
// ==UserScript==
// @name GitHub Folder Downloader
// @name:zh-CN GitHub 文件夹下载器
// @description:zh-CN 添加一个下载按钮,允许轻松下载特定的 GitHub 文件夹。
// @name:ar GitHub تنزيل المجلد
// @description:ar أضف زر التنزيل,يتيح سهولة تنزيل ملفات محددة GitHub المجلد。
// @name:bg GitHub програма за изтегляне на папки
// @description:bg Добавете бутон за изтегляне,Позволява лесно изтегляне на конкретни GitHub папка。
// @name:cs GitHub stahovač složek
// @description:cs Přidejte tlačítko stahování,Umožňuje snadné stahování konkrétních GitHub složku。
// @name:da GitHub mappe downloader
// @description:da Tilføj en downloadknap,Tillader nem download af specifikke GitHub folder。
// @name:de GitHub Ordner-Downloader
// @description:de Fügen Sie einen Download-Button hinzu,Ermöglicht das einfache Herunterladen spezifischer GitHub Ordner。
// @name:el GitHub πρόγραμμα λήψης φακέλων
// @description:el Προσθέστε ένα κουμπί λήψης,Επιτρέπει την εύκολη λήψη συγκεκριμένων GitHub ντοσιέ。
// @name:en GitHub folder downloader
// @description:en Add a download button,Allows easy downloading of specific GitHub folder。
// @name:eo GitHub dosierujo elŝutilo
// @description:eo Aldonu elŝutan butonon,Ebligas facilan elŝuton de specifaj GitHub dosierujo。
// @name:es GitHub descargador de carpetas
// @description:es Agregar un botón de descarga,Permite descargar fácilmente archivos específicos GitHub carpeta。
// @name:fi GitHub kansion latausohjelma
// @description:fi Lisää latauspainike,Mahdollistaa helpon lataamisen tiettyjä GitHub kansio。
// @name:fr GitHub téléchargeur de dossiers
// @description:fr Ajouter un bouton de téléchargement,Permet de télécharger facilement des fichiers spécifiques GitHub dossier。
// @name:he GitHub הורדת תיקיות
// @description:he הוסף כפתור הורדה,מאפשר הורדה קלה של ספציפיים GitHub תיקייה。
// @name:hr GitHub preuzimač mapa
// @description:hr Dodajte gumb za preuzimanje,Omogućuje jednostavno preuzimanje određenih GitHub mapa。
// @name:hu GitHub mappa letöltő
// @description:hu Letöltés gomb hozzáadása,Lehetővé teszi a konkrét GitHub mappát。
// @name:id GitHub pengunduh folder
// @description:id Tambahkan tombol unduh,Memungkinkan pengunduhan yang spesifik dengan mudah GitHub map。
// @name:it GitHub downloader di cartelle
// @description:it Aggiungi un pulsante di download,Consente un facile download di specifici GitHub cartella。
// @name:ja GitHub フォルダーダウンローダー
// @description:ja ダウンロードボタンを追加する,特定のファイルを簡単にダウンロードできます GitHub フォルダ。
// @name:ka GitHub საქაღალდის ჩამოტვირთვა
// @description:ka დაამატეთ ჩამოტვირთვის ღილაკი,საშუალებას გაძლევთ მარტივად ჩამოტვირთოთ კონკრეტული GitHub საქაღალდე。
// @name:ko GitHub 폴더 다운로더
// @description:ko 다운로드 버튼 추가,특정 파일을 쉽게 다운로드할 수 있습니다. GitHub 접는 사람。
// @name:nl GitHub mapdownloader
// @description:nl Voeg een downloadknop toe,Maakt eenvoudig downloaden van specifieke GitHub map。
// @name:nb GitHub mappenedlasting
// @description:nb Legg til en nedlastingsknapp,Tillater enkel nedlasting av spesifikke GitHub mappe。
// @name:pl GitHub narzędzie do pobierania folderów
// @description:pl Dodaj przycisk pobierania,Umożliwia łatwe pobieranie określonych GitHub falcówka。
// @name:pt-BR GitHub downloader de pasta
// @description:pt-BR Adicione um botão de download,Permite fácil download de arquivos específicos GitHub pasta。
// @name:ro GitHub folder downloader
// @description:ro Adăugați un buton de descărcare,Permite descărcarea ușoară a anumitor GitHub pliant。
// @name:ru GitHub загрузчик папок
// @description:ru Добавьте кнопку загрузки,Позволяет легко загружать определенные GitHub папка。
// @name:sk GitHub sťahovač priečinkov
// @description:sk Pridajte tlačidlo sťahovania,Umožňuje jednoduché sťahovanie konkrétnych GitHub priečinok。
// @name:sr GitHub фолдер за преузимање
// @description:sr Додајте дугме за преузимање,Омогућава лако преузимање одређених GitHub фолдер。
// @name:sv GitHub mappnedladdare
// @description:sv Lägg till en nedladdningsknapp,Tillåter enkel nedladdning av specifika GitHub mapp。
// @name:th GitHub ดาวน์โหลดโฟลเดอร์
// @description:th เพิ่มปุ่มดาวน์โหลด,ช่วยให้ดาวน์โหลดเฉพาะได้ง่าย GitHub โฟลเดอร์。
// @name:tr GitHub klasör indirici
// @description:tr İndirme düğmesi ekleyin,Belirli dosyaların kolayca indirilmesine izin verir GitHub dosya。
// @name:ug GitHub ھۆججەت قىسقۇچ
// @description:ug چۈشۈرۈش كۇنۇپكىسىنى قوشۇڭ,كونكرېت چۈشۈرۈشكە ئاسان يول قويىدۇ GitHub ھۆججەت قىسقۇچ。
// @name:uk GitHub завантажувач папок
// @description:uk Додайте кнопку завантаження,Дозволяє легко завантажувати певні GitHub папку。
// @name:vi GitHub trình tải xuống thư mục
// @description:vi Thêm nút tải xuống,Cho phép dễ dàng tải xuống cụ thể GitHub thư mục。
// @name:zh-TW GitHub 資料夾下載器
// @description:zh-TW 新增一個下載按鈕,允許輕鬆下載特定的 GitHub 資料夾。
// @name:zh-HK GitHub 資料夾下載器
// @description:zh-HK 新增一個下載按鈕,允許輕鬆下載特定的 GitHub 資料夾。
// @name:fr-CA GitHub téléchargeur de dossiers
// @description:fr-CA Ajouter un bouton de téléchargement,Permet de télécharger facilement des fichiers spécifiques GitHub dossier。
// @description To add a download button for a GitHub folder, which allows easy downloading of a specific folder, you can follow these steps
// @namespace https://github.com/ChinaGodMan/UserScripts
// @version 0.7.0.23
// @author EricKwok,人民的勤务员 <[email protected]>
// @supportURL https://github.com/ChinaGodMan/UserScripts/issues
// @homepageURL https://github.com/ChinaGodMan/UserScripts
// @match *://github.com/*
// @icon data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAYAAADimHc4AAAACXBIWXMAAAsTAAALEwEAmpwYAAAc6klEQVR4nO2deXBb13XGaTedTDxNp532j04z0yaTTpvpdGrLsjZLXAGCIPbtYd93ggRAkAC4kyK1y/JuybG1WJQsyZZsSd4X2dp3iqJkWd7kLXWdrWmcNMk0jWOfzrnAA+4FHkCIpCq55pv5hos4JPX9Ptx337nnXlZVzV6z1+w1e81es9fk100md2DU5An+3uQOfMK5fC/q7J40Z/P889fVvPom1T9VS9XtNc3a/TUy1UfVzerf18jUD6NXM/7DDA4fZ/GFweINEZk9QSKTJwicO/CWzukdUdr936v6f34tkun+vk6h66uTaS7VybVQK9dkJFMT1TSrobZZo5jxH8y5Ant58wsBoIzuABjd/i/0Du9xtdVtuiYpuI5XrVxfVyfX7qtX6D5H43kJAaiRqrbN6A+XSqPftHhC/1Xe/Iw4l59I7/B9oLM7W4aGhr5R9RW9amtrv1Ev1wcaFLr3G5Q6qFdkVMp8CsAv586d+6cz9ovoHD4TnX5bIAKRzj5whmMMAN58zunLSW/3fKK1OhPBYHDmfqFrfg3dXK/QWUVKPTFeyPyMNNCst4DBGYIGpSFjfrMaqqUquFMql83Yr2N0+7fR6Q/G0tC3bB1R19LV0NrZC7ZAaxEAQ1Z6hxc0dvcHSpNDV3WDXw1qtQaNF6n0gBICINEawegOgz/WBeFEH5HK6mYALG5SbZixX8rkCX5IA2jvGc4B6B25i6hn5C7yeU8kkYNAA0Dp7B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iXEhaJmpuhGm58F8O9zqhtC13S8r/TCv2LXpDGubtKZflNJyRk/j0/VOrsPTO4WsPqiBI4nnABfWxK8rUliLELJmN81ufn4MQ+gwPxMohOkaw3HfjxcFdOtsnhAqrOS+8VCsbzoqVcQQE3jr26vEQ+VXNW6ntd8qfTPJVpjVKI1vnsjHKyxuMJ5f6myA2N+jfjK3FpJ9621tZOf/Xn9r6Gbm1ScvFHDbWnUcD+5VsfK1FQw9SwsOZd78Cosut1RJ/n0jnrJD+fWSBq/yn+i/aZGnXGxWKVfKVZzr4pVhl/cqOmfVy/5+by6phfm1TctnVstmf9VNr3sVa/RfF+s1BvrFbpUg1K3vk6he6ZeoRurV2g/qJNpf1Sv0H1WJ9P8bqbSv0gs++1CseyzRWLZR4tEzVcWiJvPzK9v3ju/Xnrf/HppYoFYpltQ2/Td6+3L7DV7zV6z1+xV9bW6/hcSd2EeG4WLWAAAAABJRU5ErkJggg==
// @iconbak https://i.loli.net/2021/03/30/ULV9XunaHesqGIR.png
// @run-at document-idle
// @grant none
// @license MIT
// ==/UserScript==
// 记录页面宽度是否允许 GitHub 展开完整页面的变量
var isFold = false
var isRun = false
function observeAndAddLinks() {
const parentElement = document.querySelector('#__primerPortalRoot__')
if (!parentElement) return
const observer = new MutationObserver((mutationsList) => {
for (const mutation of mutationsList) {
if (mutation.addedNodes.length > 0) {
for (const node of mutation.addedNodes) {
const ulElement = parentElement.querySelector('ul[role="menu"]')
if (document.querySelector('.github-folder-download')) return
console.log(node)
if (ulElement) {
const _html = `
<li class="github-folder-download">
<p style="padding:0px 8px 2px 10px; color:grey; margin:0; font-size:10px;">Download folder with..</p>
</li>
<a class="dropdown-item" target="_blank" href="https://download-directory.github.io?url=${window.location.href}">
download-directory
</a>
<a class="dropdown-item" target="_blank" href="https://downgit.github.io/#/home?url=${window.location.href}">
DownGit
</a>
<li class="d-block d-md-none dropdown-divider github-folder-download" role="none"></li>`
ulElement.insertAdjacentHTML('beforeend', _html)
}
return
}
}
}
})
const config = { childList: true, subtree: true }
if (!isRun) {
isRun = true
observer.observe(parentElement, config)
}
return true
}
observeAndAddLinks()
// 注入下载文件夹按钮
function injectDownloadFolderBtn() {
if (document.querySelector('.github-folder-download')) return
if (!isFold) {
// 展开状态(PC端)
let html = document.querySelector('[data-testid="tree-overflow-menu-anchor"]')//.types__StyledButton-sc-ws60qy-0.feqCqy
let _html = `
<details data-view-component="true" class="details-overlay details-reset position-relative mr-2 github-folder-download">
<summary role="button" data-view-component="true">
<span class="btn d-none d-md-flex flex-items-center">
Download folder
<span class="dropdown-caret ml-1"></span>
</span>
<span class="btn d-inline-block d-md-none">
<svg aria-label="More options" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-kebab-horizontal">
<path d="M8 9a1.5 1.5 0 100-3 1.5 1.5 0 000 3zM1.5 9a1.5 1.5 0 100-3 1.5 1.5 0 000 3zm13 0a1.5 1.5 0 100-3 1.5 1.5 0 000 3z"></path>
</svg>
</span>
</summary>
<div class="dropdown-menu dropdown-menu-sw" style="top:32px;width:220px;">
<ul class="list-style-none">
<li class="Box-row Box-row--hover-gray p-3 mt-0">
<a class="d-flex flex-items-center color-text-primary text-bold no-underline" rel="noopener" target="_blank" href="https://download-directory.github.io?url=${window.location.href}">
With download - directory
</a >
</li >
<li class="Box-row Box-row--hover-gray p-3 mt-0">
<a class="d-flex flex-items-center color-text-primary text-bold no-underline" rel="noopener" target="_blank" href="https://downgit.github.io/#/home?url=${window.location.href}">
With DownGit
</a>
</li>
</ul >
</div >
</detials>`
html.insertAdjacentHTML('beforebegin', _html)
} else {
observeAndAddLinks()
}
}
function removeAllInjectedElem() {
document.querySelectorAll('.github-folder-download').forEach(elem => elem.remove())
}
function detectFoldUnfold() {
if (document.body.clientWidth <= 1200 && !isFold) {
console.log('收起' + document.body.clientWidth)
isFold = true
} else if (document.body.clientWidth > 1200 && isFold) {
console.log('展开' + document.body.clientWidth)
isFold = false
}
}
function reinject() {
if (document.querySelector('.octicon.octicon-copy')) {//复制路径的元素
// 仅当处于文件夹内时注入按钮
removeAllInjectedElem()
injectDownloadFolderBtn()
}
}
function main() {
detectFoldUnfold()
reinject()
}
(function () {
'use strict'
/**
* 在浏览器窗口大小改变时自动重新定位设置菜单
*/
window.onresize = function () {
// 监听窗口大小改变
main()
}
function observeUrlChanges(callback, delay = 1000) {
let lastUrl = location.href
const observer = new MutationObserver(() => {
const url = location.href
if (url !== lastUrl) {
lastUrl = url
setTimeout(() => {
console.log('页面发生变动,')
callback()
}, delay)
}
})
observer.observe(document, { subtree: true, childList: true })
return observer
}
observeUrlChanges(main)
main()
})()