Files
wyczarujprezent.pl/modules/zakeke/views/js/ps16/product-page-force.js
2024-10-28 22:14:22 +01:00

37 lines
1.1 KiB
JavaScript

/**
* Copyright (C) 2020 Futurenext srl
*
* This file is part of Zakeke.
*
* Zakeke Interactive Product Designer can not be copied and/or distributed
* without the express permission of Futurenext srl
*
* @author Futurenext srl <help@zakeke.com>
* @copyright 2019 Futurenext srl
* @license https://www.zakeke.com/privacy/#general_conditions
*/
function zakekeProductPage () {
const addToCartForm = document.getElementById('buy_block');
const addToCartButton = document.querySelector('#add_to_cart > button, #add_to_cart > input[type=submit], #add_to_cart');
if (addToCartButton) {
addToCartButton.addEventListener('click', e => {
e.stopImmediatePropagation();
addToCartForm.action = window.zakekeAddUrl;
addToCartForm.submit();
}, true);
if (window.$) {
$(addToCartButton).unbind('click');
}
const buttonText = addToCartButton.querySelector('span');
if (buttonText) {
buttonText.textContent = window.zakekeCustomizeLabel;
}
}
}
document.addEventListener('DOMContentLoaded', zakekeProductPage);