File size: 1,054 Bytes
0d773d7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
document.addEventListener("DOMContentLoaded", () => {
    
  chrome.storage.sync.get(["baseURL", "from", "auth", "sharedID"], (result) => {
    if (result.baseURL) {
      document.getElementById("base-url").value = result.baseURL;
    }
    if (result.from) {
      document.getElementById("from").value = result.from;
    }
    if (result.auth) {
      document.getElementById("auth").value = result.auth;
    }
    if (result.sharedID) {
      document.getElementById("shared-id").value = result.sharedID;
    }
  });

  document.getElementById("save-config").addEventListener("click", () => {
    const baseURL = document.getElementById("base-url").value;
    const from = document.getElementById("from").value;
    const auth = document.getElementById("auth").value;
    const sharedID = document.getElementById("shared-id").value;

    chrome.storage.sync.set(
      {
        baseURL: baseURL,
        from: from,
        auth: auth,
        sharedID: sharedID,
      },
      () => {
        alert("Successfully saved");
      }
    );
  });
});