function colorChooserRedirect(colorCode) {
const currentUrl = window.location;
const currentUrlParams = new URLSearchParams(window.location.search);
currentUrlParams.set('extColorCode', colorCode);
window.location = currentUrl.origin + currentUrl.pathname + '?' + currentUrlParams.toString();
}
document.addEventListener("DOMContentLoaded", () => {
const chooserItem = document.querySelectorAll('[data-color-chooser-redirect="true"] [data-color-chooser-item]');
chooserItem.forEach(item => {
item.addEventListener('click', e => {
e.preventDefault();
colorChooserRedirect(item.dataset.colorChooserCode);
})
});
});