-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathform_submit.js
More file actions
47 lines (41 loc) · 1.55 KB
/
form_submit.js
File metadata and controls
47 lines (41 loc) · 1.55 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
//this doesn't do anything idk why its here
function buttonTest() {
var userInfo = {
name: document.getElementById("name").value,
email: document.getElementById("email").value,
telephone: document.getElementById("telephone").value,
address1: document.getElementById("address1").value,
address2: document.getElementById("address2").value,
zip: document.getElementById("zip").value,
city: document.getElementById("city").value,
state: document.getElementById("state").value,
country: document.getElementById("country").value,
save_address: document.getElementById("save_address").value,
type: document.getElementById("type").value,
card_num: document.getElementById("card_num").value,
exp_mon: document.getElementById("exp_mon").value,
exp_year: document.getElementById("exp_year").value,
ccv: document.getElementById("ccv").value,
t_and_c: document.getElementById("t_and_c").value
};
if (userInfo["t_and_c"] === "on") {
userInfo["t_and_c"] = true;
}
if (userInfo["save_address"] === "on") {
userInfo["save_address"] = true;
}
var jsonInfo = JSON.stringify(userInfo);
//chrome storage
chrome.storage.sync.set({'userInfo': userInfo}, function(){
console.log("Info Saved but not encrypted");
})
//saving using normal chrome save file
//saveData(jsonInfo, 'info.json', 'text/plain');
}
function saveData(text, name, type) {
var a = document.createElement("a");
var file = new Blob([text], {type: type});
a.href = URL.createObjectURL(file);
a.download = name;
a.click();
}