diff options
| -rw-r--r-- | ext/bg/context.html | 6 | ||||
| -rw-r--r-- | ext/bg/js/context.js | 18 | 
2 files changed, 16 insertions, 8 deletions
| diff --git a/ext/bg/context.html b/ext/bg/context.html index 85203053..ace40656 100644 --- a/ext/bg/context.html +++ b/ext/bg/context.html @@ -91,9 +91,9 @@                  <input type="checkbox" id="enable-search">              </div>              <div class="btn-group"> -                <button type="button" title="Search (Alt + Insert)" class="btn btn-default btn-xs action-open-search"><span class="glyphicon glyphicon-search"></span></button> -                <button type="button" title="Options" class="btn btn-default btn-xs action-open-options"><span class="glyphicon glyphicon-wrench"></span></button> -                <button type="button" title="Help" class="btn btn-default btn-xs action-open-help"><span class="glyphicon glyphicon-question-sign"></span></button> +                <a title="Search (Alt + Insert)" class="btn btn-default btn-xs action-open-search"><span class="glyphicon glyphicon-search"></span></a> +                <a title="Options" class="btn btn-default btn-xs action-open-options"><span class="glyphicon glyphicon-wrench"></span></a> +                <a title="Help" class="btn btn-default btn-xs action-open-help"><span class="glyphicon glyphicon-question-sign"></span></a>              </div>          </div>          <div id="full"> 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 = { |