forked from EFForg/https-everywhere
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoptions.js
More file actions
28 lines (22 loc) · 819 Bytes
/
options.js
File metadata and controls
28 lines (22 loc) · 819 Bytes
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
document.addEventListener("DOMContentLoaded", () => {
let json_data;
let import_button = document.querySelector("#import");
function import_json(e) {
e.preventDefault();
let settings = JSON.parse(json_data);
sendMessage("import_settings", settings, resp => {
document.querySelector("#import-confirmed").style.display = "block";
document.querySelector("form").style.display = "none";
});
}
document.querySelector("#import-settings").addEventListener("change", event => {
const file = event.target.files[0];
const reader = new FileReader();
reader.onload = event => {
json_data = event.target.result;
import_button.disabled = false;
};
reader.readAsText(file);
});
document.querySelector("form").addEventListener("submit", import_json);
});