aboutsummaryrefslogtreecommitdiff
path: root/ext/bg/js/backend.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2021-01-16 11:33:34 -0500
committerGitHub <noreply@github.com>2021-01-16 11:33:34 -0500
commitf7c3b0010c9c65b418b46bc87bc5e1f321cd94e0 (patch)
treeefb7aaed4fae1dc1f532ce255be5cef8103ece6d /ext/bg/js/backend.js
parent8766744aa4a94193dd03bba39086e4522914e8ef (diff)
Update extension shortcuts (#1246)
* Update commands * Add command to open the popup window
Diffstat (limited to 'ext/bg/js/backend.js')
-rw-r--r--ext/bg/js/backend.js21
1 files changed, 13 insertions, 8 deletions
diff --git a/ext/bg/js/backend.js b/ext/bg/js/backend.js
index d5e5b086..d83942c0 100644
--- a/ext/bg/js/backend.js
+++ b/ext/bg/js/backend.js
@@ -131,10 +131,11 @@ class Backend {
]);
this._commandHandlers = new Map([
- ['search', this._onCommandSearch.bind(this)],
- ['help', this._onCommandHelp.bind(this)],
- ['options', this._onCommandOptions.bind(this)],
- ['toggle', this._onCommandToggle.bind(this)]
+ ['toggleTextScanning', this._onCommandToggleTextScanning.bind(this)],
+ ['openHelpPage', this._onCommandOpenHelpPage.bind(this)],
+ ['openSettingsPage', this._onCommandOpenSettingsPage.bind(this)],
+ ['openSearchPage', this._onCommandOpenSearchPage.bind(this)],
+ ['openPopupWindow', this._onCommandOpenPopupWindow.bind(this)]
]);
}
@@ -727,7 +728,7 @@ class Backend {
// Command handlers
- async _onCommandSearch(params) {
+ async _onCommandOpenSearchPage(params) {
const {mode='existingOrNewTab', query} = params || {};
const baseUrl = chrome.runtime.getURL('/bg/search.html');
@@ -773,22 +774,26 @@ class Backend {
}
}
- async _onCommandHelp() {
+ async _onCommandOpenHelpPage() {
await this._openInfoPage();
}
- async _onCommandOptions(params) {
+ async _onCommandOpenSettingsPage(params) {
const {mode='existingOrNewTab'} = params || {};
await this._openSettingsPage(mode);
}
- async _onCommandToggle() {
+ async _onCommandToggleTextScanning() {
const source = 'popup';
const options = this.getOptions({current: true});
options.general.enable = !options.general.enable;
await this._saveOptions(source);
}
+ async _onCommandOpenPopupWindow() {
+ await this._onApiGetOrCreateSearchPopup({focus: true});
+ }
+
// Utilities
_getOrCreateSearchPopup() {