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];
|
$: current = variants[i];
|
||||||
let interval = null;
|
let interval = null;
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
|
if (!hasVariants) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
interval = setInterval(() => {
|
interval = setInterval(() => {
|
||||||
if (i === variants.length - 1) {
|
if (i === variants.length - 1) {
|
||||||
i = 0;
|
i = 0;
|
||||||
@ -40,13 +43,17 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function nextVariant() {
|
function nextVariant() {
|
||||||
if (i >= variants.length) return null;
|
if (i >= variants.length - 1) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
console.log('next');
|
console.log('next');
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
function prevVariant() {
|
function prevVariant() {
|
||||||
if (i <= 0) return null;
|
if (i == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
console.log('previous');
|
console.log('previous');
|
||||||
i--;
|
i--;
|
||||||
}
|
}
|
||||||
|
@ -114,12 +114,26 @@
|
|||||||
transitionDirection = -5;
|
transitionDirection = -5;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function preloadImage(url: string) {
|
||||||
|
var img=new Image();
|
||||||
|
img.src=url;
|
||||||
|
}
|
||||||
|
|
||||||
function nextPage() {
|
function nextPage() {
|
||||||
if (currentPage >= logoPages || submit) return null;
|
if (currentPage >= logoPages || submit) return null;
|
||||||
currentPage++;
|
currentPage++;
|
||||||
|
|
||||||
min = currentPage * logoAmount;
|
min = currentPage * logoAmount;
|
||||||
max = min + 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;
|
transitionDirection = 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user