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' 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 || {}, { window.API_METHODS = Object.assign(window.API_METHODS || {}, {
deleteStyle: styleManager.deleteStyle, deleteStyle: styleManager.deleteStyle,
editSave: styleManager.editSave, editSave: styleManager.editSave,
@ -71,8 +85,8 @@ window.API_METHODS = Object.assign(window.API_METHODS || {}, {
}, },
optionsCustomizeHotkeys() { optionsCustomizeHotkeys() {
return browser.runtime.openOptionsPage() return browserCommands.openOptions()
.then(() => new Promise(resolve => setTimeout(resolve, 100))) .then(() => new Promise(resolve => setTimeout(resolve, 500)))
.then(() => msg.broadcastExtension({method: 'optionsCustomizeHotkeys'})); .then(() => msg.broadcastExtension({method: 'optionsCustomizeHotkeys'}));
}, },
@ -85,9 +99,6 @@ window.API_METHODS = Object.assign(window.API_METHODS || {}, {
openManage openManage
}); });
// eslint-disable-next-line no-var
var browserCommands, contextMenus;
// ************************************************************************* // *************************************************************************
// register all listeners // register all listeners
msg.on(onRuntimeMessage); msg.on(onRuntimeMessage);
@ -147,17 +158,6 @@ chrome.runtime.onInstalled.addListener(({reason}) => {
delete localStorage.codeMirrorThemes; 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 // context menus
contextMenus = { contextMenus = {