-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsubmit.html
More file actions
72 lines (63 loc) · 1.76 KB
/
submit.html
File metadata and controls
72 lines (63 loc) · 1.76 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
<!DOCTYPE html>
<html>
<head>
<script src="https://www.gstatic.com/firebasejs/3.0.2/firebase.js"></script>
<script>
var database;
var results;
function getParam(name) {
var regex = new RegExp("[?&]"+name+"(?:=([^&\n]*))?");
var results = regex.exec(document.location.search);
if (!results) return null;
return decodeURIComponent(results[1].replace(/\+/g, " "));
}
function submit() {
return database.ref("Results/").push({
UnixTime: Date.now(),
Date: Date(),
Position: getParam("position"),
Manager: getParam("manager"),
ReqNumber: getParam("number"),
Results: results
});
}
</script>
</head>
<body onload="load()">
<script>
function load() {
var config = {
apiKey: "AIzaSyAR5mkKau0nYAF7BCrYdB1_EnqmFPlyPf4",
authDomain: "hirschbergsort.firebaseapp.com",
databaseURL: "https://hirschbergsort.firebaseio.com",
storageBucket: "",
};
firebase.initializeApp(config);
database = firebase.database();
results = [];
for (var i = 0; i < getParam("count"); i++) {
results.push(getParam("res"+i));
}
if (getParam("print") != null) {
submit();
open("print.html"+location.search);
}
if (getParam("mail") != null) {
submit();
var position = getParam("position");
var subject = encodeURI("Competency Importance Results for the " + position + " Position");
var endl = "\r\n";
var body = "Hiring Manager: " + getParam("manager") + endl;
body += "Requisition #: " + getParam("number") + endl + endl;
body += "Competency importance ranking for "+position+"s:" + endl + endl;
for (var i = 0; i < getParam("count"); i++) {
body += (i+1) +". "+results[i]+"\r\n";
}
body = encodeURIComponent(body);
console.log("Launching mail");
location.href = "mailto:mschaff@octa.net?subject="+subject+"&body="+body;
}
}
</script>
</body>
</html>