Skip to content

Commit

Permalink
Added setting to open hints in background when holding shift (brookho…
Browse files Browse the repository at this point in the history
…ng#1159)

* Added setting to open hints in background when holding shift

* explicitly use active behavior for 'af' mapping

* updated doc, but not sure how best to translate..

* updated settings in EN README
  • Loading branch information
j-hui authored Mar 2, 2020
1 parent 889e1ca commit 0dea804
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 4 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -659,6 +659,8 @@ For example,
| settings.nextLinkRegex | /((>>|next)+)/i | A regex to match links that indicate next page. |
| settings.prevLinkRegex | /((<<&#124;prev(ious)?)+)/i| A regex to match links that indicate previous page. |
| settings.hintAlign | "center" | Alignment of hints on their target elements. ["left", "center", "right"] |
| settings.hintExplicit | false | Whether to wait for explicit input when there is only a single hint available |
| settings.hintShiftNonActive | false | Whether new tab is active after entering hint while holding shift |
| settings.defaultSearchEngine | "g" | The default search engine used in Omnibar. |
| settings.blacklistPattern | undefined | A regex to match the sites that will have Surfingkeys disabled. |
| settings.focusAfterClosed | "right" | Which tab will be focused after the current tab is closed. ["left", "right", "last"] |
Expand Down
5 changes: 4 additions & 1 deletion content_scripts/hints.js
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,10 @@ function createHints() {
active = false;
}

if (shiftKey && window.navigator.userAgent.indexOf("Firefox") !== -1) {
if (shiftKey && runtime.conf.hintShiftNonActive) {
tabbed = true;
active = false;
} else if (shiftKey && window.navigator.userAgent.indexOf("Firefox") !== -1) {
// mouseButton does not work for firefox in mouse event.
tabbed = true;
active = true;
Expand Down
1 change: 1 addition & 0 deletions content_scripts/runtime.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ var runtime = (function() {
focusOnSaved: true,
hintAlign: "center",
hintExplicit: false,
hintShiftNonActive: false,
historyMUOrder: true,
language: undefined,
lastQuery: "",
Expand Down
4 changes: 2 additions & 2 deletions pages/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ mapkey('?', '#0Show usage', function() {
Front.showUsage();
});
map('u', 'e');
mapkey('af', '#1Open a link in new tab', function() {
Hints.create("", Hints.dispatchMouseClick, {tabbed: true});
mapkey('af', '#1Open a link in active new tab', function() {
Hints.create("", Hints.dispatchMouseClick, {tabbed: true, active: true});
});
mapkey('gf', '#1Open a link in non-active new tab', function() {
Hints.create("", Hints.dispatchMouseClick, {tabbed: true, active: false});
Expand Down
2 changes: 1 addition & 1 deletion pages/l10n.json
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@
"Open a URL": "打开网页",
"Open a URL in current tab": "在当前标签页打开网页",
"Open a bookmark": "打开一个收藏",
"Open a link in new tab": "在新标签页打开链接",
"Open a link in active new tab": "在新标签页打开链接",
"Open a link in non-active new tab": "在新标签页后台打开链接",
"Open a link, press SHIFT to flip hints if they are overlapped.": "打开链接,如果拨号键有重叠按SHIFT",
"Open commands": "打开命令",
Expand Down

0 comments on commit 0dea804

Please sign in to comment.