change mode from right-click context menu; fixes #23
This commit is contained in:
parent
62d3eefd67
commit
817c1a7fb1
2 changed files with 28 additions and 1 deletions
26
common.js
26
common.js
|
@ -28,6 +28,28 @@ chrome.storage.local.get(prefs, ps => {
|
||||||
color: prefs.color
|
color: prefs.color
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
// context menu
|
||||||
|
chrome.contextMenus.create({
|
||||||
|
id: 'blacklist',
|
||||||
|
title: 'Switch to "black-list" mode',
|
||||||
|
contexts: ['browser_action'],
|
||||||
|
type: 'radio',
|
||||||
|
checked: prefs.mode === 'blacklist'
|
||||||
|
});
|
||||||
|
chrome.contextMenus.create({
|
||||||
|
id: 'whitelist',
|
||||||
|
title: 'Switch to "white-list" mode',
|
||||||
|
contexts: ['browser_action'],
|
||||||
|
type: 'radio',
|
||||||
|
checked: prefs.mode === 'whitelist'
|
||||||
|
});
|
||||||
|
chrome.contextMenus.create({
|
||||||
|
id: 'custom',
|
||||||
|
title: 'Switch to "custom" mode',
|
||||||
|
contexts: ['browser_action'],
|
||||||
|
type: 'radio',
|
||||||
|
checked: prefs.mode === 'custom'
|
||||||
|
});
|
||||||
});
|
});
|
||||||
chrome.storage.onChanged.addListener(ps => {
|
chrome.storage.onChanged.addListener(ps => {
|
||||||
Object.keys(ps).forEach(key => prefs[key] = ps[key].newValue);
|
Object.keys(ps).forEach(key => prefs[key] = ps[key].newValue);
|
||||||
|
@ -256,6 +278,10 @@ var onCommitted = ({frameId, url, tabId}) => {
|
||||||
ua.toolbar({tabId});
|
ua.toolbar({tabId});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
// context menu
|
||||||
|
chrome.contextMenus.onClicked.addListener(info => chrome.storage.local.set({
|
||||||
|
mode: info.menuItemId
|
||||||
|
}));
|
||||||
|
|
||||||
// FAQs & Feedback
|
// FAQs & Feedback
|
||||||
chrome.storage.local.get({
|
chrome.storage.local.get({
|
||||||
|
|
|
@ -12,7 +12,8 @@
|
||||||
"<all_urls>",
|
"<all_urls>",
|
||||||
"webNavigation",
|
"webNavigation",
|
||||||
"webRequest",
|
"webRequest",
|
||||||
"webRequestBlocking"
|
"webRequestBlocking",
|
||||||
|
"contextMenus"
|
||||||
],
|
],
|
||||||
|
|
||||||
"icons": {
|
"icons": {
|
||||||
|
|
Loading…
Reference in a new issue