Made “prel()” also load previous-previuos and next-next images

This commit is contained in:
pezcurrel 2024-09-28 21:37:48 +02:00
parent 707d7f7c8f
commit 32a1ab4f3c

View file

@ -413,30 +413,40 @@ function prel() {
pages=Math.round(th/ph),
sy=Math.round(md.scrollTop),
page=Math.round(pages-(th-sy)/ph)+1,
img,
u;
img;
//console.log(ph+" "+th+" "+pages+" "+sy+" "+page);
if (page>1) {//current
img=document.getElementById("img"+(page-2));
if (img.src==phimgurl) {
u=imgurls[page-2];
img.src=u;
img.src=imgurls[page-2];
img.loading="eager";
}
}
if (page<pages) {//next
img=document.getElementById("img"+(page-1));
if (img.src==phimgurl) {
u=imgurls[page-1];
img.src=u;
img.src=imgurls[page-1];
img.loading="eager";
}
}
if (page>2) {//previous
img=document.getElementById("img"+(page-3));
if (img.src==phimgurl) {
u=imgurls[page-3];
img.src=u;
img.src=imgurls[page-3];
img.loading="eager";
}
}
if (page+1<pages) {//next-next
img=document.getElementById("img"+page);
if (img.src==phimgurl) {
img.src=imgurls[page];
img.loading="eager";
}
}
if (page>3) {//previous-previous
img=document.getElementById("img"+(page-4));
if (img.src==phimgurl) {
img.src=imgurls[page-4];
img.loading="eager";
}
}