$${product.price / 100} $0.00`; // console.log("popup content", popupContent); } ); } //console.log("==========END displayPromoDetail()"); } catch(e){ console.error("Error adding promo detail: ", e); } } function checkDeviceScreen(x, b) { console.log("checking device media..."); if (x.matches) { // If media query matches, do mobile banner console.log('inside checkDeviceScreen, b is: ', b); b.src = productPromosByPriority[0].bannerURLMobile; dealsPageSectionEl.style.display = "none"; bannerWrapperEl.style.height = "unset"; console.log("adding mobile banner") console.log("Media matches is:", x, x.matches); } else { // Else, do desktop banner b.src = productPromosByPriority[0].bannerURL; console.log("adding desktop product banner"); bannerWrapperEl.style.height = "120px"; dealsPageSectionEl.style.display = "block"; } } // Sets Desktop or Mobile banners. If either banner asset is missing, nothing gets displayed // on the banner section. function displayBanners(b){ //Check if promo has both desktop and mobile banners and if not, exit if( productPromosByPriority[0].bannerURL.includes('no-image') || productPromosByPriority[0].bannerURLMobile.includes('no-image')){ console.error("NewProductBanner:", "Desktop or Mobile product banner not found.") return; } // if banner wrapper div is found, setup banner section and deals page section if(bannerWrapperEl){ //Banner section image const banner = b || document.createElement('img'); console.log("banner is: ", banner); bannerSectionEl.appendChild(banner); //Check device screen and change banners accordingly. const wmm = window.matchMedia("(max-width: 479px)") checkDeviceScreen(wmm, banner) // Call listener function at run time wmm.addListener(function(){ checkDeviceScreen(wmm, banner); }); // Attach listener function on state changes //Display main wrapper div bannerWrapperEl.style.display = "block"; // Check device width for mobile banner. } else { console.error("New Product Banner wrapper element not found."); } } // Checks the section schema for all Promotion blocks currently saved and adds each // individual block as an active promo. Returns an array of active promos. function getActivePromos(){ const promos = []; console.log('promo: ', 'sbdk-21029', 'visible'); try{ promos.push({ id: `sbdk-21029`, status: `visible`, bannerURL: `//cdn.shopify.com/shopifycloud/shopify/assets/no-image-2048-5e88c1b20e087fb7bbe9a3771824e743c244f437e4f8ba93bbf7b11b53f7824c.gif`, bannerURLMobile: `//cdn.shopify.com/shopifycloud/shopify/assets/no-image-2048-5e88c1b20e087fb7bbe9a3771824e743c244f437e4f8ba93bbf7b11b53f7824c.gif`, expirationDate: `20210630`, priority: 2, freeItemHandle: ``, freeItemTagline: `FREE tool with this item.` }); } catch(e){ console.error("Error adding active promo", e); } console.log('promo: ', 'special-sale', 'visible'); try{ promos.push({ id: `special-sale`, status: `visible`, bannerURL: `//cdn.shopify.com/shopifycloud/shopify/assets/no-image-2048-5e88c1b20e087fb7bbe9a3771824e743c244f437e4f8ba93bbf7b11b53f7824c.gif`, bannerURLMobile: `//cdn.shopify.com/shopifycloud/shopify/assets/no-image-2048-5e88c1b20e087fb7bbe9a3771824e743c244f437e4f8ba93bbf7b11b53f7824c.gif`, expirationDate: `20201231`, priority: 1, freeItemHandle: ``, freeItemTagline: `FAOBUCKS Spend Now, Earn on Your Next Purchase!