From 349b02c2231e000d49bf71bcd5afc3427b326e43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E8=89=AF?= <841369634@qq.com> Date: Sat, 27 Apr 2024 23:57:00 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=8F=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GithubEnhanced-High-Speed-Download.user.js | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/GithubEnhanced-High-Speed-Download.user.js b/GithubEnhanced-High-Speed-Download.user.js index 9ee329f..18980f0 100644 --- a/GithubEnhanced-High-Speed-Download.user.js +++ b/GithubEnhanced-High-Speed-Download.user.js @@ -231,8 +231,7 @@ document.addEventListener("DOMContentLoaded", () => { // Release function addRelease() { - let html = document.querySelectorAll('.Box-footer'); - if (html.length === 0 || location.pathname.indexOf('/releases') === -1) return; + let html = document.querySelectorAll('.Box-footer'); if (html.length == 0 || location.pathname.indexOf('/releases') == -1) return let divDisplay = 'margin-left: -90px;', new_download_url = get_New_download_url(); if (document.documentElement.clientWidth > 755) {divDisplay = 'margin-top: -3px;margin-left: 8px;display: inherit;';}; // 调整小屏幕时的样式 for (const current of html) { @@ -257,8 +256,7 @@ document.addEventListener("DOMContentLoaded", () => { // Download ZIP function addDownloadZIP(target) { - let html = target.querySelector('ul[class^=List__ListBox-sc-] ul[class^=List__ListBox-sc-]>li:last-child'); - if (!html) return; + let html = target.querySelector('ul[class^=List__ListBox-sc-] ul[class^=List__ListBox-sc-]>li:last-child');if (!html) return let href_script = document.querySelector('react-partial[partial-name=repos-overview]>script[data-target="react-partial.embeddedData"]'), href_slice = href_script.textContent.slice(href_script.textContent.indexOf('"zipballUrl":"')+14), href = href_slice.slice(0, href_slice.indexOf('"')), @@ -387,15 +385,14 @@ document.addEventListener("DOMContentLoaded", () => { cntElm_a = trElm.querySelector('[role="rowheader"] > .css-truncate.css-truncate-target.d-block.width-fit > a, .react-directory-truncate>a'), Name = cntElm_a.innerText, href = cntElm_a.getAttribute('href'), - href2 = href.replace('/blob/','/'), url, url_name, url_tip; + href2 = href.replace('/blob/','/'), url = ''; if ((raw_url[menu_rawFast][0].indexOf('/gh') + 3 === raw_url[menu_rawFast][0].length) && raw_url[menu_rawFast][0].indexOf('cdn.staticaly.com') === -1) { url = raw_url[menu_rawFast][0] + href.replace('/blob/','@'); } else { url = raw_url[menu_rawFast][0] + href2; } - url_name = raw_url[menu_rawFast][1]; url_tip = raw_url[menu_rawFast][2]; - fileElm.insertAdjacentHTML('afterend', ``); + fileElm.insertAdjacentHTML('afterend', ``); // 绑定鼠标事件 trElm.onmouseover = mouseOverHandler; trElm.onmouseout = mouseOutHandler; @@ -458,7 +455,7 @@ document.addEventListener("DOMContentLoaded", () => { backColor = '#161a21'; fontColor = '#97a0aa'; } } else if (document.lastElementChild.dataset.colorMode === 'auto') { // 如果是自动模式 - if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches || document.lastElementChild.dataset.lightTheme.indexOf('dark') > -1) { // 如果浏览器是夜间模式 或 白天模式是 dark 的情况 + if (window.matchMedia('(prefers-color-scheme: dark)').matches || document.lastElementChild.dataset.lightTheme.indexOf('dark') > -1) { // 如果浏览器是夜间模式 或 白天模式是 dark 的情况 if (document.lastElementChild.dataset.darkTheme === 'dark_dimmed') { backColor = '#272e37'; fontColor = '#768390'; } else if (document.lastElementChild.dataset.darkTheme.indexOf('light') == -1) { // 排除夜间模式是 light 的情况