diff --git a/themes/bootstrap3/js/common.js b/themes/bootstrap3/js/common.js index dc573cab6c0324f3f6cbb1c0d8c43bd281a3dc17..554ed519f2a45adafcf480d7239c22113ebedb7e 100644 --- a/themes/bootstrap3/js/common.js +++ b/themes/bootstrap3/js/common.js @@ -163,7 +163,7 @@ function phoneNumberFormHandler(numID, regionCode) { // Setup captchas after Google script loads function recaptchaOnLoad() { - if (grecaptcha) { + if (typeof grecaptcha !== 'undefined') { var captchas = $('.g-recaptcha:empty'); for (var i = 0; i < captchas.length; i++) { captchas[i].dataset.captchaId = grecaptcha.render(captchas[i], captchas[i].dataset); diff --git a/themes/bootstrap3/js/lightbox.js b/themes/bootstrap3/js/lightbox.js index 350dc71f491c43863881ab4c0a2569f2990493e3..018b171d27b18c7270ee0efee8da2f664efad3c0 100644 --- a/themes/bootstrap3/js/lightbox.js +++ b/themes/bootstrap3/js/lightbox.js @@ -226,7 +226,7 @@ VuFind.register('lightbox', function Lightbox() { var form = event.target; var data = $(form).serializeArray(); // Check for recaptcha - if (grecaptcha) { + if (typeof grecaptcha !== 'undefined') { var recaptcha = $(form).find('.g-recaptcha'); if (recaptcha.length > 0) { data.push({ name: 'g-recaptcha-response', value: grecaptcha.getResponse(recaptcha.data('captchaId')) }); @@ -277,7 +277,7 @@ VuFind.register('lightbox', function Lightbox() { method: $(form).attr('method') || 'GET', data: data }).done(function recaptchaReset() { - if (grecaptcha) { + if (typeof grecaptcha !== 'undefined') { grecaptcha.reset($(form).find('.g-recaptcha').data('captchaId')); } }); diff --git a/themes/bootstrap3/js/record.js b/themes/bootstrap3/js/record.js index 786bc8937d605d4fdddfd188d5097617adc898b2..f247c3a631f8b5a046c0413254e73201cee2f860 100644 --- a/themes/bootstrap3/js/record.js +++ b/themes/bootstrap3/js/record.js @@ -96,7 +96,7 @@ function registerAjaxCommentRecord() { id: id, source: recordSource }; - if (grecaptcha) { + if (typeof grecaptcha !== 'undefined') { var recaptcha = $(form).find('.g-recaptcha'); if (recaptcha.length > 0) { data['g-recaptcha-response'] = grecaptcha.getResponse(recaptcha.data('captchaId')); @@ -113,7 +113,7 @@ function registerAjaxCommentRecord() { refreshCommentList($tab, id, recordSource); $(form).find('textarea[name="comment"]').val(''); $(form).find('input[type="submit"]').button('loading'); - if (grecaptcha) { + if (typeof grecaptcha !== 'undefined') { grecaptcha.reset($(form).find('.g-recaptcha').data('captchaId')); } })