Update temp/temp.js

This commit is contained in:
aka paul 2025-10-26 22:53:25 +00:00
parent addb8b7de9
commit b5b4b4ddbb

View file

@ -110,7 +110,6 @@ async function extractChapters(url) {
return []; return [];
} }
} }
async function extractText(url) { async function extractText(url) {
try { try {
const response = await soraFetch(url); const response = await soraFetch(url);
@ -124,22 +123,25 @@ async function extractText(url) {
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>Manga</title> <title>Manga</title>
<style> <style>
* { * {
margin: 0; margin: 0;
padding: 0; padding: 0;
box-sizing: border-box; box-sizing: border-box;
-webkit-tap-highlight-color: transparent;
} }
body { body {
background: #000; background: #000;
-webkit-touch-callout: none;
} }
img { img {
width: 100%; width: 100%;
display: block; display: block;
opacity: 0; opacity: 0;
transition: opacity 0.3s ease; transition: opacity 0.3s ease;
-webkit-user-select: none;
} }
img.loaded { img.loaded {
opacity: 1; opacity: 1;
@ -150,24 +152,32 @@ async function extractText(url) {
${imageUrls.map(url => ` <img data-src="${url}" alt="">`).join('\n')} ${imageUrls.map(url => ` <img data-src="${url}" alt="">`).join('\n')}
<script> <script>
const imageObserver = new IntersectionObserver((entries, observer) => { (function() {
entries.forEach(entry => { var images = document.querySelectorAll('img[data-src]');
if (entry.isIntersecting) { var currentIndex = 0;
const img = entry.target;
img.src = img.dataset.src;
img.onload = () => {
img.classList.add('loaded');
};
observer.unobserve(img);
}
});
}, {
rootMargin: '200px'
});
document.querySelectorAll('img[data-src]').forEach(img => { function loadNext() {
imageObserver.observe(img); if (currentIndex >= images.length) return;
});
var img = images[currentIndex];
img.src = img.dataset.src;
img.onload = function() {
img.classList.add('loaded');
currentIndex++;
loadNext();
};
img.onerror = function() {
currentIndex++;
loadNext();
};
}
loadNext();
loadNext();
loadNext();
})();
</script> </script>
</body> </body>
</html>`; </html>`;