Wrap js
This commit is contained in:
parent
a178946aba
commit
5790ac019e
|
@ -3,12 +3,13 @@
|
|||
<h3>Add a Comment</h3>
|
||||
|
||||
<script>
|
||||
$(function() {
|
||||
function validateEmail(email) {
|
||||
var re = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
|
||||
return re.test(email);
|
||||
}
|
||||
|
||||
jQuery(document).on('click tap', '.js__add-new-comment', function(event) {
|
||||
$(document).on('click tap', '.js__add-new-comment', function(event) {
|
||||
event.preventDefault();
|
||||
|
||||
var text = $('.js__new-comment-text').val();
|
||||
|
@ -36,7 +37,7 @@ jQuery(document).on('click tap', '.js__add-new-comment', function(event) {
|
|||
}
|
||||
{% endif %}
|
||||
|
||||
jQuery.ajax({
|
||||
$.ajax({
|
||||
url: "{{ grav.uri.rootUrl }}/add-comment",
|
||||
data: {
|
||||
text: $('.js__new-comment-text').val(),
|
||||
|
@ -58,12 +59,14 @@ jQuery(document).on('click tap', '.js__add-new-comment', function(event) {
|
|||
$('.alert-container').show();
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
{% if use_captcha %}
|
||||
<script src="https://www.google.com/recaptcha/api.js?onload=captchaOnloadCallback&render=explicit" async defer></script>
|
||||
|
||||
<script>
|
||||
$(function() {
|
||||
var captchaOnloadCallback = function captchaOnloadCallback() {
|
||||
grecaptcha.render('g-recaptcha', {
|
||||
'sitekey': "{{grav.config.plugins.comments.recatpcha_site_key}}",
|
||||
|
@ -78,6 +81,7 @@ jQuery(document).on('click tap', '.js__add-new-comment', function(event) {
|
|||
var captchaExpiredCallback = function captchaExpiredCallback() {
|
||||
grecaptcha.reset();
|
||||
};
|
||||
});
|
||||
</script>
|
||||
{% endif %}
|
||||
|
||||
|
|
Loading…
Reference in New Issue