summaryrefslogtreecommitdiff
path: root/ext/bg/js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2019-10-19 22:54:58 -0400
committertoasted-nutbread <toasted-nutbread@users.noreply.github.com>2019-10-19 22:54:58 -0400
commit7abc7fd0e797f11bec98924b19653de6eea46c5f (patch)
tree9813ba1fa537e35f8b33c8a6d1cb4be6dde87483 /ext/bg/js
parent205498ef3b84c5acfe7ee2a76e4085260bc7a3ef (diff)
Use links instead of buttons on context page
Diffstat (limited to 'ext/bg/js')
-rw-r--r--ext/bg/js/context.js18
1 files changed, 13 insertions, 5 deletions
diff --git a/ext/bg/js/context.js b/ext/bg/js/context.js
index a16c8769..8e1dbce6 100644
--- a/ext/bg/js/context.js
+++ b/ext/bg/js/context.js
@@ -25,9 +25,9 @@ function showExtensionInfo() {
node.textContent = `${manifest.name} v${manifest.version}`;
}
-function setupButtonEvents(selector, command) {
- $(selector)
- .on('click', (e) => {
+function setupButtonEvents(selector, command, url) {
+ const node = $(selector);
+ node.on('click', (e) => {
if (e.button !== 0) { return; }
apiCommandExec(command, {newTab: e.ctrlKey});
e.preventDefault();
@@ -37,6 +37,12 @@ function setupButtonEvents(selector, command) {
apiCommandExec(command, {newTab: true});
e.preventDefault();
});
+
+ if (typeof url === 'string') {
+ node.attr('href', url);
+ node.attr('target', '_blank');
+ node.attr('rel', 'noopener');
+ }
}
$(document).ready(utilAsync(() => {
@@ -47,8 +53,10 @@ $(document).ready(utilAsync(() => {
document.documentElement.dataset.mode = (browser === 'firefox-mobile' ? 'full' : 'mini');
});
- setupButtonEvents('.action-open-search', 'search');
- setupButtonEvents('.action-open-options', 'options');
+ const manifest = chrome.runtime.getManifest();
+
+ setupButtonEvents('.action-open-search', 'search', chrome.extension.getURL('/bg/search.html'));
+ setupButtonEvents('.action-open-options', 'options', chrome.extension.getURL(manifest.options_ui.page));
setupButtonEvents('.action-open-help', 'help');
const optionsContext = {