updating 'turn all styles off' in the right click context menu when prefs are loaded

This commit is contained in:
Jeremy Schomery 2017-02-23 11:07:25 +03:30
parent fadf1a070c
commit 218cd46670
3 changed files with 10 additions and 2 deletions

View File

@ -53,7 +53,6 @@ chrome.tabs.onRemoved.addListener(function(tabId, info) {
}); });
chrome.runtime.onMessage.addListener(function(request, sender, sendResponse) { chrome.runtime.onMessage.addListener(function(request, sender, sendResponse) {
switch (request.method) { switch (request.method) {
case "getStyles": case "getStyles":
var styles = getStyles(request, sendResponse); var styles = getStyles(request, sendResponse);
@ -179,3 +178,10 @@ var codeMirrorThemes;
getCodeMirrorThemes(function(themes) { getCodeMirrorThemes(function(themes) {
codeMirrorThemes = themes; codeMirrorThemes = themes;
}); });
// to-do, user-feedback (https://github.com/schomery/stylish-chrome/issues/22#issuecomment-279936160)
(function (oV, nV) {
if (oV !== nV) {
prefs.set('version', nV);
}
})(prefs.get('version', null), chrome.runtime.getManifest().version)

View File

@ -1,6 +1,6 @@
{ {
"name": "Stylus", "name": "Stylus",
"version": "1.0.1", "version": "1.0.2",
"description": "__MSG_description__", "description": "__MSG_description__",
"homepage_url": "https://github.com/schomery/stylish-chrome", "homepage_url": "https://github.com/schomery/stylish-chrome",
"manifest_version": 2, "manifest_version": 2,

View File

@ -419,6 +419,8 @@ var prefs = chrome.extension.getBackgroundPage().prefs || new function Prefs() {
} }
} }
} }
// make sure right click context menu is in the right state when prefs are loaded
chrome.contextMenus.update("disableAll", {checked: prefs.get("disableAll")});
}); });
chrome.storage.onChanged.addListener(function(changes, area) { chrome.storage.onChanged.addListener(function(changes, area) {