diff --git "a/\347\275\221\347\233\230\347\233\264\351\223\276\344\270\213\350\275\275\345\212\251\346\211\213.user.js" "b/\347\275\221\347\233\230\347\233\264\351\223\276\344\270\213\350\275\275\345\212\251\346\211\213.user.js" index 05c4c64..8c1a882 100644 --- "a/\347\275\221\347\233\230\347\233\264\351\223\276\344\270\213\350\275\275\345\212\251\346\211\213.user.js" +++ "b/\347\275\221\347\233\230\347\233\264\351\223\276\344\270\213\350\275\275\345\212\251\346\211\213.user.js" @@ -83,7 +83,6 @@ const driveHdrs = {}; // 城通给的下载地址常配一组头,按 URL 存 const BTN_ICON = ''; const ROW_BUTTON = '
' + BTN_ICON + '下载助手
'; - const clampGap = (v) => Math.max(-40, Math.min(40, Math.round(v))); const driveTrace = { url: '', body: '' }; if (/drive\.ctfile\.com/.test(location.host)) { const pageWin = (typeof unsafeWindow !== 'undefined' && unsafeWindow) ? unsafeWindow : window; @@ -2225,17 +2224,19 @@ .ali-button { display: inline-flex; align-items: center; justify-content: center; border: 0 solid transparent; border-radius: 5px; white-space: nowrap; flex-shrink: 0; font-size: 14px; line-height: 1.5; outline: 0; touch-action: manipulation; transition: background .3s ease; color: #fff; background: #637dff; margin-left: 20px; padding: 0 12px; position: relative; cursor: pointer; height: 32px; min-height: 32px; } .ali-button:hover { background: #7a90ff; } .ali-button:focus-visible { outline: 2px solid #637dff; outline-offset: 2px; } - .xunlei-button { display: inline-flex; align-items: center; justify-content: center; border: 0 solid transparent; border-radius: 5px; white-space: nowrap; flex-shrink: 0; font-size: 14px; line-height: 1.5; outline: 0; touch-action: manipulation; transition: background .3s ease; color: #fff; background: #3f85ff; margin-left: 12px; padding: 0 12px; position: relative; cursor: pointer; height: 36px; min-height: 32px; } + .xunlei-button { display: inline-flex; align-items: center; justify-content: center; border: 0 solid transparent; border-radius: 4px; white-space: nowrap; flex-shrink: 0; font-size: 14px; line-height: 1.5; outline: 0; touch-action: manipulation; transition: background .3s ease; color: #fff; background: #3f85ff; margin-left: 12px; padding: 0 12px; position: relative; cursor: pointer; height: 36px; min-height: 32px; } + .xunlei-button i { line-height: 36px; padding-left: 2px; } .xunlei-button:hover { background: #619bff; } .xunlei-button:focus-visible { outline: 2px solid #3f85ff; outline-offset: 2px; } - .tianyi-button { display: inline-flex; align-items: center; justify-content: center; margin-right: 12px; padding: 4px 12px; border-radius: 4px; color: #fff; font-size: 12px; border: 1px solid #0073e3; background: #2b89ea; cursor: pointer; position: relative; min-height: 32px; transition: background .3s ease; width: auto; white-space: nowrap; text-align: center; } + .tianyi-button { display: inline-flex; align-items: center; justify-content: center; margin-right: 12px; padding: 0 12px; border-radius: 2px; color: #fff; font-size: 12px; border: 1px solid #0073e3; background: #2b89ea; cursor: pointer; position: relative; min-height: 30px; line-height: 28px; transition: background .3s ease; width: auto; white-space: nowrap; text-align: center; } .tianyi-button:hover { border-color: #1874d3; background: #3699ff; } .tianyi-button:focus-visible { outline: 2px solid #2b89ea; outline-offset: 2px; } .yidong-button { float: left; position: relative; display: flex; align-items: center; justify-content: center; gap: 4px; margin: 20px 24px 20px 0; width: 98px; height: 36px; background: #3181f9; border-radius: 2px; font-size: 14px; color: #fff; line-height: 1; text-align: center; cursor: pointer; min-height: 32px; transition: background .3s ease; } .yidong-button svg { width: 20px; height: 20px; flex: 0 0 auto; } .yidong-button:hover { background: #2d76e5; } .yidong-button:focus-visible { outline: 2px solid #3181f9; outline-offset: 2px; } - .quark-button { display: inline-flex; align-items: center; justify-content: center; border: 1px solid #0d53ff; border-radius: 8px; white-space: nowrap; flex-shrink: 0; font-size: 12px; font-weight: 600; line-height: 1.5; outline: 0; color: #fff; background: #0d53ff; margin-right: 10px; padding: 0 10px; position: relative; cursor: pointer; height: 36px; min-height: 32px; transition: background .3s ease; } + .quark-button { display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 8px; white-space: nowrap; flex-shrink: 0; font-size: 12px; font-weight: 600; line-height: 1.5; outline: 0; color: #fff; background: #0d53ff; margin-right: 16px; padding: 0 10px; position: relative; cursor: pointer; height: 36px; min-height: 32px; transition: background .3s ease; } + .quark-button svg { width: 20px; height: 20px; margin-right: 0; flex: 0 0 auto; } .quark-button:hover { background: #3a72ff; border-color: #3a72ff; } .quark-button:focus-visible { outline: 2px solid #3f85ff; outline-offset: 2px; } .ctfile-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; box-sizing: border-box; margin: 6px; height: 48px; padding: 0 24px; border: 1px solid #1677ff; border-radius: 8px; background: #1677ff; color: #fff; font-family: inherit; font-size: 16px; font-weight: 700; line-height: 1; white-space: nowrap; flex-shrink: 0; cursor: pointer; transition: background-color .15s, border-color .15s, box-shadow .15s; } @@ -2250,7 +2251,7 @@ .ctfile-button-sm { height: 30px; padding: 0 14px; gap: 6px; font-size: 14px; font-weight: 600; } .ctfile-button-sm svg { width: 16px; height: 16px; } /* 跟「上传/上传文件夹」同款:色值、高度、圆角挂载时从旁边按钮读回来(--fl-*) */ - .ctfile-button-peer { margin: 0; height: var(--fl-h, 32px); padding: 0 14px; gap: 6px; border: 1px solid var(--fl-bd, #1677ff); border-radius: var(--fl-r, 8px); background: var(--fl-bg, #1677ff); color: var(--fl-fg, #fff); font-size: var(--fl-fs, 14px); font-weight: var(--fl-fw, 600); } + .ctfile-button-peer { margin: 0; height: var(--fl-h, 32px); padding: 0 16px; gap: 8px; border: 1px solid var(--fl-bd, #1677ff); border-radius: var(--fl-r, 8px); background: var(--fl-bg, #1677ff); color: var(--fl-fg, #fff); font-size: var(--fl-fs, 14px); font-weight: var(--fl-fw, 600); } .ctfile-button-peer:hover { box-shadow: inset 0 0 0 999px rgba(255, 255, 255, .14); } .ctfile-button-peer:active { box-shadow: inset 0 0 0 999px rgba(0, 0, 0, .12); } .ctfile-button-peer:focus-visible { outline: 2px solid var(--fl-bd, #1677ff); outline-offset: 2px; } @@ -2529,7 +2530,7 @@ }, addButton() { const $button = $(`
下载助手
`); - const $mainButton = $(`
`); + const $mainButton = $(`
`); const $shareButton = $(`${BTN_ICON}下载助手`); if (color) [['--fl-fg', color], ['--fl-bd', color], ['--fl-bg', color + '1f'], ['--fl-bg-h', color + '3d']].forEach((kv) => $shareButton[0].style.setProperty(kv[0], kv[1])); base.mountWithRetry(() => { @@ -3492,7 +3493,7 @@ addButton() { if (!pageNum) return; let $toolWrap; - let $button = $(`
下载助手
`); + let $button = $(`
下载助手
`); if (pageNum === 'home') { this._smartListen(() => { let container = this._findHomeContainer(); @@ -3798,7 +3799,7 @@ }); }, addButton() { - const $button = $(`
下载助手
`); + const $button = $(`
下载助手
`); base.mountWithRetry(() => { pageNum = this.detectPage(); let $toolWrap = $(panInfo.btn.home); @@ -4274,41 +4275,22 @@ '--fl-fs': cs.fontSize, '--fl-fw': cs.fontWeight, }); - // 紧贴在一起的是连体组,插到组外 - let sib = up.nextElementSibling; - let compact = !!sib && (sib.getBoundingClientRect().left - up.getBoundingClientRect().right) < 2; - let anchor = compact ? up.parentElement : up; - if (!anchor) return false; - // 往上找第一对有间隙的相邻控件 - let target = 0, node = up; - for (let d = 0; d < 3 && node && !target; d++) { - node = node.parentElement; - if (!node) break; - let kids = [...node.children].filter(el => el.getBoundingClientRect().width > 0); - for (let i = 1; i < kids.length; i++) { - let g = kids[i].getBoundingClientRect().left - kids[i - 1].getBoundingClientRect().right; - if (g > 2 && g < 60) { target = Math.round(g); break; } - } + let group = up.closest('.ct-btn-split'); + let anchor = group; + if (!anchor) { + let sib = up.nextElementSibling; + let compact = !!sib && (sib.getBoundingClientRect().left - up.getBoundingClientRect().right) < 2; + anchor = compact ? up.parentElement : up; } - if (!target) target = 8; - // 组自带左边距,用负 margin 抵掉,不动城通元素 - let ml = parseFloat(getComputedStyle(anchor).marginLeft) || 0; - $btn.css('margin-right', clampGap(target - ml) + 'px'); + if (!anchor) return false; + $btn.css('margin-right', '0px'); anchor.before($btn[0]); - // 字体和布局可能晚一步才定,多校几次,每次都往目标值上贴 - let fix = () => { - if (!$btn[0].isConnected || !up.isConnected) return; - let cur = up.getBoundingClientRect().left - $btn[0].getBoundingClientRect().right; - if (Math.abs(target - cur) >= 0.5) { - let mr = parseFloat(getComputedStyle($btn[0]).marginRight) || 0; - $btn.css('margin-right', clampGap(mr + (target - cur)) + 'px'); - cur = up.getBoundingClientRect().left - $btn[0].getBoundingClientRect().right; - } - }; - [0, 150, 400].forEach(t => { - if (!t && typeof requestAnimationFrame === 'function') requestAnimationFrame(fix); - else setTimeout(fix, t); - }); + let gap = anchor.getBoundingClientRect().left - $btn[0].getBoundingClientRect().right; + if (gap < 2) { + let ref = anchor.nextElementSibling; + let ml = ref ? parseFloat(getComputedStyle(ref).marginLeft) || 0 : 0; + $btn.css('margin-right', (ml > 0 ? ml : 8) + 'px'); + } return true; }, _watchHash() {