jscom_ice 1.2.0 → 1.3.0
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.
- checksums.yaml +4 -4
- data/_includes/contact-me-form.html +43 -5
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7e860fdf27c67fdda57b6332966c24c2c9ce3aafdf454928a394ae97a02955c2
|
|
4
|
+
data.tar.gz: 241791b2bd83389c0deb60b890b4e314d3fd01c938a3ca78bb240514ff0ca86d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: dd92fa24d069bce99dee6cfeaf9efd177fca582c81594e4f7a6e67d6335cea589e0464024d03c6ec276c263b8cafabe45dd2ee194c49f811d235d405ba50dfde
|
|
7
|
+
data.tar.gz: b089d6c61dcddc71eb93b3e568decf50bcfd1795f9836006a1a395071a5c2cb9403226ef00bcc8e8ec6fe1100ce04424a1a20913e7795f9bbc0c4ec5558ec653
|
|
@@ -11,16 +11,43 @@
|
|
|
11
11
|
<div class="form-group">
|
|
12
12
|
<textarea class="form-control" id="msg" name="user_message" placeholder="Message"></textarea>
|
|
13
13
|
</div>
|
|
14
|
+
<div class="form-group d-flex justify-content-center my-3">
|
|
15
|
+
<div class="cf-turnstile"
|
|
16
|
+
data-sitekey="{{ site.turnstile.site_key }}"
|
|
17
|
+
data-callback="onTurnstileSuccess"
|
|
18
|
+
data-expired-callback="onTurnstileExpired"
|
|
19
|
+
data-error-callback="onTurnstileError"
|
|
20
|
+
data-theme="light">
|
|
21
|
+
</div>
|
|
22
|
+
</div>
|
|
14
23
|
<div class="form-buttons">
|
|
15
|
-
<button type="button" class="btn btn-primary" id="contact_submit">Send your message</button>
|
|
24
|
+
<button type="button" class="btn btn-primary" id="contact_submit" disabled>Send your message</button>
|
|
16
25
|
</div>
|
|
17
26
|
</form>
|
|
18
27
|
</div>
|
|
19
28
|
|
|
20
29
|
<!--<!– TODO - this isn't working when using the scripts.html include ... –>-->
|
|
21
30
|
<script src="/assets/js/jquery-3.7.0.min.js"></script>
|
|
31
|
+
<script src="https://challenges.cloudflare.com/turnstile/v0/api.js" async defer></script>
|
|
22
32
|
|
|
23
33
|
<script>
|
|
34
|
+
var turnstileToken = null;
|
|
35
|
+
|
|
36
|
+
function onTurnstileSuccess(token) {
|
|
37
|
+
turnstileToken = token;
|
|
38
|
+
$('#contact_submit').prop('disabled', false);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function onTurnstileExpired() {
|
|
42
|
+
turnstileToken = null;
|
|
43
|
+
$('#contact_submit').prop('disabled', true);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function onTurnstileError() {
|
|
47
|
+
turnstileToken = null;
|
|
48
|
+
$('#contact_submit').prop('disabled', true);
|
|
49
|
+
}
|
|
50
|
+
|
|
24
51
|
function submitContact(payload) {
|
|
25
52
|
$.ajax({
|
|
26
53
|
url : "{{ site.contact.api.url }}",
|
|
@@ -29,12 +56,17 @@
|
|
|
29
56
|
data: payload,
|
|
30
57
|
success: function(data){
|
|
31
58
|
console.log(data);
|
|
32
|
-
$('#notification').addClass('alert-success').text('Message Sent!').show();
|
|
59
|
+
$('#notification').removeClass('alert-danger').addClass('alert-success').text('Message Sent!').show();
|
|
33
60
|
clearForm();
|
|
61
|
+
if (typeof turnstile !== 'undefined') {
|
|
62
|
+
turnstile.reset();
|
|
63
|
+
}
|
|
64
|
+
turnstileToken = null;
|
|
65
|
+
$('#contact_submit').prop('disabled', true);
|
|
34
66
|
},
|
|
35
67
|
error: function(){
|
|
36
68
|
console.log("Error in the request");
|
|
37
|
-
$('#notification').addClass('alert-danger').text('Something went wrong :(').show();
|
|
69
|
+
$('#notification').removeClass('alert-success').addClass('alert-danger').text('Something went wrong :(').show();
|
|
38
70
|
}
|
|
39
71
|
});
|
|
40
72
|
}
|
|
@@ -45,18 +77,24 @@
|
|
|
45
77
|
$('#msg').val('');
|
|
46
78
|
}
|
|
47
79
|
|
|
48
|
-
|
|
49
80
|
function buildPayload() {
|
|
50
81
|
var contactMePayload = {
|
|
51
82
|
contact_name : $('#name').val(),
|
|
52
83
|
contact_email : $('#mail').val(),
|
|
53
|
-
contact_message : $('#msg').val()
|
|
84
|
+
contact_message : $('#msg').val(),
|
|
85
|
+
turnstile_token: turnstileToken,
|
|
86
|
+
turnstile_site: "johnsosoka.com"
|
|
54
87
|
};
|
|
55
88
|
|
|
56
89
|
return JSON.stringify(contactMePayload);
|
|
57
90
|
}
|
|
58
91
|
|
|
59
92
|
$('#contact_submit').click(function() {
|
|
93
|
+
if (!turnstileToken) {
|
|
94
|
+
$('#notification').removeClass('alert-success').addClass('alert-danger')
|
|
95
|
+
.text('Please complete the security verification').show();
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
60
98
|
var payload = buildPayload();
|
|
61
99
|
console.log(payload);
|
|
62
100
|
submitContact(payload);
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: jscom_ice
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- John Sosoka
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2025-
|
|
11
|
+
date: 2025-12-28 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: jekyll
|