From 6c58e83b8ee3f6bbcde55470aea5b5f9a697e37d Mon Sep 17 00:00:00 2001 From: xiu2 <54703944+XIU2@users.noreply.github.com> Date: Sat, 24 Oct 2020 21:40:13 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=20Raw=20=E5=BF=AB=E6=8D=B7?= =?UTF-8?q?=E4=B8=8B=E8=BD=BD(=E2=98=81)=E6=8C=89=E9=92=AE=E4=BD=8D?= =?UTF-8?q?=E7=BD=AE=EF=BC=88=E8=A7=A3=E5=86=B3=E6=96=87=E4=BB=B6=E5=90=8D?= =?UTF-8?q?=E8=BF=87=E9=95=BF=E5=AF=BC=E8=87=B4=E6=8C=89=E9=92=AE=E4=B8=8D?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E7=9A=84=E9=97=AE=E9=A2=98=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GithubEnhanced-High-Speed-Download.user.js | 27 +++++++++++++--------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/GithubEnhanced-High-Speed-Download.user.js b/GithubEnhanced-High-Speed-Download.user.js index 7db438a..04711dd 100644 --- a/GithubEnhanced-High-Speed-Download.user.js +++ b/GithubEnhanced-High-Speed-Download.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name Github 增强 - 高速下载 -// @version 1.1.7 +// @version 1.1.8 // @author X.I.U // @description 为 Github 的 Clone、Release、Raw、Code(ZIP) 添加高速下载 // @match https://github.com/*/* @@ -210,24 +210,29 @@ // 鼠标指向则显示 var mouseOverHandler = function(evt){ - var elem = evt.currentTarget, - aElm = elem.querySelectorAll('.fileDownLink'); - aElm.forEach(el=>el.style.visibility = 'visible'); + var elem = evt.currentTarget, + aElm_new = elem.querySelectorAll('.fileDownLink'), + aElm_now = elem.querySelectorAll('svg.octicon.octicon-file.text-gray-light'); + aElm_new.forEach(el=>el.style.cssText = 'display: inline'); + aElm_now.forEach(el=>el.style.cssText = 'display: none'); }; // 鼠标离开则隐藏 var mouseOutHandler = function(evt){ var elem = evt.currentTarget, - aElm = elem.querySelectorAll('.fileDownLink'); - aElm.forEach(el=>el.style.visibility = 'hidden'); + aElm_new = elem.querySelectorAll('.fileDownLink'), + aElm_now = elem.querySelectorAll('svg.octicon.octicon-file.text-gray-light'); + aElm_new.forEach(el=>el.style.cssText = 'display: none'); + aElm_now.forEach(el=>el.style.cssText = 'display: inline'); }; // 循环添加 files.each(function(i,fileElm){ var trElm = fileElm.parentNode.parentNode, - cntElm = trElm.querySelector('.css-truncate.css-truncate-target.d-block.width-fit a'), - Name = cntElm.innerText, - href = cntElm.attributes['href'].nodeValue.replace('https://github.com',''); + cntElm_a = trElm.querySelector('.css-truncate.css-truncate-target.d-block.width-fit a'), + cntElm_svg = trElm.querySelector('.mr-3.flex-shrink-0 svg.octicon.octicon-file.text-gray-light'), + Name = cntElm_a.innerText, + href = cntElm_a.attributes['href'].nodeValue.replace('https://github.com',''); var href2 = href.replace('/blob/','/'), url, url_name, url_tip = ""; switch(menu_raw_fast) { @@ -250,8 +255,8 @@ url_name = download_url5_name; break; } - var html1 = ` `; - $(cntElm).after(html1); + var html1 = ` `; + $(cntElm_svg).after(html1); // 绑定鼠标事件 trElm.onmouseover=mouseOverHandler; trElm.onmouseout=mouseOutHandler;