removed debug console logs
parent
4d02ed130f
commit
9b8f224e14
|
@ -120,7 +120,7 @@ function focusVisiblePolyfill() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function pauseAllMedia() {
|
function pauseAllMedia() {
|
||||||
console.log('Pausing all media');
|
//console.log('Pausing all media');
|
||||||
|
|
||||||
document.querySelectorAll('.js-youtube').forEach((video) => {
|
document.querySelectorAll('.js-youtube').forEach((video) => {
|
||||||
video.contentWindow.postMessage('{"event":"command","func":"' + 'pauseVideo' + '","args":""}', '*');
|
video.contentWindow.postMessage('{"event":"command","func":"' + 'pauseVideo' + '","args":""}', '*');
|
||||||
|
@ -135,7 +135,7 @@ function pauseAllMedia() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function pauseAllMediaInGallery(gallery) {
|
function pauseAllMediaInGallery(gallery) {
|
||||||
console.log('Pausing all media in gallery');
|
//console.log('Pausing all media in gallery');
|
||||||
|
|
||||||
gallery.querySelectorAll('.js-youtube').forEach((video) => {
|
gallery.querySelectorAll('.js-youtube').forEach((video) => {
|
||||||
video.contentWindow.postMessage('{"event":"command","func":"' + 'pauseVideo' + '","args":""}', '*');
|
video.contentWindow.postMessage('{"event":"command","func":"' + 'pauseVideo' + '","args":""}', '*');
|
||||||
|
@ -610,7 +610,7 @@ class DeferredMedia extends HTMLElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
loadContent(focus = true) {
|
loadContent(focus = true) {
|
||||||
console.log('Loading content');
|
//console.log('Loading content');
|
||||||
window.pauseAllMedia();
|
window.pauseAllMedia();
|
||||||
if (!this.getAttribute('loaded')) {
|
if (!this.getAttribute('loaded')) {
|
||||||
const content = document.createElement('div');
|
const content = document.createElement('div');
|
||||||
|
@ -1065,15 +1065,15 @@ class VariantSelects extends HTMLElement {
|
||||||
}
|
}
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
console.log('this.currentVariant.featured_image', this.currentVariant.featured_image);
|
//console.log('this.currentVariant.featured_image', this.currentVariant.featured_image);
|
||||||
console.log('this.currentVariant.featured_image.alt', this.currentVariant.featured_image.alt);
|
//console.log('this.currentVariant.featured_image.alt', this.currentVariant.featured_image.alt);
|
||||||
|
|
||||||
if (this.currentVariant.featured_image && this.currentVariant.featured_image.alt) {
|
if (this.currentVariant.featured_image && this.currentVariant.featured_image.alt) {
|
||||||
// just for info: document.querySelectorAll('[thumbnail-alt = '${test}']') // to select all elements with the alt tag
|
// just for info: document.querySelectorAll('[thumbnail-alt = '${test}']') // to select all elements with the alt tag
|
||||||
|
|
||||||
// only show the image with the alt tag that matches the variant title
|
// only show the image with the alt tag that matches the variant title
|
||||||
document.querySelectorAll('[thumbnail-alt]').forEach((thumbnail) => {
|
document.querySelectorAll('[thumbnail-alt]').forEach((thumbnail) => {
|
||||||
console.log(thumbnail.getAttribute('thumbnail-alt'));
|
//console.log(thumbnail.getAttribute('thumbnail-alt'));
|
||||||
if (thumbnail.getAttribute('thumbnail-alt') === this.currentVariant.featured_image.alt) {
|
if (thumbnail.getAttribute('thumbnail-alt') === this.currentVariant.featured_image.alt) {
|
||||||
thumbnail.style.display = 'block';
|
thumbnail.style.display = 'block';
|
||||||
} else {
|
} else {
|
||||||
|
@ -1083,7 +1083,7 @@ class VariantSelects extends HTMLElement {
|
||||||
);
|
);
|
||||||
|
|
||||||
document.querySelectorAll('[thumbnail-alt-mobile]').forEach((thumbnail) => {
|
document.querySelectorAll('[thumbnail-alt-mobile]').forEach((thumbnail) => {
|
||||||
console.log(thumbnail.getAttribute('thumbnail-alt-mobile'));
|
//console.log(thumbnail.getAttribute('thumbnail-alt-mobile'));
|
||||||
if (thumbnail.getAttribute('thumbnail-alt-mobile') === this.currentVariant.featured_image.alt) {
|
if (thumbnail.getAttribute('thumbnail-alt-mobile') === this.currentVariant.featured_image.alt) {
|
||||||
// check if has class "is-active" to show the image
|
// check if has class "is-active" to show the image
|
||||||
if (thumbnail.classList.contains('is-active') === false) {
|
if (thumbnail.classList.contains('is-active') === false) {
|
||||||
|
@ -1161,7 +1161,7 @@ class VariantSelects extends HTMLElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
updateMedia() {
|
updateMedia() {
|
||||||
console.log('updateMedia', this.currentVariant);
|
//console.log('updateMedia', this.currentVariant);
|
||||||
|
|
||||||
if (!this.currentVariant) return;
|
if (!this.currentVariant) return;
|
||||||
if (!this.currentVariant.featured_media) return;
|
if (!this.currentVariant.featured_media) return;
|
||||||
|
@ -1171,16 +1171,16 @@ class VariantSelects extends HTMLElement {
|
||||||
//mediaGallery.setActiveMedia(`${this.dataset.section}-${this.currentVariant.featured_media.id}`, true);
|
//mediaGallery.setActiveMedia(`${this.dataset.section}-${this.currentVariant.featured_media.id}`, true);
|
||||||
|
|
||||||
// how to get second image id from the gallery
|
// how to get second image id from the gallery
|
||||||
console.log('mediaGallery', mediaGallery);
|
//console.log('mediaGallery', mediaGallery);
|
||||||
|
|
||||||
// get the second image id
|
// get the second image id
|
||||||
const galleryImages = mediaGallery.querySelectorAll('.thumbnail-list__item');
|
const galleryImages = mediaGallery.querySelectorAll('.thumbnail-list__item');
|
||||||
|
|
||||||
console.log('mediaGallery.elements.thumbnails', mediaGallery.elements.thumbnails);
|
//console.log('mediaGallery.elements.thumbnails', mediaGallery.elements.thumbnails);
|
||||||
|
|
||||||
for (const galleryImage of galleryImages) {
|
for (const galleryImage of galleryImages) {
|
||||||
// if display is not none, then show the image
|
// if display is not none, then show the image
|
||||||
console.log("galleryImage.getAttribute('thumbnail-alt')", galleryImage.getAttribute('thumbnail-alt'));
|
//console.log("galleryImage.getAttribute('thumbnail-alt')", galleryImage.getAttribute('thumbnail-alt'));
|
||||||
if (galleryImage.getAttribute('thumbnail-alt') === this.currentVariant.featured_image.alt) {
|
if (galleryImage.getAttribute('thumbnail-alt') === this.currentVariant.featured_image.alt) {
|
||||||
|
|
||||||
// check if galleryImage has data-is-video-type attribute
|
// check if galleryImage has data-is-video-type attribute
|
||||||
|
@ -1188,7 +1188,7 @@ class VariantSelects extends HTMLElement {
|
||||||
continue;
|
continue;
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
console.log('galleryImage.dataset', galleryImage.dataset);
|
//console.log('galleryImage.dataset', galleryImage.dataset);
|
||||||
|
|
||||||
const target = galleryImage.dataset.target; // "template--22806669590804__main-38794319626516"
|
const target = galleryImage.dataset.target; // "template--22806669590804__main-38794319626516"
|
||||||
//const targetId = target.split('__')[1]; // "main-38794319626516"
|
//const targetId = target.split('__')[1]; // "main-38794319626516"
|
||||||
|
@ -1196,7 +1196,7 @@ class VariantSelects extends HTMLElement {
|
||||||
|
|
||||||
//setTimeout(() => {
|
//setTimeout(() => {
|
||||||
//mediaGallery.setActiveMedia(`${this.dataset.section}-${targetIdSplit}`, true);
|
//mediaGallery.setActiveMedia(`${this.dataset.section}-${targetIdSplit}`, true);
|
||||||
console.log('mediaGallery.setActiveThumbnail', target);
|
//console.log('mediaGallery.setActiveThumbnail', target);
|
||||||
mediaGallery.setActiveMedia(target, true);
|
mediaGallery.setActiveMedia(target, true);
|
||||||
//}, 1000);
|
//}, 1000);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue