-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathconex-helper.js
37 lines (32 loc) · 1.21 KB
/
conex-helper.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
36
37
// alias for document.querySelectorAll
const $ = function(s, parent){ return (parent || document).querySelectorAll(s); };
// alias for document.querySelector
const $1 = function(s, parent){ return (parent || document).querySelector(s); };
const cleanUrl = function(url) {
return url.replace('http://','').replace('https://','').toLowerCase();
};
var settings = {};
function _refreshSettings() {
return new Promise((resolve, reject) => {
browser.storage.local.get([
'conex/settings/create-thumbnail',
'conex/settings/experimental-features',
'conex/settings/hide-tabs',
'conex/settings/search-bookmarks',
'conex/settings/search-history',
'conex/settings/settings-version',
'conex/settings/show-container-selector',
'conex/settings/show-favicons',
'conex/settings/close-reopened-tabs',
]).then(localSettings => {
for (const key in localSettings) {
// conex/settings/create-thumbnail -> create-thumbnail
const id = key.split('/')[key.split('/').length - 1];
settings[id] = localSettings[key];
}
console.info('settings: ', settings);
resolve();
}, e => console.error(e));
});
}
let readSettings = _refreshSettings();