Skip to content

Commit 6f2b367

Browse files
committed
优化 代码
1 parent 537d58d commit 6f2b367

1 file changed

Lines changed: 7 additions & 19 deletions

File tree

GithubEnhanced-High-Speed-Download.user.js

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// ==UserScript==
22
// @name Github 增强 - 高速下载
3-
// @version 1.5.8
3+
// @version 1.5.9
44
// @author X.I.U
55
// @description 高速下载 Git Clone/SSH、Release、Raw、Code(ZIP) 等文件、项目列表单文件快捷下载 (☁)
66
// @match *://github.com/*
@@ -271,8 +271,7 @@
271271
raw_url[1][0] + "/gh" + href.replace('/blob/','@'),
272272
raw_url[2][0] + href2,
273273
raw_url[3][0] + "/gh" + href.replace('/blob/','/'),
274-
raw_url[4][0] + "/" + raw_url[0][0] + href2,
275-
raw_url[5][0] + "/" + raw_url[0][0] + href2
274+
raw_url[4][0] + "/" + raw_url[0][0] + href2
276275
],
277276
_html = ``;
278277
for (let i=0;i<url.length;i++) {
@@ -317,26 +316,15 @@
317316
switch(menu_raw_fast) {
318317
case 0:
319318
case 2:
320-
url = raw_url[menu_raw_fast][0] + href2;
321-
url_name = raw_url[menu_raw_fast][1];
322-
url_tip = raw_url[menu_raw_fast][2];
323-
break;
319+
url = raw_url[menu_raw_fast][0] + href2; break;
324320
case 1:
325-
url = raw_url[menu_raw_fast][0] + '/gh' + href.replace('/blob/','@');
326-
url_name = raw_url[menu_raw_fast][1];
327-
url_tip = raw_url[menu_raw_fast][2];
328-
break;
321+
url = raw_url[menu_raw_fast][0] + '/gh' + href.replace('/blob/','@'); break;
329322
case 3:
330-
url = raw_url[menu_raw_fast][0] + '/gh' + href.replace('/blob/','/');
331-
url_name = raw_url[menu_raw_fast][1];
332-
url_tip = raw_url[menu_raw_fast][2];
333-
break;
334-
case 4:
323+
url = raw_url[menu_raw_fast][0] + '/gh' + href.replace('/blob/','/'); break;
324+
default:
335325
url = raw_url[menu_raw_fast][0] + "/" + raw_url[0][0] + href2;
336-
url_name = raw_url[menu_raw_fast][1];
337-
url_tip = raw_url[menu_raw_fast][2];
338-
break;
339326
}
327+
url_name = raw_url[menu_raw_fast][1]; url_tip = raw_url[menu_raw_fast][2];
340328
let _html = ` <a href="${url}" download="${Name}" target="_blank" rel="noreferrer noopener nofollow" class="fileDownLink" style="display: none;" title="「${url_name}」&#10;&#10;[Alt + 左键] 或 [右键 - 另存为...] 下载文件。&#10;注意:鼠标点击 [☁] 图标,而不是左侧的文件名!&#10;&#10;${url_tip}提示:点击浏览器右上角 Tampermonkey 扩展图标 - [ ${raw_url[menu_raw_fast][1]} ] 加速源 (☁) 即可切换。">${svg[2]}</a>`;
341329
cntElm_svg.insertAdjacentHTML('afterend', _html);
342330
// 绑定鼠标事件

0 commit comments

Comments
 (0)