var captchaWidget; function showCaptchaPopup(responseText, captchaSuccess, msg1, msg2) { var wrapElement = $(".jsContentCaptchaBlock"); $('.jsCaptchaMsg1').text(msg1 ? msg1 : ""); $('.jsCaptchaMsg2').text(msg2 ? msg2 : ""); $("#signupPopup").modal("show", {"dataContent": "jsContentCaptchaBlock"}); var capType = $('.page-report-abuse').filter('.rtl').length || Config.isMobile ? 'compact' : 'normal'; if (typeof captchaWidget != 'undefined') { grecaptcha.reset(captchaWidget); } else { captchaWidget = grecaptcha.render(wrapElement.find('#reCaptchaBlock')[0], { 'sitekey' : Config.captchaSiteKey, 'theme' : 'light', 'size' : capType, 'callback' : function() { $.post('/web/rest/api/reCaptcha', { limitKey: Utils.parseResponseText(responseText, 'limitKey'), response: $('#g-recaptcha-response').val() }, function (data) { if (data && data.valid) { $("#signupPopup").modal("hide"); captchaSuccess(); } } ) } }); } } function showCaptcha(wrapElement, responseText, captchaSuccess, rebuildScroll) { wrapElement.addClass('captchaShowed'); if (rebuildScroll) rebuildScroll(); var capType = $('.page-report-abuse').filter('.rtl').length || Config.isMobile ? 'compact' : 'normal'; if (typeof captchaWidget != 'undefined') { grecaptcha.reset(captchaWidget); } else { captchaWidget = grecaptcha.render(wrapElement.find('#reCaptchaBlock')[0], { 'sitekey' : Config.captchaSiteKey, 'theme' : 'light', 'size' : capType, 'callback' : function() { $.post('/web/rest/api/reCaptcha', { limitKey: Utils.parseResponseText(responseText, 'limitKey'), response: $('#g-recaptcha-response').val() }, function (data) { if (data && data.valid) { wrapElement.removeClass('captchaShowed'); captchaSuccess(); } } ) } }); } }