-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add option to ignore specific extensions, closes #5
- Loading branch information
1 parent
385cdb8
commit 36fd9e8
Showing
8 changed files
with
196 additions
and
144 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,50 @@ | ||
const default_options = { | ||
"auto_update": true, | ||
"check_store_apps": true, | ||
"check_external_apps": true | ||
}; | ||
function restore_options() { | ||
chrome.storage.sync.get(default_options, function (items) { | ||
console.log(items); | ||
for (const [setting, checked] of Object.entries(items)) { | ||
let node = document.getElementById(setting); | ||
node.checked = checked; | ||
node.addEventListener("click", e => { | ||
const checked = e.target.checked; | ||
chrome.storage.sync.set({ | ||
[e.target.id]: checked | ||
}, function () { | ||
if (chrome.runtime.lastError) { | ||
node.checked = !checked; | ||
} | ||
function load_options() { | ||
var maindiv = document.getElementById('updatetoggle'); | ||
var default_options = { | ||
"auto_update": true, | ||
"check_store_apps": true, | ||
"check_external_apps": true | ||
}; | ||
chrome.management.getAll(function (e) { | ||
e.forEach(function (ex) { | ||
label = document.createElement('label'); | ||
label.setAttribute('title', 'Never check for updates to this extension'); | ||
span = document.createElement('span'); | ||
div = document.createElement('div'); | ||
img = document.createElement('img'); | ||
input = document.createElement('input'); | ||
input.setAttribute('type', 'checkbox'); | ||
input.setAttribute('id', ex.id); | ||
img.setAttribute('alt', ex.name); | ||
if (ex.icons) | ||
img.setAttribute('src', 'chrome://extension-icon/' + ex.id + '/' + ex.icons[0].size + '/0'); | ||
else | ||
img.setAttribute('src', 'chrome://extension-icon/' + ex.id + '/16/0'); | ||
span.innerHTML = ex.name; | ||
label.appendChild(input); | ||
label.appendChild(img); | ||
label.appendChild(span); | ||
div.appendChild(label); | ||
maindiv.appendChild(div); | ||
default_options[ex.id] = false; | ||
}); | ||
chrome.storage.sync.get(default_options, function (items) { | ||
for (const [setting, checked] of Object.entries(items)) { | ||
let node = document.getElementById(setting); | ||
node.checked = checked; | ||
node.addEventListener("click", e => { | ||
const checked = e.target.checked; | ||
chrome.storage.sync.set({ | ||
[e.target.id]: checked | ||
}, function () { | ||
if (chrome.runtime.lastError) { | ||
node.checked = !checked; | ||
} | ||
}); | ||
}); | ||
}); | ||
} | ||
} | ||
}); | ||
}); | ||
} | ||
document.addEventListener('DOMContentLoaded', restore_options); | ||
|
||
document.addEventListener('DOMContentLoaded', load_options); |
Oops, something went wrong.
Both tabs and spaces are used in this file.