From 4aeb54dee04f9bd07fc952246d669e95396b5ea2 Mon Sep 17 00:00:00 2001 From: hymbz Date: Tue, 13 Aug 2024 18:41:35 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20:bug:=20=E4=BF=AE=E5=A4=8D=E7=AE=80?= =?UTF-8?q?=E6=98=93=E9=98=85=E8=AF=BB=E6=A8=A1=E5=BC=8F=E4=B8=8B=E7=9A=84?= =?UTF-8?q?=E5=BC=82=E5=B8=B8=E6=BB=9A=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://sleazyfork.org/zh-CN/scripts/374903/discussions/254740 --- package.json | 1 + pnpm-lock.yaml | 44 ++++++++++++++++++++++++++++++++++++++++ src/site/other/index.tsx | 6 +++--- 3 files changed, 48 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 6cdccaf4..0ea0ed0f 100644 --- a/package.json +++ b/package.json @@ -86,6 +86,7 @@ "stylelint-order": "^6.0.4", "stylelint-prettier": "^5.0.2", "svgo": "^3.3.2", + "sync-fetch": "^0.5.2", "tslib": "^2.6.3", "typescript": "^5.5.4", "vite": "^5.4.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d7bf123c..af297e67 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -198,6 +198,9 @@ importers: svgo: specifier: ^3.3.2 version: 3.3.2 + sync-fetch: + specifier: ^0.5.2 + version: 0.5.2 tslib: specifier: ^2.6.3 version: 2.6.3 @@ -4432,6 +4435,15 @@ packages: resolution: {integrity: sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==} engines: {node: '>=10.5.0'} + node-fetch@2.7.0: + resolution: {integrity: sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==} + engines: {node: 4.x || >=6.0.0} + peerDependencies: + encoding: ^0.1.0 + peerDependenciesMeta: + encoding: + optional: true + node-fetch@3.3.2: resolution: {integrity: sha512-dRB78srN/l6gqWulah9SrxeYnxeddIG30+GOqK/9OlLVyLg3HPnr6SqOWTWOXKRwC2eGYCkZ59NNuSgvSrpgOA==} engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} @@ -5822,6 +5834,10 @@ packages: symbol-tree@3.2.4: resolution: {integrity: sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==} + sync-fetch@0.5.2: + resolution: {integrity: sha512-6gBqqkHrYvkH65WI2bzrDwrIKmt3U10s4Exnz3dYuE5Ah62FIfNv/F63inrNhu2Nyh3GH5f42GKU3RrSJoaUyQ==} + engines: {node: '>=14'} + synckit@0.9.1: resolution: {integrity: sha512-7gr8p9TQP6RAHusBOSLs46F4564ZrjV8xFmw5zCmgmhGUcw2hxsShhJ6CEiHQMgPDwAQ1fWHPM0ypc4RMAig4A==} engines: {node: ^14.18.0 || >=16.0.0} @@ -5919,6 +5935,9 @@ packages: resolution: {integrity: sha512-Loo5UUvLD9ScZ6jh8beX1T6sO1w2/MpCRpEP7V280GKMVUQ0Jzar2U3UJPsrdbziLEMMhu3Ujnq//rhiFuIeag==} engines: {node: '>=6'} + tr46@0.0.3: + resolution: {integrity: sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==} + tr46@1.0.1: resolution: {integrity: sha512-dTpowEjclQ7Kgx5SdBkqRzVhERQXov8/l9Ft9dVM9fmg0W0KQSVaXX9T4i6twCPNtYiZM53lpSSUAwJbFPOHxA==} @@ -6278,6 +6297,9 @@ packages: resolution: {integrity: sha512-e0MO3wdXWKrLbL0DgGnUV7WHVuw9OUvL4hjgnPkIeEvESk74gAITi5G606JtZPp39cd8HA9VQzCIvA49LpPN5Q==} engines: {node: '>= 8'} + webidl-conversions@3.0.1: + resolution: {integrity: sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==} + webidl-conversions@4.0.2: resolution: {integrity: sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg==} @@ -6311,6 +6333,9 @@ packages: resolution: {integrity: sha512-1lfMEm2IEr7RIV+f4lUNPOqfFL+pO+Xw3fJSqmjX9AbXcXcYOkCe1P6+9VBZB6n94af16NfZf+sSk0JCBZC9aw==} engines: {node: '>=18'} + whatwg-url@5.0.0: + resolution: {integrity: sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==} + whatwg-url@7.1.0: resolution: {integrity: sha512-WUu7Rg1DroM7oQvGWfOiAK21n74Gg+T4elXEQYkOhtyLeWiJFoOGLXPKI/9gzIie9CtwVLm8wtw6YJdKyxSjeg==} @@ -11147,6 +11172,10 @@ snapshots: node-domexception@1.0.0: {} + node-fetch@2.7.0: + dependencies: + whatwg-url: 5.0.0 + node-fetch@3.3.2: dependencies: data-uri-to-buffer: 4.0.1 @@ -12785,6 +12814,12 @@ snapshots: symbol-tree@3.2.4: {} + sync-fetch@0.5.2: + dependencies: + node-fetch: 2.7.0 + transitivePeerDependencies: + - encoding + synckit@0.9.1: dependencies: '@pkgr/core': 0.1.0 @@ -12870,6 +12905,8 @@ snapshots: universalify: 0.2.0 url-parse: 1.5.10 + tr46@0.0.3: {} + tr46@1.0.1: dependencies: punycode: 2.3.1 @@ -13244,6 +13281,8 @@ snapshots: web-streams-polyfill@3.2.1: {} + webidl-conversions@3.0.1: {} + webidl-conversions@4.0.2: {} webidl-conversions@7.0.0: {} @@ -13292,6 +13331,11 @@ snapshots: tr46: 5.0.0 webidl-conversions: 7.0.0 + whatwg-url@5.0.0: + dependencies: + tr46: 0.0.3 + webidl-conversions: 3.0.1 + whatwg-url@7.1.0: dependencies: lodash.sortby: 4.7.0 diff --git a/src/site/other/index.tsx b/src/site/other/index.tsx index daad63df..dc980b9e 100644 --- a/src/site/other/index.tsx +++ b/src/site/other/index.tsx @@ -12,7 +12,7 @@ import { throttle, createEffectOn, } from 'helper'; -import { renderImgList, store } from 'components/Manga'; +import { renderImgList } from 'components/Manga'; import { useInit, toast } from 'main'; import { getEleSelector, isEleSelector } from './eleSelector'; @@ -242,7 +242,7 @@ import { needTrigged, triggerLazyLoad } from './triggerLazyLoad'; createEffectOn( renderImgList, throttle((list) => { - if (list.size === 0 || !store.show) return; + if (list.size === 0 || !mangaProps.show) return; const lastImgIndex = [...list].at(-1); if (lastImgIndex === undefined) return; imgEleList[lastImgIndex]?.scrollIntoView({ @@ -256,7 +256,7 @@ import { needTrigged, triggerLazyLoad } from './triggerLazyLoad'; // 在退出阅读模式时跳回之前的滚动位置 let laseScroll = window.scrollY; createEffectOn( - () => store.show, + () => mangaProps.show, (show) => { if (show) laseScroll = window.scrollY; // 稍微延迟一下,等之前触发懒加载时的滚动结束