forked from decentraland/old-documentation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
newsletter.html
56 lines (52 loc) · 1.57 KB
/
newsletter.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<div class="newsletter">
<div class="container">
<div class="newsletter__content">
<h2 class="newsletter__small-title">Developers Newsletter</h2>
<p class="newsletter__title">Subscribe to the latest news about Decentraland</p>
</div>
<form action="" class="form newsletter__form">
<input type="email" class="form-control" id="email" placeholder="[email protected]">
<button class="btn" type="submit" id="subscribe" disabled>Subscribe</button>
</form>
<div class="newsletter__form-sent">
<h2 class="newsletter__title">Thank you for subscribing!</h2>
<p>You will be up to date with every Decentraland news!</p>
</div>
</div>
</div>
<script>
$('#email').on('keyup', function() {
$('#subscribe').prop({
disabled: $('#email').val().trim().length === 0
})
})
$('form.newsletter__form').on('submit', function(event) {
event.preventDefault()
const $email = $('#email')
$email.blur()
cta($email.val().trim())
$('.newsletter').addClass('sent')
return false
})
function cta(email) {
$('#subscribe').prop({ disabled: true })
if (email) {
{% if jekyll.environment == 'production' and site.segment_write_key != '' %}
analytics.identify({ email: email })
analytics.track('Subscribe Newsletter', { email: email })
$.ajax({
type: 'POST',
url: 'https://decentraland.org/subscribe',
data: {
email: email,
interest: 'docs'
},
crossDomain: true,
success: console.log
})
{% else %}
console.log(email)
{% endif %}
}
}
</script>