-
Notifications
You must be signed in to change notification settings - Fork 0
/
options.js
35 lines (30 loc) · 982 Bytes
/
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
30
31
32
33
34
35
/**
* options.js
*
* @license MIT, https://opensource.org/license/mit
* @version 2.0
* @author G.A. Jazali, [email protected]
* @updated 2024-05-28
* @link https://addons.mozilla.org/en-US/firefox/addon/put-site-domain-in-tab-title/
*
*/
function saveOptions(e) {
e.preventDefault();
values = document.querySelector("#exceptions").value;
browser.storage.sync.set({
exceptions: values,
});
}
function restoreOptions() {
function setCurrentChoice(result) {
defaultValues = "colab.research.google.com=Colab\nmail.google.com=Gmail\noutlook.live.com=Outlook";
document.querySelector("#exceptions").value = result.exceptions || defaultValues;
}
function onError(error) {
console.log(`Error: ${error}`);
}
let getting = browser.storage.sync.get("exceptions");
getting.then(setCurrentChoice, onError);
}
document.addEventListener("DOMContentLoaded", restoreOptions);
document.querySelector("form").addEventListener("submit", saveOptions);