-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
49 lines (39 loc) · 1.52 KB
/
script.js
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
const modal = document.getElementById('modal')
const modalCloseBtn = document.getElementById('modal-close-btn')
const consentForm = document.getElementById('consent-form')
const modalText = document.getElementById('modal-text')
const declineBtn = document.getElementById('decline-btn')
const modalChoiceBtns = document.getElementById('modal-choice-btns')
setTimeout(function(){
modal.style.display = 'inline'
}, 1500)
modalCloseBtn.addEventListener('click', function(){
modal.style.display = 'none'
})
declineBtn.addEventListener('mouseenter', function(){
modalChoiceBtns.classList.toggle('modal-btns-reverse')
})
consentForm.addEventListener('submit', function(e){
e.preventDefault()
const consentFormData = new FormData(consentForm)
const fullName = consentFormData.get('fullName')
modalText.innerHTML = `
<div class="modal-inner-loading">
<img src="./loading.svg" class="loading">
<p id="upload-text">Uploading your data to the dark web...</p>
</div>`
setTimeout(function(){
document.getElementById('upload-text').innerText = `
Making the sale...`
}, 1500)
setTimeout(function(){
document.getElementById('modal-inner').innerHTML = `
<h2>Thanks <span class="modal-display-name">${fullName}</span>, you sucker! </h2>
<p>We just sold the rights to your eternal soul.</p>
<div class="idiot-gif">
<img src="./pirate.gif">
</div>
`
modalCloseBtn.disabled = false
}, 3000)
})