forked from xontab/chrome-virtual-keyboard
-
Notifications
You must be signed in to change notification settings - Fork 0
/
toggle.js
34 lines (33 loc) · 1.17 KB
/
toggle.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
window.addEventListener('load', function() {
document.getElementById("toggleOn").onclick = function() {
chrome.extension.sendRequest({method: "toogleKeyboardOn"}, function(response) {
window.close();
});
}
document.getElementById("settings").onclick = function() {
window.open(chrome.extension.getURL("options.html"));
}
document.getElementById("toggleOff").onclick = function() {
chrome.extension.sendRequest({method: "toogleKeyboardOff"}, function(response) {
window.close();
});
}
document.getElementById("toggleDemand").onclick = function() {
chrome.extension.sendRequest({method: "toogleKeyboardDemand"}, function(response) {
window.close();
});
}
document.getElementById("goToUrl").onclick = function() {
chrome.extension.sendRequest({method: "openUrlBar"}, function(response) {
eval(callback)(response.data);
});
window.close();
}
if (localStorage["keyboardEnabled"] == "demand") {
document.getElementById("toggleDemand").className = "active";
} else if (localStorage["keyboardEnabled"] != "false") {
document.getElementById("toggleOn").className = "active";
} else {
document.getElementById("toggleOff").className = "active";
}
}, false);