website
'); $('.forgot-shipment').replaceWith('
' + __translate('Forgot Shipment Id') + '? ' + __translate('Track by Order Number') + '
'); $('#validate').on('click', validate); function validate(e) { e.preventDefault(); const emailInput = $('#avatrack-email')[0].value; const orderInput = $('#avatrack-order')[0].value; if (!emailInput || !validateEmail(emailInput)) { $('.verify-email').attr('style', 'display: block !important'); } if (!orderInput) { $('.verify-track').attr('style', 'display: block !important'); } if (emailInput && orderInput){ $('.verify-email').attr('style', 'display: none !important'); $('.verify-track').attr('style', 'display: none !important'); trackOrder(emailInput, orderInput); } } $('.switch-track').click(function(e){ e.preventDefault(); const $this = $(this), tabgroup = $this.parents('section'); $this.addClass('active'); $(tabgroup).children('div').toggle(); }); function switchTrack() { $('.switch-track').click(function(e){ e.preventDefault(); const $this = $(this), tabgroup = $this.parents('section'); $this.addClass('active'); $(tabgroup).children('div').toggle(); }); } function __translate(text) { return window?.translateMap?.[text] || text; } function trackOrder(email, order) { const url = window.location.origin; if (order && email) { window.location.replace(url + '/apps/track/' + order + '?email=' + email); } } function validateEmail(email) { const re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; return re.test(email); } });