function documentReady(fn) { if (document.readyState !== 'loading') { fn(); } else { document.addEventListener('DOMContentLoaded', fn); } } documentReady(function () { document.getElementsByClassName("captcha__footer__container")[0].textContent = '©' + new Date().getFullYear() + ' BHN Rewards. All Rights Reserved.'; const container = document.getElementById("captcha-container"); const captchaDDv1 = document.getElementById("ddv1-captcha-container"); const captchaHuman = document.getElementsByClassName("captcha__human")[0]; const captchaRobot = document.getElementsByClassName("captcha__robot")[0]; const content = document.createElement("div"); content.className = "captcha__content"; container.insertBefore(content, captchaHuman); content.appendChild(captchaHuman); content.appendChild(captchaDDv1); content.appendChild(captchaRobot); var inputEmail = document.createElement("input"); inputEmail.setAttribute("type", "email"); inputEmail.setAttribute("class", "captcha__contact__input"); inputEmail.setAttribute("id", "human-email"); inputEmail.setAttribute("name", "email"); inputEmail.setAttribute("placeholder", "Email"); inputEmail.setAttribute("required", true); document.getElementsByClassName('captcha__contact__input-container')[0].prepend(inputEmail); document.getElementById('human-contact-form').addEventListener('submit', function (e) { var POST_URL_ENDPOINT = 'https://qa.rybbon.net/public/captcha-feedback'; var humanReasonElements = document.getElementsByName('human-reason'); var humanReason = ''; for (i = 0; i < humanReasonElements.length; i++) { if (humanReasonElements[i].checked) humanReason = humanReasonElements[i].value; } var email = document.getElementById("human-email").value; var comment = document.getElementById("human-comment").value; var requestId = document.getElementById("show-human-requestId").innerHTML.slice(4); if (email) { const req = new XMLHttpRequest(); req.open("POST", POST_URL_ENDPOINT); req.setRequestHeader("Content-Type", "application/json"); req.send(JSON.stringify({ email: email, "document_referer": document.referrer, "human-reason": humanReason, "human-comment": comment, "captcha_request_id": requestId })); } }); });