mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-07 03:57:09 +03:00
Moving utils
This commit is contained in:
34
popup.js
34
popup.js
@@ -1,37 +1,3 @@
|
|||||||
SB = {};
|
|
||||||
|
|
||||||
function configProxy() {
|
|
||||||
chrome.storage.onChanged.addListener((changes, namespace) => {
|
|
||||||
for (key in changes) {
|
|
||||||
localconfig[key] = changes[key].newValue;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
var handler = {
|
|
||||||
set: function(obj, prop, value) {
|
|
||||||
chrome.storage.sync.set({
|
|
||||||
[prop]: value
|
|
||||||
})
|
|
||||||
},
|
|
||||||
get: function(obj, prop) {
|
|
||||||
return localconfig[prop]
|
|
||||||
}
|
|
||||||
};
|
|
||||||
return new Proxy({}, handler);
|
|
||||||
}
|
|
||||||
|
|
||||||
fetchConfig = _ => new Promise(function(resolve, reject) {
|
|
||||||
chrome.storage.sync.get(null, function(items) {
|
|
||||||
localconfig = items; // Data is ready
|
|
||||||
resolve();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
async function config() {
|
|
||||||
localconfig = {};
|
|
||||||
await fetchConfig();
|
|
||||||
SB.config = configProxy();
|
|
||||||
}
|
|
||||||
|
|
||||||
//make this a function to allow this to run on the content page
|
//make this a function to allow this to run on the content page
|
||||||
async function runThePopup() {
|
async function runThePopup() {
|
||||||
localizeHtmlPage();
|
localizeHtmlPage();
|
||||||
|
|||||||
Reference in New Issue
Block a user