-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathscript.js
More file actions
139 lines (133 loc) · 4.34 KB
/
Copy pathscript.js
File metadata and controls
139 lines (133 loc) · 4.34 KB
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
function contactSubmit() {
var name = escape($("#namef1").val()); //.replace(/\s/g, "+"));
var email = escape($("#emailf1").val()); //.replace(/\s/g, "+"));
var question = escape($("#contactq1").val()); //.replace(/\s/g, "+"));
if (question == "" || name == "" || email == "") {
alert("Please enter a value for all fields");
} else {
emailjs.init("user_mWOtaoxzxeJyW8OxdfwGS");
let contactParams = {
from_name: name,
from_email: email,
message: question,
};
emailjs
.send("service_9403v3m", "template_v3e8pel", contactParams)
.then(function (res) {});
/*
$.ajax({
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
},
'type': 'POST',
'url': `https://script.google.com/macros/s/12ypMJ7zWRlplNKYfiUfbH4Vyfv1RgB8tVNxP2BFBffXww3A5skAgSNVG/exec?function=contact&name=${name}&email=${email}&questions=${question}`,
crossDomain: true,
contentType: false,
dataType: 'text/javascript',
processData: false,
beforeSend: function() {
$('#contactsubmit').prop('disabled','true');
$('#contactsubmit').html('<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true" style="padding: 7px"></span> Working..');
},
statusCode: {
200: function() {
$('#contactsubmit').text('Success!');
setTimeout(function() {
$('#contactsubmit').removeAttr("disabled");
$('#contactsubmit').text('Submit');
}, 1500);
}
}
});
*/
console.log("sent message");
}
return;
}
function preregisterSubmit() {
$("#volbtnsubmit").prop("disabled", "true");
var name = escape($("#namef").val().replace(/\s/g, "+"));
var email = escape($("#emailf").val().replace(/\s/g, "+"));
$.ajax({
type: "POST",
url: `https://script.google.com/macros/s/AKfycbxK5zr2m51a5ARZdjipIFJ4P3XKkyjM-Yi64VhcalGLLraeetc/exec?function=preregister&name=${name}&email=${email}`,
crossDomain: true,
contentType: false,
dataType: "text/javascript",
processData: false,
beforeSend: function () {
$("#volbtnsubmit").prop("disabled", "true");
$("#volbtnsubmit").html(
'<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true" style="padding: 7px"></span> Working..'
);
},
statusCode: {
200: function () {
$("#volbtnsubmit").text("Success!");
setTimeout(function () {
$("#preregisterModal").modal("hide");
}, 1500);
},
},
});
}
function clearForm() {
document.getElementById("contactform").reset();
if (registerReq != 0) {
$("#contactq").prop("readonly", false);
$("#contactq").prop("placeholder", "Question");
document.getElementById("emailf").classList.remove("contacthl");
document.getElementById("namef").classList.remove("contacthl");
document.getElementById("contactq").classList.remove("contactc");
registerReq = 0;
}
return;
}
$(document).ready(function () {
if (window.innerWidth > 767) {
// Load video if on desktop
$("video").append('<source src="HackBIShort.mp4" type="video/mp4">');
$("video").css("opacity", ".89");
$("video").get(0).load();
} else {
// Else keep poster image
$("video").css("opacity", ".95");
}
});
// EC code for new send message box
var submitting = false
function submitform(event){
event.preventDefault();
if(submitting === true) return;
submitting = true;
var form = document.getElementById("contactf");
var formData = {};
for(const field of form.elements){
if(field.name){
formData[field.name] = field.value;
}
}
fetch('https://formsubmit.co/ajax/hackbi@bishopireton.org', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json'
},
body: JSON.stringify(formData)
})
.then(response => response.json())
.then(data => {
console.log(data)
if(data.success === "true" || data.message.startsWith("This form needs Activation.")){
var inputs = document.getElementById("contactf").getElementsByTagName("input")
for(let i = 0; i < inputs.length; i++){
inputs[i].value = ""
}
submitting = false;
} else {
if(data.success === "false"){
submitting = false;
}
}
});
}