mirror of
https://git.luna-app.eu/50n50/sources
synced 2025-12-21 21:26:19 +01:00
Update temp/temp.js
This commit is contained in:
parent
addb8b7de9
commit
b5b4b4ddbb
1 changed files with 29 additions and 19 deletions
48
temp/temp.js
48
temp/temp.js
|
|
@ -110,7 +110,6 @@ async function extractChapters(url) {
|
|||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
async function extractText(url) {
|
||||
try {
|
||||
const response = await soraFetch(url);
|
||||
|
|
@ -124,22 +123,25 @@ async function extractText(url) {
|
|||
<html lang="en">
|
||||
<head>
|
||||
<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>
|
||||
<style>
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
-webkit-tap-highlight-color: transparent;
|
||||
}
|
||||
body {
|
||||
background: #000;
|
||||
-webkit-touch-callout: none;
|
||||
}
|
||||
img {
|
||||
width: 100%;
|
||||
display: block;
|
||||
opacity: 0;
|
||||
transition: opacity 0.3s ease;
|
||||
-webkit-user-select: none;
|
||||
}
|
||||
img.loaded {
|
||||
opacity: 1;
|
||||
|
|
@ -150,24 +152,32 @@ async function extractText(url) {
|
|||
${imageUrls.map(url => ` <img data-src="${url}" alt="">`).join('\n')}
|
||||
|
||||
<script>
|
||||
const imageObserver = new IntersectionObserver((entries, observer) => {
|
||||
entries.forEach(entry => {
|
||||
if (entry.isIntersecting) {
|
||||
const img = entry.target;
|
||||
img.src = img.dataset.src;
|
||||
img.onload = () => {
|
||||
img.classList.add('loaded');
|
||||
};
|
||||
observer.unobserve(img);
|
||||
}
|
||||
});
|
||||
}, {
|
||||
rootMargin: '200px'
|
||||
});
|
||||
(function() {
|
||||
var images = document.querySelectorAll('img[data-src]');
|
||||
var currentIndex = 0;
|
||||
|
||||
document.querySelectorAll('img[data-src]').forEach(img => {
|
||||
imageObserver.observe(img);
|
||||
});
|
||||
function loadNext() {
|
||||
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>
|
||||
</body>
|
||||
</html>`;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue