Skip to content

Commit 34c61ad

Browse files
committed
feat(userjs): ✨ 下载的文件是user.js用户脚本,直接安装.不进行下载
1 parent b872ce0 commit 34c61ad

2 files changed

Lines changed: 17 additions & 5 deletions

File tree

github-gist-copier/Change history/README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
1-
# **🛠️ GitHub Gist Copier & Downloader 更新日志**
1+
# **🛠️ GitHub Gist 代码片段复制与下载器 更新日志**
2+
3+
### **📅 2025.03.12.0530**
4+
5+
**修复**: 复制按钮的类名改回`octicon octicon-copy`<br>
6+
**新增**: 如果下载的文件是`user.js`用户脚本,直接安装.不进行下载<br>
7+
8+
---
29

310
### **📅 2025.03.12.0022**
411

github-gist-copier/github-gist-copier.user.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@
9999
// @compatible qq
100100
// @compatible via
101101
// @compatible brave
102-
// @version 2025.03.12.0022
102+
// @version 2025.03.16.0530
103103
// @created 2025-03-12 00:22:40
104104
// @modified 2025-03-12 00:22:40
105105
// @downloadURL https://raw.githubusercontent.com/ChinaGodMan/UserScripts/main/github-gist-copier/github-gist-copier.user.js
@@ -111,7 +111,7 @@
111111
* File Created: 2025/03/12,Wednesday 00:22:50
112112
* Author: 人民的勤务员@ChinaGodMan (china.qinwuyuan@gmail.com)
113113
* -----
114-
* Last Modified: 2025/03/12,Wednesday 02:32:41
114+
* Last Modified: 2025/03/16,Sunday 05:32:26
115115
* Modified By: 人民的勤务员@ChinaGodMan (china.qinwuyuan@gmail.com)
116116
* -----
117117
* License: MIT License
@@ -161,7 +161,7 @@
161161
`
162162

163163
button.innerHTML = `
164-
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-down">
164+
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-copy">
165165
<path d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 0 1 0 1.5h-1.5a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-1.5a.75.75 0 0 1 1.5 0v1.5A1.75 1.75 0 0 1 9.25 16h-7.5A1.75 1.75 0 0 1 0 14.25Z"></path><path d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0 1 14.25 11h-7.5A1.75 1.75 0 0 1 5 9.25Zm1.75-.25a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-7.5a.25.25 0 0 0-.25-.25Z"></path>
166166
</svg>
167167
@@ -211,6 +211,12 @@
211211
e.preventDefault()
212212
const gistName = element.parentElement.querySelector('.gist-blob-name').innerText
213213
const rawUrl = rawButton.href
214+
if (gistName.slice(-8) === '.user.js') {
215+
const a = document.createElement('a')
216+
a.href = rawUrl
217+
a.click()
218+
return
219+
}
214220
GM_xmlhttpRequest({
215221
method: 'GET',
216222
url: rawUrl,
@@ -293,5 +299,4 @@
293299

294300
runGist()
295301

296-
297302
})()

0 commit comments

Comments
 (0)