forked from MartijnOud/SERP-counter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoptions.js
29 lines (25 loc) · 1.02 KB
/
options.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
function save_options() {
const textFilters = document.querySelector("#text-filters").value.trim();
const cssFilters = document.querySelector("#css-filters").value.trim();
chrome.storage.sync.set({
textFilters,
cssFilters
}, () => {
const button = document.querySelector("#save");
button.textContent = "Options saved!";
setTimeout(() => {
button.textContent = "Save";
}, 750);
});
}
function restore_options() {
chrome.storage.sync.get({
textFilters: "Więcej firm\nWynik z kalkulatora\nZnajdź więcej na\nZnajdź wyniki na\nPodobne wyszukiwania\nWięcej miejsc\nPodobne pytania",
cssFilters: `[aria-label='równa się']`
}, (options) => {
document.querySelector("#text-filters").value = options.textFilters;
document.querySelector("#css-filters").value = options.cssFilters;
});
}
document.addEventListener("DOMContentLoaded", restore_options);
document.querySelector("#save").addEventListener("click", save_options);