-
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathoptions.js
More file actions
31 lines (29 loc) · 761 Bytes
/
options.js
File metadata and controls
31 lines (29 loc) · 761 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
29
30
31
chrome.storage.sync.get("assistant_enable", function (stored) {
if (stored.assistant_enable) {
$("#assistant_enable").prop("checked", true);
} else {
$("#assistant_enable").prop("checked", false);
}
});
var checkbox = document.querySelector("input[name=checkbox]");
checkbox.addEventListener("change", function () {
if (this.checked) {
chrome.storage.sync.set({
["assistant_enable"]: 1,
});
} else {
chrome.storage.sync.set({
["assistant_enable"]: 0,
});
}
});
navigator.mediaDevices
.getUserMedia({ audio: true })
.then(function (stream) {
stream.getTracks().forEach(function (track) {
track.stop();
});
})
.catch(function (error) {
alert("Error : Microphone Access Required");
});