...
This commit is contained in:
parent
37a6497c84
commit
ca3527bc17
@ -614,8 +614,32 @@ async function handleCommon() {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
// gotoNext()
|
console.log(`Found TEST`);
|
||||||
|
const imageSelector = 'img[class*="mw-100"][src*="images"]';
|
||||||
|
const images = Array.from(document.querySelectorAll(imageSelector));
|
||||||
|
console.log(`Found ${images}`);
|
||||||
|
if (images.length > 0) {
|
||||||
|
const validImageUrls = images.map(img => img.src)
|
||||||
|
.filter(src => src && src.startsWith('http'));
|
||||||
|
const uniqueUrls = [...new Set(validImageUrls)];
|
||||||
|
|
||||||
|
console.log(`Found ${'$'}{uniqueUrls.length} unique images to cache.`);
|
||||||
|
|
||||||
|
// 3. 각 URL을 순회하며 Base64로 변환하고 즉시 네이티브로 전송
|
||||||
|
// (모든 작업을 병렬로 처리하지 않고 순차적(또는 하나씩)으로 보내 메모리 부담을 줄임)
|
||||||
|
for (const url of uniqueUrls) {
|
||||||
|
const base64Data = await getBase64FromUrl(url);
|
||||||
|
if (base64Data) {
|
||||||
|
// 이미지 하나를 성공할 때마다 네이티브로 즉시 전송
|
||||||
|
sendMessage({
|
||||||
|
type: "SINGLE_IMAGE_DATA",
|
||||||
|
imgSrc: url,
|
||||||
|
base64Data: base64Data
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
gotoNext()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if(location.href.search("javt")) {
|
else if(location.href.search("javt")) {
|
||||||
console.log(`Found TEST`);
|
console.log(`Found TEST`);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user