// ******************************************************************
// PRODUCT GALLERY Variable Configuration
// ******************************************************************
// Check to make sure that we are on a product gallery page
var approve_product_gallery_page_check = '.product.product--large ';
// Wrapper for each item
var approve_product_gallery_item_ele = ' .product__info-wrapper';
// Price for each item
var approve_product_model_ele_name = ' .product__title h1';
// Price for each item
var approve_product_gallery_item_price_ele = ' span.price-item.price-item--regular';
// Insert button after
var approve_product_gallery_insert_btn_after_ele = ' .product-form__buttons';
// PRODUCT GALLERY
if (approve_product_gallery_page_check){
var approve_product_page_check = document.querySelector(approve_product_gallery_page_check);
}
if (approve_product_page_check){
var approve_gallery_product_array = document.querySelectorAll(approve_product_gallery_item_ele);
approve_gallery_product_array.forEach(function(item) {
var approve_gallery_price_wrapper = item.querySelector(approve_product_gallery_item_price_ele);
var approve_gallery_price = 0;
if (approve_gallery_price_wrapper){
approve_gallery_price = approve_gallery_price_wrapper.innerHTML;
approve_gallery_price = approve_gallery_price.replace(/[^0-9-.]/g, '');
approve_price = parseFloat(approve_gallery_price);
approve_teaser = approve_price/60;
}
if (approve_product_model_ele_name) {
approve_model = document.querySelector(approve_product_model_ele_name);
}
var insert_ele = item.querySelector(approve_product_gallery_insert_btn_after_ele);
let approve_button_wrapper = document.createElement("div");
approve_button_wrapper.className = "btn-container";
approve_button_wrapper.style.marginTop = "25px";
approve_button_wrapper.style.marginLeft = "60px";
var approve_item = '[{"model":"'+encodeURIComponent(approve_model.textContent)+'","price":'+approve_price+',"subtotal":'+approve_price+',"quantity":1,"type":"new_product"}]';
var encoded = btoa(approve_item);
approve_button_wrapper.innerHTML = /*html*/`