aboutsummaryrefslogtreecommitdiff
path: root/ext/js
diff options
context:
space:
mode:
authorKuuuube <61125188+Kuuuube@users.noreply.github.com>2024-05-12 21:54:45 -0400
committerGitHub <noreply@github.com>2024-05-13 01:54:45 +0000
commitfc83365f1f1163fa990d5377f9b20512594631d7 (patch)
tree97cea2c2bea60c4213840c9ad9a8299d98fb39c8 /ext/js
parentd5c28a3b3aee933a6d54ca62877a83e0505cb894 (diff)
Restore shift click behavior for search button opening as a popup (#920)
Diffstat (limited to 'ext/js')
-rw-r--r--ext/js/background/backend.js17
-rw-r--r--ext/js/pages/action-popup-main.js10
2 files changed, 19 insertions, 8 deletions
diff --git a/ext/js/background/backend.js b/ext/js/background/backend.js
index d042a253..dfb85e05 100644
--- a/ext/js/background/backend.js
+++ b/ext/js/background/backend.js
@@ -964,10 +964,10 @@ export class Backend {
// Command handlers
/**
- * @param {undefined|{mode: 'existingOrNewTab'|'newTab', query?: string}} params
+ * @param {undefined|{mode: 'existingOrNewTab'|'newTab'|'popup', query?: string}} params
*/
async _onCommandOpenSearchPage(params) {
- /** @type {'existingOrNewTab'|'newTab'} */
+ /** @type {'existingOrNewTab'|'newTab'|'popup'} */
let mode = 'existingOrNewTab';
let query = '';
if (typeof params === 'object' && params !== null) {
@@ -1023,6 +1023,8 @@ export class Backend {
case 'newTab':
await this._createTab(queryUrl);
return;
+ case 'popup':
+ return;
}
}
@@ -1034,10 +1036,10 @@ export class Backend {
}
/**
- * @param {undefined|{mode: 'existingOrNewTab'|'newTab'}} params
+ * @param {undefined|{mode: 'existingOrNewTab'|'newTab'|'popup'}} params
*/
async _onCommandOpenSettingsPage(params) {
- /** @type {'existingOrNewTab'|'newTab'} */
+ /** @type {'existingOrNewTab'|'newTab'|'popup'} */
let mode = 'existingOrNewTab';
if (typeof params === 'object' && params !== null) {
mode = this._normalizeOpenSettingsPageMode(params.mode, mode);
@@ -2544,7 +2546,7 @@ export class Backend {
}
/**
- * @param {'existingOrNewTab'|'newTab'} mode
+ * @param {'existingOrNewTab'|'newTab'|'popup'} mode
*/
async _openSettingsPage(mode) {
const manifest = chrome.runtime.getManifest();
@@ -2673,13 +2675,14 @@ export class Backend {
/**
* @param {unknown} mode
- * @param {'existingOrNewTab'|'newTab'} defaultValue
- * @returns {'existingOrNewTab'|'newTab'}
+ * @param {'existingOrNewTab'|'newTab'|'popup'} defaultValue
+ * @returns {'existingOrNewTab'|'newTab'|'popup'}
*/
_normalizeOpenSettingsPageMode(mode, defaultValue) {
switch (mode) {
case 'existingOrNewTab':
case 'newTab':
+ case 'popup':
return mode;
default:
return defaultValue;
diff --git a/ext/js/pages/action-popup-main.js b/ext/js/pages/action-popup-main.js
index 4125b2d1..9689e1af 100644
--- a/ext/js/pages/action-popup-main.js
+++ b/ext/js/pages/action-popup-main.js
@@ -114,7 +114,15 @@ class DisplayController {
const result = customHandler(e);
if (typeof result !== 'undefined') { return; }
}
- void this._api.commandExec(command, {mode: e.ctrlKey ? 'newTab' : 'existingOrNewTab'});
+
+ let mode = 'existingOrNewTab';
+ if (e.ctrlKey) {
+ mode = 'newTab';
+ } else if (e.shiftKey) {
+ mode = 'popup';
+ }
+
+ void this._api.commandExec(command, {mode: mode});
e.preventDefault();
};
/**