}
function neutralizeButton(btn) {
if (btn.dataset.pwIntercepted === 'true') return;
btn.dataset.pwIntercepted = 'true';
/* Clone replaces the element, wiping all of Wix's event listeners */
var clone = btn.cloneNode(true);
clone.dataset.pwIntercepted = 'true';
clone.addEventListener('click', function (e) {
e.preventDefault();
e.stopImmediatePropagation();
window.location.href = REDIRECT_URL;
}, true);
btn.parentNode.replaceChild(clone, btn);
console.log('Password reset button neutralized:', clone.getAttribute('data-hook'));
}
function scanAndNeutralize() {
document.querySelectorAll('button').forEach(function (btn) {
if (isPasswordResetButton(btn)) neutralizeButton(btn);
});
}
/* Run on every DOM change so it catches dynamically rendered modals */
new MutationObserver(scanAndNeutralize)
.observe(document.documentElement, { childList: true, subtree: true });
/* Also intercept clicks at capture phase as a safety net */
document.addEventListener('click', function (e) {
var el = e.target;
while (el && el !== document.body) {
if (isPasswordResetButton(el)) {
e.preventDefault();
e.stopImmediatePropagation();
window.location.href = REDIRECT_URL;
return;
}
el = el.parentElement;
}
}, true);
/* ─── PHONE FIELD PATCH ─── */
function patchPhoneField() {
var phoneInput = document.querySelector(
'input[data-hook="MyAccount-textField"][type="tel"][maxlength="120"][data-theme="box"]'
);
if (!phoneInput || phoneInput.dataset.phonePatchApplied === 'true') return;
phoneInput.dataset.phonePatchApplied = 'true';
phoneInput.setAttribute('disabled', 'true');
phoneInput.setAttribute('readonly', 'true');
phoneInput.style.opacity = '0.55';
phoneInput.style.cursor = 'not-allowed';
phoneInput.style.pointerEvents = 'none';
var btn = document.createElement('button');
btn.type = 'button';
btn.setAttribute('aria-label', 'Change phone number');
btn.innerHTML =
'Edit number';
Object.assign(btn.style, {
display: 'inline-flex', alignItems: 'center', justifyContent: 'center',
marginTop: '10px', padding: '8px 16px', fontSize: '12px',
fontFamily: 'inherit', fontWeight: '600', color: '#1a1a1a',
background: '#ffffff', border: '1.5px solid #d1d1d1', borderRadius: '8px',
cursor: 'pointer', whiteSpace: 'nowrap',
boxShadow: '0 1px 3px rgba(0,0,0,0.07)', transition: 'all 0.18s ease'
});
btn.addEventListener('mouseenter', function () { btn.style.background = '#1a1a1a'; btn.style.color = '#ffffff'; btn.style.borderColor = '#1a1a1a'; });
btn.addEventListener('mouseleave', function () { btn.style.background = '#ffffff'; btn.style.color = '#1a1a1a'; btn.style.borderColor = '#d1d1d1'; });
btn.addEventListener('mousedown', function () { btn.style.transform = 'scale(0.97)'; });
btn.addEventListener('mouseup', function () { btn.style.transform = 'scale(1)'; });
btn.addEventListener('click', function () { window.location.href = CHANGE_PHONE_URL; });
var container = phoneInput.parentNode && phoneInput.parentNode.parentNode
? phoneInput.parentNode.parentNode
: phoneInput.parentNode;
container.insertAdjacentElement('afterend', btn);
console.log('Phone field patched');
}
new MutationObserver(patchPhoneField).observe(document.documentElement, { childList: true, subtree: true });
patchPhoneField();
window.addEventListener('load', patchPhoneField);
})();
top of page
bottom of page