mirror of
https://github.com/PretendoNetwork/website.git
synced 2026-04-26 10:04:25 -05:00
Defer loading the Mii save previews
This commit is contained in:
parent
62274468f5
commit
5356bda5a9
|
|
@ -69,8 +69,8 @@ function initializeMiiData(encodedUserMiiData) {
|
||||||
bgColor: '13173300',
|
bgColor: '13173300',
|
||||||
expression: 'sorrow',
|
expression: 'sorrow',
|
||||||
});
|
});
|
||||||
document.querySelector('.mii-comparison img.old-mii').src = miiStudioNeutralUrl;
|
document.querySelector('.mii-comparison img.old-mii').setAttribute('data-src', miiStudioNeutralUrl);
|
||||||
document.querySelector('.mii-comparison.confirmed img.old-mii').src = miiStudioSorrowUrl;
|
document.querySelector('.mii-comparison.confirmed img.old-mii').setAttribute('data-src', miiStudioSorrowUrl);
|
||||||
console.log('initialization complete');
|
console.log('initialization complete');
|
||||||
console.groupEnd();
|
console.groupEnd();
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -184,8 +184,8 @@ function renderMii(heightOverride, buildOverride) {
|
||||||
});
|
});
|
||||||
|
|
||||||
// sets the new mii in the save tab to the new mii
|
// sets the new mii in the save tab to the new mii
|
||||||
document.querySelector('.mii-comparison img.new-mii').src = faceMiiStudioUrl;
|
document.querySelector('.mii-comparison img.new-mii').setAttribute('data-src', faceMiiStudioUrl);
|
||||||
document.querySelector('.mii-comparison.confirmed img.new-mii').src = faceMiiStudioSmileUrl;
|
document.querySelector('.mii-comparison.confirmed img.new-mii').setAttribute('data-src', faceMiiStudioSmileUrl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -372,6 +372,18 @@ function openTab(e, tabType) {
|
||||||
.replace('Button', buttonReplacement);
|
.replace('Button', buttonReplacement);
|
||||||
document.querySelector(`#${selectedID}`).classList.add('active');
|
document.querySelector(`#${selectedID}`).classList.add('active');
|
||||||
|
|
||||||
|
// if you selected the save tab...
|
||||||
|
if (selectedID === 'saveTab') {
|
||||||
|
// set data-src on images that have it to src
|
||||||
|
// effectively loading them right now (lazy load)
|
||||||
|
document
|
||||||
|
.querySelectorAll('#saveTab img[data-src]')
|
||||||
|
.forEach(e => {
|
||||||
|
if (e.getAttribute('data-src') !== e.src)
|
||||||
|
e.setAttribute('src', e.getAttribute('data-src'));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if (tabType === 'tab') {
|
if (tabType === 'tab') {
|
||||||
// Click the first subtab button, if there is one
|
// Click the first subtab button, if there is one
|
||||||
document.querySelector(`#${selectedID} .subtabbtn`)?.click();
|
document.querySelector(`#${selectedID} .subtabbtn`)?.click();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user