blob: 36d0685322395b9601d71bb8ace3e7ef59c0fba2 (
plain) (
blame)
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
38
39
40
41
42
43
|
var storage = chrome.storage.local;
var viewModel = {}; //Just an object for the databinding
function applyBinding() {
dataBind(document.body, viewModel);
}
function toggle(prop) {
storage.get({[prop]: false}, function(obj) {
storage.set({[prop] : !obj[prop]});
viewModel[prop] = !obj[prop];
applyBinding();
});
}
storage.get({logging:false, enableNotifications:false, disabled: false}, function(obj) {
viewModel = obj;
applyBinding();
})
function openRedirectorSettings() {
//switch to open one if we have it to minimize conflicts
var url = chrome.extension.getURL('redirector.html');
//FIREFOXBUG: Firefox chokes on url:url filter if the url is a moz-extension:// url
//so we don't use that, do it the more manual way instead.
chrome.tabs.query({currentWindow:true}, function(tabs) {
for (var i=0; i < tabs.length; i++) {
if (tabs[i].url == url) {
chrome.tabs.update(tabs[i].id, {active:true}, function(tab) {
close();
});
return;
}
}
chrome.tabs.create({url:url, active:true});
});
return;
};
|