feat(keys): add hn action to open link & comments
This commit is contained in:
parent
d649f71c02
commit
be1edbff68
|
@ -97,7 +97,7 @@ sites have been included which can help you perform some common actions:
|
|||
<tr><td><code><Space>s</code></td><td>Upvote</td></tr>
|
||||
<tr><td><code><Space>S</code></td><td>Downvote</td></tr>
|
||||
<tr><td><code><Space>a</code></td><td>View post (link)</td></tr>
|
||||
<tr><td><code><Space>A</code></td><td>View post (link) (new tab)</td></tr>
|
||||
<tr><td><code><Space>A</code></td><td>View post (link and comments)</td></tr>
|
||||
<tr><td><code><Space>c</code></td><td>View post (comments)</td></tr>
|
||||
<tr><td><code><Space>C</code></td><td>View post (comments) (new tab)</td></tr>
|
||||
<tr><td><code>gp</code></td><td>Go to parent</td></tr>
|
||||
|
|
|
@ -335,6 +335,13 @@ actions.hn.goPage = (dist = 1) => {
|
|||
actions.openLink(u.href)()
|
||||
}
|
||||
|
||||
actions.hn.openLinkAndComments = (e) => {
|
||||
const linkUrl = e.querySelector("a.storylink").href
|
||||
const commentsUrl = e.nextElementSibling.querySelector("td > a[href*='item']:not(.storylink)").href
|
||||
actions.openLink(commentsUrl, { newTab: true })()
|
||||
actions.openLink(linkUrl, { newTab: true })()
|
||||
}
|
||||
|
||||
// ProductHunt
|
||||
// -----------
|
||||
actions.ph = {}
|
||||
|
|
4
keys.js
4
keys.js
|
@ -390,8 +390,8 @@ const maps = {
|
|||
},
|
||||
{
|
||||
alias: "A",
|
||||
description: "View post (link) (new tab)",
|
||||
callback: actions.createHint(".storylink", actions.openAnchor({ newTab: true })),
|
||||
description: "View post (link and comments)",
|
||||
callback: actions.createHint(".athing", actions.hn.openLinkAndComments),
|
||||
},
|
||||
{
|
||||
alias: "c",
|
||||
|
|
Loading…
Reference in New Issue