window.TermsAndConditionsCheckbox = function(event) { if (event !== undefined) event.preventDefault(); if (document.getElementById('effectiveAppsAgreeCB') !== null) return; if (window.EFFECTIVE_APPS_TAC_FUNCTIONALITY === "1") { if (window.EFFECTIVE_APPS_CCP === undefined && 'False' === 'False') { jQuery('body').on('click', window.EFFECTIVE_APPS_JQUERY_CHECKOUT_BUTTON_SELECTORS, function(element) { window.EFFECTIVE_APPS_CCP = true; if (jQuery('#effectiveAppsAgreeCB').is(':checked')) { jQuery(this).submit(); } else { alert(window.EFFECTIVE_APPS_TAC_ALERT); if (element.target !== undefined) { clearLoadingStateFromElement(element.target); } else { clearLoadingStateFromElement(null); } return false; } }); } } let checkboxElement = document.createElement('p'); checkboxElement.innerHTML = ' '; jQuery(window.EFFECTIVE_APPS_JQUERY_CHECKOUT_BUTTON_SELECTORS).each( function( i, element ) { if (element !== undefined) { let style = element.getAttribute('style'); let insertionType = "regular"; if (element.classList.contains('qbk-hide-button')) { return true; } if (style !== null) { if (style.indexOf('display: none') > -1) { return true; } } if (element.getAttribute("type") === "hidden") { return true; } let coContainer = element.parentElement; if (window.TAC_THEME_NAME.indexOf('debut') > -1) { coContainer = element.parentElement.parentElement; } if (window.TAC_THEME_NAME.indexOf('express') > -1) { coContainer = element.parentElement.parentElement; checkboxElement.style.textAlign = "right"; } if (window.TAC_THEME_NAME.indexOf('grid') > -1) { if (element.getAttribute('class') !== null && element.getAttribute('class').indexOf("checkout-link") > -1) { return true; } coContainer = element.parentElement.parentElement; } if (window.TAC_THEME_NAME.indexOf('maker') > -1) { coContainer = element.parentElement.parentElement.parentElement; } if (window.TAC_THEME_NAME.indexOf('pacific') > -1) { coContainer = element.parentElement.parentElement; } if (window.TAC_THEME_NAME.indexOf('shapes') > -1) { coContainer = element.parentElement.parentElement; } if (window.TAC_THEME_NAME.indexOf('be yours') > -1) { coContainer = element.parentElement.parentElement; } if (window.TAC_THEME_NAME.indexOf('supps') > -1) { coContainer = element.parentElement.parentElement; } if (window.TAC_THEME_NAME.indexOf('beyond') > -1) { coContainer = element.parentElement.parentElement.parentElement; } if (window.TAC_THEME_NAME.indexOf('dawn') > -1 || window.TAC_THEME_NAME.indexOf('taste') > -1 || window.TAC_THEME_NAME.indexOf('studio') > -1 || window.TAC_THEME_NAME.indexOf('craft') > -1 || window.TAC_THEME_NAME.indexOf('crave') > -1 || window.TAC_THEME_NAME.indexOf('sense') > -1 || window.TAC_THEME_NAME.indexOf('ride') > -1) { coContainer = element.parentElement.parentElement; checkboxElement.style.textAlign = "right"; } if (window.TAC_THEME_NAME.indexOf('emerge') > -1) { coContainer = element.parentElement.parentElement.parentElement; } if (window.TAC_THEME_NAME.indexOf('blockshop') > -1) { coContainer = element.parentElement.parentElement.parentElement; } if ((window.TAC_THEME_NAME.indexOf('ella') > -1 && window.TAC_THEME_NAME.indexOf('shella') === -1) || window.TAC_THEME_NAME.indexOf('goodwin') > -1 || window.TAC_THEME_NAME.indexOf('jewel') > -1 || window.TAC_THEME_NAME.indexOf('shopbe') > -1 || window.TAC_THEME_NAME.indexOf('new look 2023') > -1 || window.TAC_THEME_NAME === 'boom') { checkboxElement.setAttribute('onclick', 'document.getElementById("effectiveAppsAgreeCB").checked = !document.getElementById("effectiveAppsAgreeCB").checked; termsAndConditionsCheckboxChanged(document.getElementById("effectiveAppsAgreeCB"))'); } if (window.TAC_THEME_NAME.indexOf('capital') > -1) { coContainer = element.parentElement.parentElement; } if (window.TAC_THEME_NAME.indexOf('boho dream') > -1) { coContainer = element.parentElement.parentElement; } if (window.TAC_THEME_NAME.indexOf('charlotte') > -1) { coContainer = element.parentElement.parentElement; } if (window.TAC_THEME_NAME.indexOf('lorenza') > -1) { coContainer = element.parentElement.parentElement; } if (window.TAC_THEME_NAME.indexOf('kingdom') > -1) { coContainer = element.parentElement.parentElement.parentElement; } if (window.TAC_THEME_NAME.indexOf('spark') > -1) { coContainer = element.parentElement.parentElement; } if (window.TAC_THEME_NAME.indexOf('kalles') > -1) { coContainer = element.parentElement.parentElement; } if (window.TAC_THEME_NAME.indexOf('vela framework') > -1) { coContainer = element.parentElement.parentElement; } if (window.TAC_THEME_NAME.indexOf('athens') > -1) { insertionType = "insertbeforecontainer"; } if (window.EFFECTIVE_APPS_TAC_FUNCTIONALITY === "1") { if (insertionType === "insertbeforecontainer") { coContainer.insertAdjacentElement('beforebegin', checkboxElement.cloneNode(true)); } else { coContainer.insertBefore(checkboxElement.cloneNode(true), coContainer.firstChild); } } else { if (document.getElementById('effectiveAppsAgreeCB') === null) { if (jQuery(window.EFFECTIVE_APPS_JQUERY_CHECKOUT_BUTTON_SELECTORS).length > 1) { if (i > 0) { if (insertionType === "insertbeforecontainer") { coContainer.insertAdjacentElement('beforebegin', checkboxElement.cloneNode(true)); } else { coContainer.insertBefore(checkboxElement.cloneNode(true), coContainer.firstChild); } } } else { if (insertionType === "insertbeforecontainer") { coContainer.insertAdjacentElement('beforebegin', checkboxElement.cloneNode(true)); } else { coContainer.insertBefore(checkboxElement.cloneNode(true), coContainer.firstChild); } } } TAC_cloneCheckoutButton(element); } } }); jQuery(this).unbind('click').submit(); try { if ('False' === 'True') { addTermsAndConditionsAgreementDateTimeToCart(); } else { disableAdditionalPaymentButtons(); } } catch (err) { } } function clearLoadingStateFromElement(elementToClear) { setTimeout(function() { try { if (elementToClear === null) { elementToClear = TAC_detectCheckoutButton(false); } if (elementToClear.classList.contains('btn--loading')) { elementToClear.classList.remove('btn--loading'); } if (elementToClear.hasAttribute('disabled')) { elementToClear.removeAttribute('disabled'); } if (elementToClear.hasAttribute('data-loading')) { elementToClear.removeAttribute('data-loading'); } } catch(err) { } }, 500); } function wrap(el, wrapper) { el.parentNode.insertBefore(wrapper, el); wrapper.appendChild(el); } function openTermsAndConditionsCheckboxBINModal() { window.EFFECTIVE_APPS_BIN_TAC_MODAL = new tingle.modal({ footer: true, stickyFooter: false, closeMethods: ['overlay', 'button', 'escape'], cssClass: ['effective-apps-tac-modal'], }); window.EFFECTIVE_APPS_BIN_TAC_MODAL.setContent("

" + window.EFFECTIVE_APPS_TAC_ALERT + "

" + '

 

'); window.EFFECTIVE_APPS_BIN_TAC_MODAL.open(); if ((window.TAC_THEME_NAME.indexOf('ella') > -1 && window.TAC_THEME_NAME.indexOf('shella') === -1) || window.TAC_THEME_NAME.indexOf('goodwin') > -1 || window.TAC_THEME_NAME.indexOf('jewel') > -1 || window.TAC_THEME_NAME.indexOf('shopbe') > -1 || window.TAC_THEME_NAME.indexOf('new look 2023') > -1) { document.getElementById("effectiveAppsAgreeCBModal").parentElement.setAttribute('onclick', 'document.getElementById("effectiveAppsAgreeCBModal").checked = !document.getElementById("effectiveAppsAgreeCBModal").checked; termsAndConditionsCheckboxChanged(document.getElementById("effectiveAppsAgreeCBModal"), true);'); } } function handleBuyItNowButton() { if ('False' === 'False') { try { var buyItNowButtonContainer = document.querySelector('[class*="shopify-payment-button"]'); if (buyItNowButtonContainer === null) { return; } var buyInNowAWrapper = document.createElement('a'); buyInNowAWrapper.id = 'effectiveAppsBINWrapper'; buyInNowAWrapper.style.textDecoration = 'none'; buyInNowAWrapper.href = 'javascript:openTermsAndConditionsCheckboxBINModal();'; wrap(buyItNowButtonContainer, buyInNowAWrapper); buyItNowButtonContainer.firstChild.setAttribute('style', 'pointer-events: none'); } catch (err) { } } } function unHandleBuyItNowButton() { try { var buyInNowAWrapper = document.getElementById('effectiveAppsBINWrapper'); buyInNowAWrapper.removeAttribute('href'); var buyItNowButtonContainer = document.querySelector('[class="shopify-payment-button"]'); buyItNowButtonContainer.firstChild.setAttribute('style', 'pointer-events: auto'); } catch (err) { } } function TAC_handleiCartCheckoutButton(iCartCheckoutButtonElement) { var iCartCheckoutButtonElementWrapper = document.createElement('div'); iCartCheckoutButtonElementWrapper.style.cursor = 'pointer'; iCartCheckoutButtonElement.style.pointerEvents = 'none'; iCartCheckoutButtonElementWrapper.setAttribute('onclick', 'if (!document.getElementById("effectiveAppsAgreeCB").checked && \'False\' === \'False\') { alert(window.EFFECTIVE_APPS_TAC_ALERT); clearLoadingStateFromElement(this); return false;} document.querySelector(\'[name="icartCheckout"]\').style.pointerEvents = \'auto\'; document.querySelector(\'[name="icartCheckout"]\').click(); return true;'); wrap(iCartCheckoutButtonElement, iCartCheckoutButtonElementWrapper); } function TAC_attachToCartDrawer() { if (document.getElementById('effectiveAppsAgreeCB') !== null) { return; } let insertionType = "insertbefore"; let checkboxElement = document.createElement('p'); checkboxElement.innerHTML = ' '; var checkoutButtonElement = TAC_detectCheckoutButton(); if ('False' === 'False' && window.EFFECTIVE_APPS_TAC_FUNCTIONALITY === "1") { checkoutButtonElement.setAttribute('onclick', "if (!document.getElementById('effectiveAppsAgreeCB').checked) { alert(window.EFFECTIVE_APPS_TAC_ALERT); clearLoadingStateFromElement(this); return false;} return true;"); } if (null === checkoutButtonElement) { return; } let elementContainer = checkoutButtonElement.parentElement; if (window.TAC_THEME_NAME.indexOf('blockshop') > -1) { elementContainer = checkoutButtonElement.parentElement.parentElement.parentElement; } if ((window.TAC_THEME_NAME.indexOf('ella') > -1 && window.TAC_THEME_NAME.indexOf('shella') === -1) || window.TAC_THEME_NAME.indexOf('goodwin') > -1 || window.TAC_THEME_NAME.indexOf('jewel') > -1 || window.TAC_THEME_NAME.indexOf('shopbe') > -1 || window.TAC_THEME_NAME.indexOf('new look 2023') > -1) { checkboxElement.setAttribute('onclick', 'document.getElementById("effectiveAppsAgreeCB").checked = !document.getElementById("effectiveAppsAgreeCB").checked; termsAndConditionsCheckboxChanged(document.getElementById("effectiveAppsAgreeCB"))'); } if (window.TAC_THEME_NAME.indexOf('dawn') > -1 || window.TAC_THEME_NAME.indexOf('taste') > -1 || window.TAC_THEME_NAME.indexOf('studio') > -1 || window.TAC_THEME_NAME.indexOf('craft') > -1 || window.TAC_THEME_NAME.indexOf('crave') > -1 || window.TAC_THEME_NAME.indexOf('sense') > -1 || window.TAC_THEME_NAME.indexOf('ride') > -1) { elementContainer = checkoutButtonElement.parentElement.parentElement; } if (window.TAC_THEME_NAME.indexOf('maker') > -1) { elementContainer = checkoutButtonElement.parentElement.parentElement.parentElement; checkboxElement.style.textAlign = 'center'; } if (window.TAC_THEME_NAME.indexOf('emerge') > -1) { elementContainer = checkoutButtonElement.parentElement.parentElement; checkboxElement.style.width = '100%'; } if (window.TAC_THEME_NAME.indexOf('empire') > -1) { insertionType = "insertbeforeparent2"; } if (window.TAC_THEME_NAME.indexOf('shapes') > -1) { insertionType = "insertbeforeparent2"; } if (checkoutButtonElement.getAttribute('name') === 'icartCheckout') { insertionType = "insertbeforeparent2"; TAC_handleiCartCheckoutButton(checkoutButtonElement); } if (window.TAC_THEME_NAME.indexOf('ella') > -1 && window.TAC_THEME_NAME.indexOf('shella') === -1) { insertionType = "insertbeforeparent1"; } if (window.TAC_THEME_NAME.indexOf('athens') > -1) { insertionType = "insertbeforeparent1"; } if (window.TAC_THEME_NAME.indexOf('north') > -1) { insertionType = "insertbeforeparent1"; } if (window.TAC_THEME_NAME.indexOf('grid') > -1) { checkboxElement.setAttribute('class', 'cart-subtotal'); checkboxElement.setAttribute('style', 'margin: 0 30px;'); insertionType = "insertbeforeparent1"; } if (window.TAC_THEME_NAME.indexOf('be yours') > -1) { insertionType = "insertbeforeparent1"; elementContainer = checkoutButtonElement.parentElement.parentElement; } if (window.TAC_THEME_NAME.indexOf('venue') > -1) { insertionType = "insertbeforeparent2"; } if (window.TAC_THEME_NAME.indexOf('parallax') > -1) { insertionType = "insertbeforeparent1"; } if (window.TAC_THEME_NAME.indexOf('crave') > -1) { elementContainer = checkoutButtonElement.parentElement.parentElement; } if (window.TAC_THEME_NAME.indexOf('mojave') > -1) { insertionType = "insertbeforeparent3"; } if (window.TAC_THEME_NAME.indexOf('atlantic') > -1) { insertionType = "insertbeforeparent2"; } if (window.TAC_THEME_NAME.indexOf('impact') > -1) { insertionType = "insertbeforeparent1"; } if (window.TAC_THEME_NAME.indexOf('beyond') > -1) { insertionType = "insertbeforeparent2"; } if (checkoutButtonElement.classList.contains("upcart-checkout-button") && document.querySelector('[class*="styles_Footer__checkoutButton"]') !== null) { insertionType = "insertbeforeparent2"; } if (window.TAC_THEME_NAME.indexOf('supply') > -1) { checkboxElement.style.position = 'relative'; checkboxElement.style.marginBottom = '-1%'; } else if (window.TAC_THEME_NAME.indexOf('brooklyn') > -1) { checkboxElement.style.position = 'absolute'; checkboxElement.style.marginBottom = '-25%'; checkboxElement.style.top = '-20%'; } else if (window.TAC_THEME_NAME.indexOf('boundless') > -1) { checkboxElement.style.position = 'absolute'; checkboxElement.style.marginBottom = '-13%'; checkboxElement.style.top = '-25%'; } else if (window.TAC_THEME_NAME.indexOf('debutify') > -1) { checkboxElement.style.position = 'absolute'; checkboxElement.style.marginBottom = '-13%'; checkboxElement.style.top = '-25%'; } else if (window.TAC_THEME_NAME.indexOf('barberry') > -1) { elementContainer = checkoutButtonElement.parentElement.parentElement; } else if (window.TAC_THEME_NAME.indexOf('warehouse') > -1) { elementContainer = checkoutButtonElement.parentElement.parentElement; } else if (window.TAC_THEME_NAME.indexOf('showtime') > -1) { insertionType = "insertbeforeparent1"; } if (insertionType === "insertbeforeparent1") { checkoutButtonElement.parentElement.insertAdjacentElement('beforebegin', checkboxElement.cloneNode(true)); } else if (insertionType === "insertbeforeparent2") { checkoutButtonElement.parentElement.parentElement.insertAdjacentElement('beforebegin', checkboxElement.cloneNode(true)); } else if (insertionType === "insertbeforeparent3") { checkoutButtonElement.parentElement.parentElement.parentElement.insertAdjacentElement('beforebegin', checkboxElement.cloneNode(true)); } else { elementContainer.insertBefore(checkboxElement.cloneNode(true), elementContainer.firstChild); } if (window.EFFECTIVE_APPS_TAC_FUNCTIONALITY === "2") { TAC_cloneCheckoutButton(checkoutButtonElement); } try { if ('False' === 'True') { addTermsAndConditionsAgreementDateTimeToCart(); } else { disableAdditionalPaymentButtons(); } } catch (err) { } } function TAC_cloneCheckoutButton(checkoutButtonElement) { var clonedCheckoutButton = checkoutButtonElement.cloneNode(true); var originalCheckoutButtonWrapper = document.createElement('span'); originalCheckoutButtonWrapper.style.display = "none"; originalCheckoutButtonWrapper.style.width = "0"; originalCheckoutButtonWrapper.style.height = "0"; checkoutButtonElement.setAttribute("tac-co-original", "true"); clonedCheckoutButton.setAttribute("type", "button"); clonedCheckoutButton.style.cursor = "pointer"; clonedCheckoutButton.removeAttribute("name"); clonedCheckoutButton.removeAttribute("id"); clonedCheckoutButton.removeAttribute("href"); clonedCheckoutButton.removeAttribute("data-checkout-button"); clonedCheckoutButton.removeAttribute("data-ocu-checkout"); clonedCheckoutButton.removeAttribute("disabled"); clonedCheckoutButton.setAttribute("tac-co-cloned", "true"); clonedCheckoutButton.setAttribute("onclick", "if (!document.getElementById('effectiveAppsAgreeCB').checked && 'False' === 'False') { alert(window.EFFECTIVE_APPS_TAC_ALERT); clearLoadingStateFromElement(this); return false;} if (document.getElementById('depo-checkout') !== null) { document.getElementById('depo-checkout').click(); } else if (document.querySelector('[name=waio_addToCart]') !== null) { document.querySelector('[name=waio_addToCart]').click(); } else { document.querySelector('[tac-co-original=\"true\"]').click(); } return true;"); checkoutButtonElement.insertAdjacentElement('beforebegin', clonedCheckoutButton); wrap(checkoutButtonElement, originalCheckoutButtonWrapper); } function TAC_detectCheckoutButton(ignoreDisabled=true) { var resultElement = null; var disabledCssSelector = ':not([disabled])'; var additionalThemeCss = ""; if (window.TAC_THEME_NAME.indexOf('grid') > -1) { additionalThemeCss = ':not([class*="checkout-link"])'; } if (ignoreDisabled === false) { disabledCssSelector = ''; } var checkoutButtonSelectors = [ '[tac-co-override="true"]', '*[class*="fs-checkout-btn-custom"]' + disabledCssSelector, '*[class*="ymq-fake-checkout-btn"]' + disabledCssSelector, '*[class*="upcart-checkout-button"]' + disabledCssSelector, '*[name="icartCheckout"]' + disabledCssSelector, '*[name="checkout"]' + disabledCssSelector, '*[name="goto_pp"]' + disabledCssSelector, '*[name="goto_gc"]' + disabledCssSelector, '*[data-mc="checkout"]' + disabledCssSelector, '*[value*="Checkout"]', '*[value*="Check out"]', '*[href*="/checkout"]:not([href*="front_end/login"]):not([href*="/manage/subscription/"]):not([href*="/admin/settings/checkout"]):not([href*="checkout-sandbox"]):not(link)' + additionalThemeCss, '*[onclick*="/checkout"]', '*[name="checkout-exemptify"]' + disabledCssSelector, '*[id="checkout"]' + disabledCssSelector, '*[id="unifyCheckout"]' + disabledCssSelector, '*[data-cart-checkout-button]', '*[class*="cart-button-checkout"]', '*[class*="Cart__Checkout"]', '*[class*="cart__checkout"]', '*[class*="checkout__fbtn"]', '*[name="ddcheckout"]' + disabledCssSelector, '*[class*="btnCheckout"]' + disabledCssSelector, '*[id="mu-checkout-button"]' + disabledCssSelector, '*[name="tac-checkout"]' + disabledCssSelector, '*[class*="rebuy-cart__checkout-button"]' + disabledCssSelector, '*[class*="satcb-cs-checkout-btn"]', '*[class*="evm_upsell_checkout"]', '*[class*="widget__checkout"]', '*[name="qbk-checkout"]', '*[id="cart-checkout"]' + disabledCssSelector, '*[class*="cart-checkout-button"]:not([class="cart-checkout-buttons-wrapper"]):not([class*="cart-checkout-buttons p-"]):not(div)' + disabledCssSelector, '*[data-layout="checkout"]' + disabledCssSelector ]; var cartFormSelectors = [ 'input[type="submit"]:not([disabled])', 'input[type="button"]:not([disabled])' ]; for (var selector of checkoutButtonSelectors) { var elementSearchResult = document.querySelectorAll(selector); if (elementSearchResult.length > 1 && (window.TAC_THEME_NAME.indexOf('dawn') === -1 && window.TAC_THEME_NAME.indexOf('moodring') === -1 && window.TAC_THEME_NAME.indexOf('turbo') === -1 && window.TAC_THEME_NAME.indexOf('empire') === -1 && window.TAC_THEME_NAME.indexOf('showtime') === -1 && selector !== '*[class*="ymq-fake-checkout-btn"]:not([disabled])')) { if (elementSearchResult[1].getAttribute('tac-ignore') === "true") { continue; } return elementSearchResult[1]; } else if (elementSearchResult.length === 2 && window.TAC_THEME_NAME.indexOf('turbo') > -1) { if (elementSearchResult[0].getAttribute('tac-ignore') === "true") { continue; } return elementSearchResult[0]; } else if (elementSearchResult.length === 3 && window.TAC_THEME_NAME.indexOf('turbo') > -1) { if (elementSearchResult[2].getAttribute('tac-ignore') === "true") { continue; } return elementSearchResult[2]; } else if (elementSearchResult.length > 0) { if (elementSearchResult[0].getAttribute('tac-ignore') === "true") { continue; } return elementSearchResult[0]; } } var cartFormElement = document.querySelector('form[action="/cart"]'); if (cartFormElement !== null) { for (var selector of cartFormSelectors) { var element = cartFormElement.querySelector(selector); if (element !== null) { return element; } } } return null; } function TAC_waitForCartDrawer() { if (document.getElementById('effectiveAppsAgreeCB') !== null) { return; } var checkoutButtonElement = TAC_detectCheckoutButton(); if (checkoutButtonElement === null) { return; } if (TAC_isElementVisible(checkoutButtonElement) === true) { if (window.effectiveAppsTacSp.length > 0) { jQuery.getJSON('/cart.js').done(function(data) { for (var item of data['items']) { if (window.effectiveAppsTacAllowedProducts.indexOf(item["product_id"].toString()) > -1) { TAC_attachToCartDrawer(); break; } } }); } else { TAC_attachToCartDrawer(); } } } function TAC_isElementVisible(element) { if (element.getAttribute('tac-override') === 'true') { return true; } if (element.offsetWidth === 0 || element.offsetHeight === 0) { return false; } var height = document.documentElement.clientHeight, rects = element.getClientRects(), on_top = function (r) { var x = (r.left + r.right) / 2, y = (r.top + r.bottom) / 2; return (document.elementFromPoint(x, y) === element) || (document.elementFromPoint(x, y) !== null && document.elementFromPoint(x, y).parentElement === element); }; for (var i = 0, l = rects.length; i < l; i++) { var r = rects[i], in_viewport = r.top > 0 ? r.top <= height : (r.bottom > 0 && r.bottom <= height); if (in_viewport && on_top(r)) return true; } return false; } function addTermsAndConditionsAgreementDateTimeToCart() { if (window.EFFECTIVE_APPS_TAC_ORDER_CONSENT_ATTRIBUTE.length < 1) { return; } var nowTime = new Date(); jQuery.post('/cart/update.js', "attributes[" + window.EFFECTIVE_APPS_TAC_ORDER_CONSENT_ATTRIBUTE + "]=" + nowTime).always(function() { var isAdded = false; jQuery.getJSON('/cart.js').done(function(data) { for (var attribute in data['attributes']) { if (attribute === window.EFFECTIVE_APPS_TAC_ORDER_CONSENT_ATTRIBUTE) { isAdded = true; } } if (isAdded === false) { addTermsAndConditionsAgreementDateTimeToCart(); } }); }); } function removeTermsAndConditionsAgreementDateTimeFromCart() { if (window.EFFECTIVE_APPS_TAC_ORDER_CONSENT_ATTRIBUTE.length < 1) { return; } jQuery.post('/cart/update.js', "attributes[" + window.EFFECTIVE_APPS_TAC_ORDER_CONSENT_ATTRIBUTE + "]=null").always(function() { var isRemoved = false; jQuery.getJSON('/cart.js').done(function(data) { for (var attribute in data['attributes']) { if (attribute === window.EFFECTIVE_APPS_TAC_ORDER_CONSENT_ATTRIBUTE) { if (data['attributes'][attribute] === 'null') { isRemoved = true; } } } if (isRemoved === false) { removeTermsAndConditionsAgreementDateTimeFromCart(); } }); }); } function termsAndConditionsCheckboxChanged(targetElement, isFromModal = false) { try { if (targetElement.checked) { addTermsAndConditionsAgreementDateTimeToCart(); if (isFromModal === false) { enableAdditionalPaymentButtons(); } } else { removeTermsAndConditionsAgreementDateTimeFromCart(); if (isFromModal === false) { disableAdditionalPaymentButtons(); } } } catch(err) { } if (isFromModal === false) { if (jQuery('*[id="effectiveAppsAgreeCB"]').length > 1) { jQuery('*[id="effectiveAppsAgreeCB"]').prop( "checked", (targetElement.checked) ); } } if (isFromModal === true) { unHandleBuyItNowButton(); window.EFFECTIVE_APPS_BIN_TAC_MODAL.close(); try { if (document.querySelector('[class*="shopify-payment-button"]').querySelector('[role="button"]') !== null) { document.querySelector('[class*="shopify-payment-button"]').querySelector('[role="button"]').click(); } else if (document.querySelector('[class*="shopify-payment-button"]').querySelector('[type="button"]') !== null) { document.querySelector('[class*="shopify-payment-button"]').querySelector('[type="button"]').click(); } } catch (err) { } } } function TAC_spLogic() { if (window.location.href.indexOf("/cart") > -1 && window.location.href.indexOf("/products/") === -1 && window.location.href.indexOf("/collections/") === -1) { if (window.effectiveAppsTacSp.length > 0) { jQuery.getJSON('/cart.js').done(function(data) { for (var item of data['items']) { if (window.effectiveAppsTacAllowedProducts.indexOf(item["product_id"].toString()) > -1) { window.TermsAndConditionsCheckbox(); break; } } }); } else { window.TermsAndConditionsCheckbox(); } } else { if ('1' === '1') { try { if (window.effectiveAppsTacSp.length > 0) { if (window.effectiveAppsTacAllowedProducts.indexOf(ShopifyAnalytics.meta.product.id.toString()) > -1) { setTimeout(function() { handleBuyItNowButton(); }, 500); } } else { setTimeout(function() { handleBuyItNowButton(); }, 500); } } catch(err) { } } window.EFFECTIVE_APPS_TAC_CART_LISTENER = setInterval(TAC_waitForCartDrawer, 500); } } function detectNewsletterElements() { let resultElements = []; let accountButtonsSelectors = [ '[tac-nl-override="true"]', '[name="commit"]:not([class*="password"])', '[id="subscribe"]', '[name="subscribe"]', '[name="contact[email]"]' ]; for (let selector of accountButtonsSelectors) { let elementSearchResults = document.querySelectorAll(selector); for (let elementSearchResult of elementSearchResults) { if (elementSearchResult.getAttribute('tac-nl-ignore') === "true" || elementSearchResult.getAttribute('tac-nl-detected') === "true") { continue; } if (selector === '[name="contact[email]"]') { const closestForm = elementSearchResult.closest('form'); const submitButton = closestForm?.querySelector('[type="submit"]'); const actionAttribute = closestForm?.getAttribute('action'); const classAttribute = closestForm?.getAttribute('class'); if (closestForm !== null && submitButton !== null && submitButton.getAttribute('tac-nl-detected') !== 'true' && submitButton.getAttribute('tac-nl-ignore') !== 'true') { if (actionAttribute !== null && actionAttribute.includes('contact')) { if (actionAttribute.includes('newsletter') || (classAttribute !== null && classAttribute.includes('newsletter')) || closestForm.innerHTML.includes('newsletter')) { submitButton.setAttribute('tac-nl-detected', 'true'); resultElements.push(submitButton); } } else { submitButton.setAttribute('tac-nl-detected', 'true'); resultElements.push(submitButton); } } } else { elementSearchResult.setAttribute('tac-nl-detected', 'true'); resultElements.push(elementSearchResult); } } } return resultElements; } function attachToNewsletter() { if ('2' === '2') { return; } let checkboxElement = document.createElement('div'); let newsletterSubmitButtons = detectNewsletterElements(); let counter = 1; for (let newsletterSubmitButton of newsletterSubmitButtons) { let cbContainer = newsletterSubmitButton.parentElement; checkboxElement.id = "effectiveAppsAgreeCBNewsletterContainer_" + counter.toString(); checkboxElement.innerHTML = ''; const secondParentThemes = ["narrative", "minimal", "brooklyn", "venture", "simple", "supply", "debut"]; const thirdParentThemes = ["impact"]; if (secondParentThemes.some(theme => window.TAC_THEME_NAME.indexOf(theme) > -1)) { cbContainer = newsletterSubmitButton.parentElement.parentElement; } if (thirdParentThemes.some(theme => window.TAC_THEME_NAME.indexOf(theme) > -1)) { cbContainer = newsletterSubmitButton.parentElement.parentElement.parentElement; } cbContainer.insertAdjacentElement('beforebegin', checkboxElement); newsletterSubmitButton.setAttribute("onclick", "if (!document.getElementById('effectiveAppsAgreeCBNewsletter_" + counter.toString() + "').checked && 'False' === 'False') { alert(window.EFFECTIVE_APPS_TAC_ALERT); clearLoadingStateFromElement(this); return false;} return true;"); counter++; } } function detectAccountButton() { var resultElement = null; var accountButtonsSelectors = [ '[tac-rl-override="true"]', '[class*="Form__Submit Button Button--primary"]', '[class*="form__submit button"]', '[action*="/account/login"] button', '[action*="/account"] [type="submit"]', '[action*="/account"] button', '[class*="cf-submit-form"]', '[class*="form-action--submit"]' ]; for (var selector of accountButtonsSelectors) { var elementSearchResult = document.querySelector(selector); if (elementSearchResult === null) { continue; } if (elementSearchResult.getAttribute('tac-rl-ignore') === "true") { continue; } return elementSearchResult; } return null; } function attachToAccountPage() { var checkboxElement = document.createElement('div'); var accountButton = detectAccountButton(); var cbContainer = accountButton; if (accountButton === null || document.getElementById('effectiveAppsAgreeCBAccountContainer') !== null) { return; } checkboxElement.id = "effectiveAppsAgreeCBAccountContainer"; checkboxElement.innerHTML = ''; if (window.TAC_THEME_NAME.indexOf("simple") > -1) { cbContainer = accountButton.parentElement; } else if (window.TAC_THEME_NAME.indexOf("broadcast") > -1) { cbContainer = accountButton.parentElement; } else if (window.TAC_THEME_NAME.indexOf("expression") > -1) { cbContainer = accountButton.parentElement; } else if (window.TAC_THEME_NAME.indexOf("emerge") > -1) { cbContainer = accountButton.parentElement.parentElement; } else if (window.TAC_THEME_NAME.indexOf("express") > -1) { checkboxElement.style.width = "100%"; } else if (window.TAC_THEME_NAME.indexOf("empire") > -1) { cbContainer = accountButton.parentElement; } else if (['dawn', 'sense', 'crave', 'craft', 'studio', 'taste', 'ride'].indexOf(window.TAC_THEME_NAME) > -1) { jQuery('head').append(''); } cbContainer.insertAdjacentElement('beforebegin', checkboxElement); accountButton.setAttribute("onclick", "if (!document.getElementById('effectiveAppsAgreeCBAccount').checked && 'False' === 'False') { alert(window.EFFECTIVE_APPS_TAC_ALERT); clearLoadingStateFromElement(this); return false;} return true;"); } function TAC_mainLoader() { window.TAC_THEME_NAME = TAC_getShopifyThemeName(); if ('0' !== '0') { setTimeout(TAC_main, parseInt('0')); } else if (window.TAC_THEME_NAME.indexOf('prestige') > -1 || window.TAC_THEME_NAME.indexOf('fashionopolism') > -1 || window.TAC_THEME_NAME.indexOf('mr parker') > -1 || window.TAC_THEME_NAME.indexOf('testament') > -1) { setTimeout(TAC_main, 1200); } else { TAC_main(); } } function TAC_main() { console.log('%c------ Terms and Conditions Checkbox by Effective Apps is Initializing ------', 'color: cyan'); console.log('%c------ Contact us at support@effectify.co for help and questions about the app ------', 'color: cyan'); window.EFFECTIVE_APPS_JQUERY_CHECKOUT_BUTTON_SELECTORS = '[tac-co-override="true"], [name="checkout"], [name="goto_pp"], [name="goto_gc"], [href="/checkout"], [value="Checkout"], [value="Check out"], [onclick*="/checkout"], [name="checkout-exemptify"], [id="checkout"], [data-cart-checkout-button], [class*="cart-button-checkout"], [class*="Cart__Checkout"], *[class*="checkout__fbtn"], [name="ddcheckout"], [class*="btnCheckout"], [id="mu-checkout-button"], [name="tac-checkout"], [class*="rebuy-cart__checkout-button"], [class*="ymq-fake-checkout-btn"], [class*="upcart-checkout-button"], [class*="satcb-cs-checkout-btn"], [class*="evm_upsell_checkout"], [name="qbk-checkout"], [href*="/checkout"]:not(link), [class*="fs-checkout-btn"], [id="cart-checkout"], [class*="cart-checkout-button"]:not([class="cart-checkout-buttons-wrapper"]):not([class*="cart-checkout-buttons p-"]):not(div), [data-layout="checkout"], [data-mc="checkout"], [id="unifyCheckout"], [class*="ymp_check_mainBtn"], [class*="widget__checkout"], [class*="fs-checkout-btn-custom"]'; window.EFFECTIVE_APPS_TAC_FUNCTIONALITY = window.EFFECTIVE_APPS_TAC_FUNCTIONALITY_OVERRIDE === undefined ? "1" : window.EFFECTIVE_APPS_TAC_FUNCTIONALITY_OVERRIDE; window.EFFECTIVE_APPS_TAC_ORDER_CONSENT_ATTRIBUTE = `Agreed to the Terms and Conditions on`; window.EFFECTIVE_APPS_TAC_TEXT = `He leído y estoy de acuerdo con la política de envíos (Leer aquí).`; window.EFFECTIVE_APPS_TAC_ALERT = `Impuestos incluidos. Finalizada la compra un asesor se contactará para calcular el valor del envío. Tiempos de Entrega según destino: Madera y Tapizados de 20 a 70 días, Descanso de 5 a 20 días, Ferrara de 17 a 27 días.`; window.CUSTOM_CSS = ``; if (window.EFFECTIVE_APPS_TAC_FUNCTIONALITY_OVERRIDE === undefined && (window.TAC_THEME_NAME.indexOf('grid') > -1 || window.TAC_THEME_NAME.indexOf('tailor') > -1 || window.TAC_THEME_NAME.indexOf('blue night') > -1 || window.TAC_THEME_NAME.indexOf('kagami') > -1 || window.TAC_THEME_NAME.indexOf('testament') > -1 || window.TAC_THEME_NAME.indexOf('athens') > -1 || window.TAC_THEME_NAME.indexOf('fashionopolism') > -1 || window.TAC_THEME_NAME.indexOf('maker') > -1 || window.TAC_THEME_NAME.indexOf('mr parker') > -1 || window.TAC_THEME_NAME.indexOf('blockshop') > -1 || window.TAC_THEME_NAME.indexOf('icon') > -1 || window.TAC_THEME_NAME.indexOf('shapes') > -1 || window.TAC_THEME_NAME.indexOf('avone') > -1 || window.TAC_THEME_NAME.indexOf('vinova vapas') > -1 || window.TAC_THEME_NAME.indexOf('testament') > -1 || document.getElementById("icartCommonScriptJs") !== null || (location.pathname.indexOf('/cart') > -1 && document.querySelector('[class*="styles_Footer__checkoutButton"]') !== null) || (location.pathname.indexOf('/cart') > -1 && document.querySelector('[class*="qbk-hide-button"]') !== null))) { window.EFFECTIVE_APPS_TAC_FUNCTIONALITY = "1"; } if (window.CUSTOM_CSS.length > 0) { jQuery('head').append(''); } if (window.TAC_SCRIPT_INJECTED === undefined) { window.TAC_SCRIPT_INJECTED = true; try { if (document.getElementById('satcb_sticky_cart') !== null) { document.getElementById('satcb_sticky_cart').children[0].setAttribute('tac-ignore', 'true'); } } catch(err) { } window.effectiveAppsTacSp = ''; window.effectiveAppsTacAllowedProducts = window.effectiveAppsTacSp.split(','); var tacCountriesStr = ''; if (tacCountriesStr !== '') { var tacCountries = tacCountriesStr.split(','); TAC_getGeolocationCountry(function(resultCountry) { if (tacCountries.indexOf(resultCountry) > -1) { TAC_spLogic(); TAC_accountPageLogic(); attachToNewsletter(); } }); } else { TAC_spLogic(); TAC_accountPageLogic(); attachToNewsletter(); } } } function TAC_accountPageLogic() { if (['2','4'].indexOf('1') > -1 && location.pathname.indexOf('/account/register') > -1) { attachToAccountPage(); } else if (['3','4'].indexOf('1') > -1 && location.pathname.indexOf('/account/login') > -1) { attachToAccountPage(); } } function TAC_loadjQuery(url, success){ var script = document.createElement('script'); script.src = url; var head = document.getElementsByTagName('head')[0], done = false; head.appendChild(script); script.onload = script.onreadystatechange = function() { if (!done && (!this.readyState || this.readyState == 'loaded' || this.readyState == 'complete')) { done = true; success(); script.onload = script.onreadystatechange = null; head.removeChild(script); } }; } function disableAdditionalPaymentButtons() { if ('False' === 'False') { if (document.getElementById('dynamic-checkout-cart') !== null) { document.getElementById('dynamic-checkout-cart').setAttribute("style", "pointer-events: none"); jQuery("[class=additional-checkout-buttons], [class=additional_checkout_buttons], [class=cart__additional_checkout], [class*=additional]").bind("click", additionalPaymentButtonsClick); } } } function enableAdditionalPaymentButtons() { if (document.getElementById('dynamic-checkout-cart') !== null) { document.getElementById('dynamic-checkout-cart').setAttribute("style", "pointer-events: auto"); jQuery("[class=additional-checkout-buttons], [class=additional_checkout_buttons], [class=cart__additional_checkout], [class*=additional]").unbind("click", additionalPaymentButtonsClick); } } function additionalPaymentButtonsClick() { if (false === jQuery('#effectiveAppsAgreeCB').is(':checked')) { alert(window.EFFECTIVE_APPS_TAC_ALERT); return false; } } function TAC_getGeolocationCountry(callback) { jQuery.getJSON('https://get.geojs.io/v1/ip/geo.json', function(result) { callback(result.country_code); }); } function TAC_getShopifyThemeName() { try { if (window.TAC_THEME_NAME_OVERRIDE !== undefined) { return window.TAC_THEME_NAME_OVERRIDE; } else if (window.BOOMR !== undefined && window.BOOMR.themeName !== undefined && window.BOOMR.themeName.length > 0) { return window.BOOMR.themeName.toLowerCase(); } else { return Shopify.theme.name.toLowerCase(); } } catch (err) { return ""; } } function TAC_openPopup(url) { var w = 600; var h = 850; var left = (screen.width/2)-(w/2); var top = (screen.height/2)-(h/2); return window.open(url, "", 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width='+w+', height='+h+', top='+top+', left='+left); } if (typeof jQuery === 'undefined') { TAC_loadjQuery('https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js', function () { jQuery('head').append(''); TAC_loadjQuery("https://cdnjs.cloudflare.com/ajax/libs/tingle/0.15.1/tingle.min.js", TAC_mainLoader); }); } else { TAC_loadjQuery('https://cdnjs.cloudflare.com/ajax/libs/tingle/0.15.1/tingle.min.js', function () { jQuery('head').append(''); TAC_mainLoader(); }); } var _0x2245f3 = termsAndConditionsCheckboxChanged; var _0x2277f3 = clearLoadingStateFromElement; var _0x113d2f = openTermsAndConditionsCheckboxBINModal;