()
| 427 | |
| 428 | // 在浏览器返回/前进时重新添加 Raw 单文件快捷下载(☁)鼠标事件 |
| 429 | function addRawDownLink_() { |
| 430 | if (!GM_getValue('menu_rawDownLink')) return |
| 431 | // 如果不是项目文件页面,就返回,如果网页没有 Raw 下载链接(☁)就返回 |
| 432 | let files = document.querySelectorAll('div.Box-row svg.octicon.octicon-file, .react-directory-filename-column>svg.color-fg-muted');if(files.length === 0) return; |
| 433 | let files1 = document.querySelectorAll('a.fileDownLink');if(files1.length === 0) return; |
| 434 | |
| 435 | // 鼠标指向则显示 |
| 436 | var mouseOverHandler = function(evt) { |
| 437 | let elem = evt.currentTarget, |
| 438 | aElm_new = elem.querySelectorAll('.fileDownLink'), |
| 439 | aElm_now = elem.querySelectorAll('svg.octicon.octicon-file, svg.color-fg-muted'); |
| 440 | aElm_new.forEach(el=>{el.style.cssText = 'display: inline'}); |
| 441 | aElm_now.forEach(el=>{el.style.cssText = 'display: none'}); |
| 442 | }; |
| 443 | |
| 444 | // 鼠标离开则隐藏 |
| 445 | var mouseOutHandler = function(evt) { |
| 446 | let elem = evt.currentTarget, |
| 447 | aElm_new = elem.querySelectorAll('.fileDownLink'), |
| 448 | aElm_now = elem.querySelectorAll('svg.octicon.octicon-file, svg.color-fg-muted'); |
| 449 | aElm_new.forEach(el=>{el.style.cssText = 'display: none'}); |
| 450 | aElm_now.forEach(el=>{el.style.cssText = 'display: inline'}); |
| 451 | }; |
| 452 | // 循环添加 |
| 453 | files.forEach(function(fileElm) { |
| 454 | let trElm = fileElm.parentNode.parentNode; |
| 455 | // 绑定鼠标事件 |
| 456 | trElm.onmouseover = mouseOverHandler; |
| 457 | trElm.onmouseout = mouseOutHandler; |
| 458 | }); |
| 459 | } |
| 460 | |
| 461 | |
| 462 | // 适配白天/夜间主题模式 |
nothing calls this directly
no outgoing calls
no test coverage detected