From 7ae079836480f72256f42aecd54f7d182cf49ce8 Mon Sep 17 00:00:00 2001 From: narcolepticinsomniac Date: Thu, 16 Apr 2020 06:17:12 -0400 Subject: [PATCH] fix FF shortcuts button (#900) --- background/background.js | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/background/background.js b/background/background.js index 844f6958..62a08400 100644 --- a/background/background.js +++ b/background/background.js @@ -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 = {