Configure shop app, admin sidebar, media routing, and Stripe dependencies
This commit is contained in:
commit
93d83a0d63
188 files changed
+9220
No files matched your search
@@ -0,0 +1,27 @@
|
||||
for (const product of document.querySelectorAll('[data-product]')) {
|
||||
const picker = product.querySelector('[data-variant-picker]');
|
||||
if (picker) {
|
||||
const panels = product.querySelectorAll('[data-variant-panel]');
|
||||
const select = () => {
|
||||
for (const panel of panels) panel.hidden = panel.dataset.variantPanel !== picker.value;
|
||||
};
|
||||
picker.addEventListener('change', select);
|
||||
select();
|
||||
picker.closest('label').hidden = false;
|
||||
}
|
||||
}
|
||||
for (const image of document.querySelectorAll('[data-shop-image] img')) {
|
||||
const reveal = () => image.parentElement.classList.add('has-shop-image');
|
||||
const recover = () => {
|
||||
image.parentElement.classList.remove('has-shop-image');
|
||||
const fallback = image.dataset.imageFallback;
|
||||
if (fallback && image.getAttribute('src') !== fallback) image.src = fallback;
|
||||
else image.hidden = true;
|
||||
};
|
||||
image.addEventListener('load', reveal);
|
||||
image.addEventListener('error', recover);
|
||||
if (image.complete && image.getAttribute('src')) {
|
||||
if (image.naturalWidth) reveal();
|
||||
else recover();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user