jekyll-theme-consulting 0.8.3 → 0.8.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/_includes/contact_script.html +19 -22
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 50c3e400dc27b86deeb4e8993c32ff7bbe2078852c5e0c1435039c6ac8f36c9b
4
- data.tar.gz: e4033490173525e24852d62a5ce6dbe6ca368d88cc42d2c4095fafc0e33a2288
3
+ metadata.gz: 901e4b7bd438ac7354731b1ea6edb29ad70b960cb10b3e4a02a0aaac61933e35
4
+ data.tar.gz: a981a4533dfee5301464c701c943eacd10f4c7e294bbb868ede9786b2a58bbb9
5
5
  SHA512:
6
- metadata.gz: 73358dd58770bd4bbf2c39bc7ed9914423a999e9821e29058a1eb66ee1751098df755b1e9f2f160474330df9a54c1b2d71982fae8d471f3ec65147493165ab14
7
- data.tar.gz: 1544a1805445127fe7437b5e1b8678a620f52185c5957288b4b42e393480272d8cbb0f1e0618c6aaf88a98ad5440ccfad4ee923f99756220ae020ad5d2bf1bd3
6
+ metadata.gz: be10235a1497cd00119c6f655deb26069566e459eb4df15bd893415e55fe9b403dcc22d6628a6c437c54568726954d1e570a66db591d12fd76ed2e149b073100
7
+ data.tar.gz: da2173d4be41f7d49a499f775e2ed189151462ce1a188126f3ef3d60076b5abbc18b93e3385f085e2c3c059e58be67d6c5aa3194527ce51c542cd5cfd2759056
@@ -37,9 +37,12 @@
37
37
  contactFormElement.focus();
38
38
  }
39
39
 
40
- const {{ include.onsubmit_callback | default: 'processContactRequest()' }} = function() {
40
+ const {{ include.onsubmit_callback | default: 'processContactRequest' }} = function() {
41
41
  if (grecaptcha.getResponse(recaptchaWidget).length > 0) {
42
42
  sendContactMessage();
43
+ hideModalWindow();
44
+ resetContactForm();
45
+ grecaptcha.reset();
43
46
  } else {
44
47
  showModalWindow();
45
48
  }
@@ -51,31 +54,25 @@
51
54
  };
52
55
 
53
56
  const sendContactMessage = function() {
54
- const recaptchaToken = grecaptcha.getResponse(recaptchaWidget);
55
-
56
57
  const data = {
57
58
  name: encodeURIComponent(nameInputElement.value),
58
59
  email: encodeURIComponent(emailInputElement.value),
59
60
  message: encodeURIComponent(messageInputElement),
60
- token: recaptchaToken
61
+ token: grecaptcha.getResponse(recaptchaWidget)
61
62
  };
62
-
63
- hideModalWindow();
64
-
65
- if (recaptchaToken.length > 0) {
66
- fetch("{{ '/contact' | absolute_url }}", {
67
- method: 'POST',
68
- mode: 'same-origin',
69
- headers: {'Content-Type': 'application/json',},
70
- body: JSON.stringify(data),
71
- })
72
- .then((response) => {
73
- alert('Message sent!');
74
- })
75
- .catch((error) => {
76
- console.error('Error:', error);
77
- });
78
- }
63
+
64
+ fetch("{{ '/contact' | absolute_url }}", {
65
+ method: 'POST',
66
+ mode: 'same-origin',
67
+ headers: {'Content-Type': 'application/json',},
68
+ body: JSON.stringify(data),
69
+ })
70
+ .then((response) => {
71
+ alert('Message sent!');
72
+ })
73
+ .catch((error) => {
74
+ console.error('Error:', error);
75
+ });
79
76
  };
80
77
 
81
78
  var onRecaptchaLoadCallback = function() {
@@ -83,7 +80,7 @@
83
80
  'sitekey' : '{{ site.recaptcha.sitekey }}',
84
81
  'theme' : 'dark',
85
82
  'size' : 'compact',
86
- 'callback' : sendContactMessage
83
+ 'callback' : processContactRequest
87
84
  });
88
85
  };
89
86
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-theme-consulting
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.3
4
+ version: 0.8.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Mougeolle