mirror of
https://github.com/revanced/revanced-website.git
synced 2025-05-01 23:24:30 +02:00
preloading and one fix
This commit is contained in:
parent
c0999c2e3a
commit
5a376cd5b0
@ -16,6 +16,9 @@
|
||||
$: current = variants[i];
|
||||
let interval = null;
|
||||
onMount(() => {
|
||||
if (!hasVariants) {
|
||||
return;
|
||||
}
|
||||
interval = setInterval(() => {
|
||||
if (i === variants.length - 1) {
|
||||
i = 0;
|
||||
@ -40,13 +43,17 @@
|
||||
}
|
||||
|
||||
function nextVariant() {
|
||||
if (i >= variants.length) return null;
|
||||
if (i >= variants.length - 1) {
|
||||
return;
|
||||
}
|
||||
console.log('next');
|
||||
i++;
|
||||
}
|
||||
|
||||
function prevVariant() {
|
||||
if (i <= 0) return null;
|
||||
if (i == 0) {
|
||||
return;
|
||||
}
|
||||
console.log('previous');
|
||||
i--;
|
||||
}
|
||||
|
@ -114,12 +114,26 @@
|
||||
transitionDirection = -5;
|
||||
}
|
||||
|
||||
function preloadImage(url: string) {
|
||||
var img=new Image();
|
||||
img.src=url;
|
||||
}
|
||||
|
||||
function nextPage() {
|
||||
if (currentPage >= logoPages || submit) return null;
|
||||
currentPage++;
|
||||
|
||||
min = currentPage * logoAmount;
|
||||
max = min + logoAmount;
|
||||
|
||||
if (currentPage < logoPages) {
|
||||
const nextPage = currentPage + 1;
|
||||
const nextMin = nextPage * logoAmount;
|
||||
const nextMax = nextMin + logoAmount;
|
||||
logos.slice(nextMin, nextMax).forEach(({ variants }) => {
|
||||
variants.forEach(variant => preloadImage(variant.gdrive_direct_url));
|
||||
});
|
||||
}
|
||||
transitionDirection = 5;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user