tweak: uppercase bindings open in inactive new tab

- site bindings like `<space>A` on google search now open in an inactive
new tab
- change signature of `openAnchor` function to accept `active` parameter,
as in `openLink` function
This commit is contained in:
Maddison Hellstrom 2019-06-03 12:43:27 -07:00
parent 2ddaa0806e
commit bb29646b15
2 changed files with 13 additions and 13 deletions

View File

@ -61,7 +61,7 @@ actions.createHint = (selector, action) => () => {
Hints.create(selector, action)
}
actions.openAnchor = ({ newTab = false, prop = "href" } = {}) => a => actions.openLink(a[prop], { newTab })()
actions.openAnchor = ({ newTab = false, active = true, prop = "href" } = {}) => a => actions.openLink(a[prop], { newTab, active })()
actions.openLink = (url, { newTab = false, active = true } = {}) => () => {
if (newTab) {

24
keys.js
View File

@ -140,8 +140,8 @@ const maps = {
},
{
alias: "A",
description: "Open search result (new tab)",
callback: actions.createHint("a.fl, .r>a", actions.openAnchor({ newTab: true })),
description: "Open search result (non-active new tab)",
callback: actions.createHint("a.fl, .r>a", actions.openAnchor({ newTab: true, active: false })),
},
],
@ -358,8 +358,8 @@ const maps = {
},
{
alias: "A",
description: "View post (link) (new tab)",
callback: actions.createHint(".title", actions.openAnchor({ newTab: true })),
description: "View post (link) (non-active new tab)",
callback: actions.createHint(".title", actions.openAnchor({ newTab: true, active: false })),
},
{
alias: "c",
@ -368,8 +368,8 @@ const maps = {
},
{
alias: "C",
description: "View post (comments) (new tab)",
callback: actions.createHint(".comments", actions.openAnchor({ newTab: true })),
description: "View post (comments) (non-active new tab)",
callback: actions.createHint(".comments", actions.openAnchor({ newTab: true, active: false })),
},
],
@ -411,8 +411,8 @@ const maps = {
},
{
alias: "C",
description: "View post (comments) (new tab)",
callback: actions.createHint("td > a[href*='item']:not(.storylink)", actions.openAnchor({ newTab: true })),
description: "View post (comments) (non-active new tab)",
callback: actions.createHint("td > a[href*='item']:not(.storylink)", actions.openAnchor({ newTab: true, active: false })),
},
{
leader: "",
@ -465,8 +465,8 @@ const maps = {
},
{
alias: "A",
description: "View shot (new tab)",
callback: actions.createHint(".dribbble-over, .gif-target, .more-thumbs a", actions.openAnchor({ newTab: true })),
description: "View shot (non-active new tab)",
callback: actions.createHint(".dribbble-over, .gif-target, .more-thumbs a", actions.openAnchor({ newTab: true, active: false })),
},
{
alias: "v",
@ -503,8 +503,8 @@ const maps = {
},
{
alias: "A",
description: "View project (new tab)",
callback: actions.createHint(".rf-project-cover__title", actions.openAnchor({ newTab: true })),
description: "View project (non-active new tab)",
callback: actions.createHint(".rf-project-cover__title", actions.openAnchor({ newTab: true, active: false })),
},
],