fix FF shortcuts button (#900)

This commit is contained in:
narcolepticinsomniac 2020-04-16 06:17:12 -04:00 committed by GitHub
parent d7ff697aa6
commit 7ae0798364
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -11,6 +11,20 @@ var backgroundWorker = workerUtil.createWorker({
url: '/background/background-worker.js'
});
// eslint-disable-next-line no-var
var browserCommands, contextMenus;
// *************************************************************************
// browser commands
browserCommands = {
openManage,
openOptions: () => openManage({options: true}),
styleDisableAll(info) {
prefs.set('disableAll', info ? info.checked : !prefs.get('disableAll'));
},
reload: () => chrome.runtime.reload(),
};
window.API_METHODS = Object.assign(window.API_METHODS || {}, {
deleteStyle: styleManager.deleteStyle,
editSave: styleManager.editSave,
@ -71,8 +85,8 @@ window.API_METHODS = Object.assign(window.API_METHODS || {}, {
},
optionsCustomizeHotkeys() {
return browser.runtime.openOptionsPage()
.then(() => new Promise(resolve => setTimeout(resolve, 100)))
return browserCommands.openOptions()
.then(() => new Promise(resolve => setTimeout(resolve, 500)))
.then(() => msg.broadcastExtension({method: 'optionsCustomizeHotkeys'}));
},
@ -85,9 +99,6 @@ window.API_METHODS = Object.assign(window.API_METHODS || {}, {
openManage
});
// eslint-disable-next-line no-var
var browserCommands, contextMenus;
// *************************************************************************
// register all listeners
msg.on(onRuntimeMessage);
@ -147,17 +158,6 @@ chrome.runtime.onInstalled.addListener(({reason}) => {
delete localStorage.codeMirrorThemes;
});
// *************************************************************************
// browser commands
browserCommands = {
openManage,
openOptions: () => openManage({options: true}),
styleDisableAll(info) {
prefs.set('disableAll', info ? info.checked : !prefs.get('disableAll'));
},
reload: () => chrome.runtime.reload(),
};
// *************************************************************************
// context menus
contextMenus = {