feat: add bindings and satisfy eslint

- add several bindings
- add wiktionary keys as alias of wikipedia
This commit is contained in:
Maddison Hellstrom 2019-03-07 15:10:15 -08:00
parent 7a1b5bcee9
commit 5d3e12a614
4 changed files with 162 additions and 102 deletions

View File

@ -15,7 +15,7 @@ Maddy's SurfingKeys Configuration
This is my personal configuration for the wonderful [SurfingKeys](https://github.com/brookhong/Surfingkeys) browser extension. This is my personal configuration for the wonderful [SurfingKeys](https://github.com/brookhong/Surfingkeys) browser extension.
Its primary features include [keybindings for performing common actions](#site-specific-key-mappings) on many popular Its primary features include [keybindings for performing common actions](#site-specific-key-mappings) on many popular
sites, as well as OmniBar support for [auto-completing searches](#bundled-search-engine-completions) within 44 sites (and growing)! sites, as well as OmniBar support for [auto-completing searches](#bundled-search-engine-completions) within 47 sites (and growing)!
Table of Contents Table of Contents
----------------- -----------------
@ -32,7 +32,7 @@ Features
### Site-Specific Key Mappings ### Site-Specific Key Mappings
181 key mappings for 16 unique 195 key mappings for 17 unique
sites have been included which can help you perform some common actions: sites have been included which can help you perform some common actions:
<table> <table>
@ -50,6 +50,8 @@ sites have been included which can help you perform some common actions:
<tr><td><code>&#x3D;w</code></td><td>Lookup whois information for domain</td></tr> <tr><td><code>&#x3D;w</code></td><td>Lookup whois information for domain</td></tr>
<tr><td><code>&#x3D;d</code></td><td>Lookup dns information for domain</td></tr> <tr><td><code>&#x3D;d</code></td><td>Lookup dns information for domain</td></tr>
<tr><td><code>&#x3D;D</code></td><td>Lookup all information for domain</td></tr> <tr><td><code>&#x3D;D</code></td><td>Lookup all information for domain</td></tr>
<tr><td><code>&#x3D;c</code></td><td>Show Google's cached version of page</td></tr>
<tr><td><code>&#x3D;a</code></td><td>Show Archive.org Wayback Machine for page</td></tr>
<tr><td><code>;pd</code></td><td>Toggle PDF viewer from SurfingKeys</td></tr> <tr><td><code>;pd</code></td><td>Toggle PDF viewer from SurfingKeys</td></tr>
<tr><th colspan="2"><a href="//amazon.com">amazon.com</a></th></tr><tr><td><strong>Mapping</strong></td><td><strong>Description</strong></td></tr> <tr><th colspan="2"><a href="//amazon.com">amazon.com</a></th></tr><tr><td><strong>Mapping</strong></td><td><strong>Description</strong></td></tr>
<tr><td><code>&lt;Space&gt;fs</code></td><td>Fakespot</td></tr> <tr><td><code>&lt;Space&gt;fs</code></td><td>Fakespot</td></tr>
@ -73,11 +75,13 @@ sites have been included which can help you perform some common actions:
<tr><td><code>&lt;Space&gt;u</code></td><td>View User</td></tr> <tr><td><code>&lt;Space&gt;u</code></td><td>View User</td></tr>
<tr><td><code>&lt;Space&gt;f</code></td><td>View File</td></tr> <tr><td><code>&lt;Space&gt;f</code></td><td>View File</td></tr>
<tr><td><code>&lt;Space&gt;i</code></td><td>View Issue</td></tr> <tr><td><code>&lt;Space&gt;i</code></td><td>View Issue</td></tr>
<tr><td><code>&lt;Space&gt;p</code></td><td>View Pull Request</td></tr>
<tr><td><code>gp</code></td><td>Go to parent</td></tr> <tr><td><code>gp</code></td><td>Go to parent</td></tr>
<tr><td><code>&lt;Space&gt;s</code></td><td>Toggle Star</td></tr> <tr><td><code>&lt;Space&gt;s</code></td><td>Toggle Star</td></tr>
<tr><td><code>&lt;Space&gt;S</code></td><td>Check Star</td></tr> <tr><td><code>&lt;Space&gt;S</code></td><td>Check Star</td></tr>
<tr><td><code>&lt;Space&gt;y</code></td><td>Copy Project Path</td></tr> <tr><td><code>&lt;Space&gt;y</code></td><td>Copy Project Path</td></tr>
<tr><td><code>&lt;Space&gt;Y</code></td><td>Copy Project Path (including domain)</td></tr> <tr><td><code>&lt;Space&gt;Y</code></td><td>Copy Project Path (including domain)</td></tr>
<tr><td><code>&lt;Space&gt;l</code></td><td>Toggle repo language stats</td></tr>
<tr><td><code>&lt;Space&gt;D</code></td><td>View GoDoc for Project</td></tr> <tr><td><code>&lt;Space&gt;D</code></td><td>View GoDoc for Project</td></tr>
<tr><th colspan="2"><a href="//gitlab.com">gitlab.com</a></th></tr><tr><td><strong>Mapping</strong></td><td><strong>Description</strong></td></tr> <tr><th colspan="2"><a href="//gitlab.com">gitlab.com</a></th></tr><tr><td><strong>Mapping</strong></td><td><strong>Description</strong></td></tr>
<tr><td><code>&lt;Space&gt;s</code></td><td>Toggle Star</td></tr> <tr><td><code>&lt;Space&gt;s</code></td><td>Toggle Star</td></tr>
@ -97,6 +101,8 @@ sites have been included which can help you perform some common actions:
<tr><td><code>&lt;Space&gt;c</code></td><td>View post (comments)</td></tr> <tr><td><code>&lt;Space&gt;c</code></td><td>View post (comments)</td></tr>
<tr><td><code>&lt;Space&gt;C</code></td><td>View post (comments) (new tab)</td></tr> <tr><td><code>&lt;Space&gt;C</code></td><td>View post (comments) (new tab)</td></tr>
<tr><td><code>gp</code></td><td>Go to parent</td></tr> <tr><td><code>gp</code></td><td>Go to parent</td></tr>
<tr><td><code>]]</code></td><td>Next page</td></tr>
<tr><td><code>[[</code></td><td>Prev page</td></tr>
<tr><th colspan="2"><a href="//producthunt.com">producthunt.com</a></th></tr><tr><td><strong>Mapping</strong></td><td><strong>Description</strong></td></tr> <tr><th colspan="2"><a href="//producthunt.com">producthunt.com</a></th></tr><tr><td><strong>Mapping</strong></td><td><strong>Description</strong></td></tr>
<tr><td><code>&lt;Space&gt;a</code></td><td>View product (external)</td></tr> <tr><td><code>&lt;Space&gt;a</code></td><td>View product (external)</td></tr>
<tr><td><code>&lt;Space&gt;v</code></td><td>View product</td></tr> <tr><td><code>&lt;Space&gt;v</code></td><td>View product</td></tr>
@ -124,6 +130,10 @@ sites have been included which can help you perform some common actions:
<tr><td><code>&lt;Space&gt;F</code></td><td>Toggle fullscreen</td></tr> <tr><td><code>&lt;Space&gt;F</code></td><td>Toggle fullscreen</td></tr>
<tr><th colspan="2"><a href="//wikipedia.org">wikipedia.org</a></th></tr><tr><td><strong>Mapping</strong></td><td><strong>Description</strong></td></tr> <tr><th colspan="2"><a href="//wikipedia.org">wikipedia.org</a></th></tr><tr><td><strong>Mapping</strong></td><td><strong>Description</strong></td></tr>
<tr><td><code>&lt;Space&gt;s</code></td><td>Toggle simple version of current article</td></tr> <tr><td><code>&lt;Space&gt;s</code></td><td>Toggle simple version of current article</td></tr>
<tr><td><code>&lt;Space&gt;a</code></td><td>View page</td></tr>
<tr><th colspan="2"><a href="//wiktionary.org">wiktionary.org</a></th></tr><tr><td><strong>Mapping</strong></td><td><strong>Description</strong></td></tr>
<tr><td><code>&lt;Space&gt;s</code></td><td>Toggle simple version of current article</td></tr>
<tr><td><code>&lt;Space&gt;a</code></td><td>View page</td></tr>
<tr><th colspan="2"><a href="//yelp.com">yelp.com</a></th></tr><tr><td><strong>Mapping</strong></td><td><strong>Description</strong></td></tr> <tr><th colspan="2"><a href="//yelp.com">yelp.com</a></th></tr><tr><td><strong>Mapping</strong></td><td><strong>Description</strong></td></tr>
<tr><td><code>&lt;Space&gt;fs</code></td><td>Fakespot</td></tr> <tr><td><code>&lt;Space&gt;fs</code></td><td>Fakespot</td></tr>
<tr><th colspan="2"><a href="//youtube.com">youtube.com</a></th></tr><tr><td><strong>Mapping</strong></td><td><strong>Description</strong></td></tr> <tr><th colspan="2"><a href="//youtube.com">youtube.com</a></th></tr><tr><td><strong>Mapping</strong></td><td><strong>Description</strong></td></tr>
@ -138,7 +148,7 @@ sites have been included which can help you perform some common actions:
### Bundled Search Engine Completions ### Bundled Search Engine Completions
There are currently 44 Search Engine auto-completions. There are currently 47 Search Engine auto-completions.
You can access a Search Engine auto-completion by pressing the search leader key, which is `a` by default, followed by the search engine alias. You can access a Search Engine auto-completion by pressing the search leader key, which is `a` by default, followed by the search engine alias.
@ -148,6 +158,8 @@ For example, to open the Wikipedia completion, you would type `awp` while in nor
| ----- | ---- | ------ | ----------- | | ----- | ---- | ------ | ----------- |
| `af` | `archforums` | `Google Custom Search` | | | `af` | `archforums` | `Google Custom Search` | |
| `al` | `archlinux` | `www.archlinux.org` | | | `al` | `archlinux` | `www.archlinux.org` | |
| `as` | `aws` | `google.com` | |
| `at` | `alternativeTo` | `alternativeto.net` | |
| `au` | `AUR` | `aur.archlinux.org` | | | `au` | `AUR` | `aur.archlinux.org` | |
| `aw` | `archwiki` | `wiki.archlinux.org` | | | `aw` | `archwiki` | `wiki.archlinux.org` | |
| `az` | `amazon` | `smile.amazon.com` | | | `az` | `amazon` | `smile.amazon.com` | |
@ -188,6 +200,7 @@ For example, to open the Wikipedia completion, you would type `awp` while in nor
| `wa` | `wolframalpha` | `www.wolframalpha.com` | [:framed_picture:](#wolframalpha) [:framed_picture:](#wolframalpha-2) | | `wa` | `wolframalpha` | `www.wolframalpha.com` | [:framed_picture:](#wolframalpha) [:framed_picture:](#wolframalpha-2) |
| `wp` | `wikipedia` | `en.wikipedia.org` | | | `wp` | `wikipedia` | `en.wikipedia.org` | |
| `ws` | `wikipedia-simple` | `simple.wikipedia.org` | | | `ws` | `wikipedia-simple` | `simple.wikipedia.org` | |
| `wt` | `wiktionary` | `en.wiktionary.org` | |
| `yp` | `yelp` | `www.yelp.com` | | | `yp` | `yelp` | `www.yelp.com` | |
| `yt` | `youtube` | `www.youtube.com` | [:framed_picture:](#youtube) | | `yt` | `youtube` | `www.youtube.com` | [:framed_picture:](#youtube) |

View File

@ -26,18 +26,16 @@ actions.getURLPath = ({ count = 0, domain = false } = {}) => {
return path return path
} }
actions.copyURLPath = ({ count, domain } = {}) => actions.copyURLPath = ({ count, domain } = {}) => () => Clipboard
() => Clipboard.write(actions.getURLPath({ count, domain })) .write(actions.getURLPath({ count, domain }))
// Whois/DNS lookup // Site/Page Information
// ---------------- // ---------------------
const domainDossierUrl = "http://centralops.net/co/DomainDossier.aspx" const domainDossierUrl = "http://centralops.net/co/DomainDossier.aspx"
actions.showWhois = ({ hostname = util.getCurrentLocation("hostname") } = {}) => actions.showWhois = ({ hostname = util.getCurrentLocation("hostname") } = {}) => () => actions.openLink(`${domainDossierUrl}?dom_whois=true&addr=${hostname}`, { newTab: true })()
() => actions.openLink(`${domainDossierUrl}?dom_whois=true&addr=${hostname}`, { newTab: true })()
actions.showDns = ({ hostname = util.getCurrentLocation("hostname"), verbose = false } = {}) => actions.showDns = ({ hostname = util.getCurrentLocation("hostname"), verbose = false } = {}) => () => {
() => {
let u = "" let u = ""
if (verbose) { if (verbose) {
u = `${domainDossierUrl}?dom_whois=true&dom_dns=true&traceroute=true&net_whois=true&svc_scan=true&addr=${hostname}` u = `${domainDossierUrl}?dom_whois=true&dom_dns=true&traceroute=true&net_whois=true&svc_scan=true&addr=${hostname}`
@ -45,28 +43,33 @@ actions.showDns = ({ hostname = util.getCurrentLocation("hostname"), verbose = f
u = `${domainDossierUrl}?dom_dns=true&addr=${hostname}` u = `${domainDossierUrl}?dom_dns=true&addr=${hostname}`
} }
actions.openLink(u, { newTab: true })() actions.openLink(u, { newTab: true })()
} }
const googleCacheUrl = "https://webcache.googleusercontent.com/search?q=cache:"
actions.showGoogleCache = ({ href = util.getCurrentLocation("href") } = {}) => () => actions.openLink(`${googleCacheUrl}${href}`, { newTab: true })()
const waybackUrl = "https://web.archive.org/web/*/"
actions.showWayback = ({ href = util.getCurrentLocation("href") } = {}) => () => actions.openLink(`${waybackUrl}${href}`, { newTab: true })()
// Surfingkeys-specific actions // Surfingkeys-specific actions
// ---------------------------- // ----------------------------
actions.createHint = (selector, action = Hints.dispatchMouseClick) => actions.createHint = (selector, action = Hints.dispatchMouseClick) => () => Hints
() => Hints.create(selector, action) .create(selector, action)
actions.openAnchor = ({ newTab = false, prop = "href" } = {}) => actions.openAnchor = ({ newTab = false, prop = "href" } = {}) => a => actions.openLink(a[prop], { newTab })()
a => actions.openLink(a[prop], { newTab })()
actions.openLink = (u, { newTab = false } = {}) => actions.openLink = (u, { newTab = false } = {}) => () => {
() => {
if (window === undefined) { if (window === undefined) {
return return
} }
window.open(u, newTab ? "_blank" : "_self") window.open(u, newTab ? "_blank" : "_self")
} }
actions.editSettings = actions.openLink("/pages/options.html", { newTab: true }) actions.editSettings = actions.openLink("/pages/options.html", { newTab: true })
actions.togglePdfViewer = () => actions.togglePdfViewer = () => chrome.storage.local.get("noPdfViewer", (resp) => {
chrome.storage.local.get("noPdfViewer", (resp) => {
if (!resp.noPdfViewer) { if (!resp.noPdfViewer) {
chrome.storage.local.set({ noPdfViewer: 1 }, () => { chrome.storage.local.set({ noPdfViewer: 1 }, () => {
Front.showBanner("PDF viewer disabled.") Front.showBanner("PDF viewer disabled.")
@ -76,20 +79,18 @@ actions.togglePdfViewer = () =>
Front.showBanner("PDF viewer enabled.") Front.showBanner("PDF viewer enabled.")
}) })
} }
}) })
// Site-specific actions // Site-specific actions
// ===================== // =====================
// FakeSpot // FakeSpot
// -------- // --------
actions.fakeSpot = actions.fakeSpot = (url = util.getCurrentLocation("href")) => actions.openLink(`http://fakespot.com/analyze?url=${url}`, { newTab: true })()
(url = util.getCurrentLocation("href")) => actions.openLink(`http://fakespot.com/analyze?url=${url}`, { newTab: true })()
// Godoc // Godoc
// ----- // -----
actions.viewGodoc = () => actions.viewGodoc = () => actions.openLink(`https://godoc.org/${actions.getURLPath({ count: 2, domain: true })}`, { newTab: true })()
actions.openLink(`https://godoc.org/${actions.getURLPath({ count: 2, domain: true })}`, { newTab: true })()
// GitHub // GitHub
// ------ // ------
@ -126,16 +127,14 @@ actions.gh.openRepo = () => {
const u = new URL(a.href) const u = new URL(a.href)
const [user, repo, ...rest] = u.pathname.split("/").filter(s => s !== "") const [user, repo, ...rest] = u.pathname.split("/").filter(s => s !== "")
return ( return (
u.origin === util.getCurrentLocation("origin") && u.origin === util.getCurrentLocation("origin")
u.hash === "" && && typeof user === "string"
u.search === "" && && user.length > 0
typeof user === "string" && && typeof repo === "string"
user.length > 0 && && repo.length > 0
typeof repo === "string" && && rest.length === 0
repo.length > 0 && && /^([a-zA-Z0-9]+-?)+$/.test(user)
rest.length === 0 && && !ghReservedNames.check(user)
/^([a-zA-Z0-9]+-?)+$/.test(user) &&
!ghReservedNames.check(user)
) )
}) })
Hints.create(elements, Hints.dispatchMouseClick) Hints.create(elements, Hints.dispatchMouseClick)
@ -147,14 +146,12 @@ actions.gh.openUser = () => {
const u = new URL(a.href) const u = new URL(a.href)
const [user, ...rest] = u.pathname.split("/").filter(s => s !== "") const [user, ...rest] = u.pathname.split("/").filter(s => s !== "")
return ( return (
u.origin === util.getCurrentLocation("origin") && u.origin === util.getCurrentLocation("origin")
u.hash === "" && && typeof user === "string"
u.search === "" && && user.length > 0
typeof user === "string" && && rest.length === 0
user.length > 0 && && /^([a-zA-Z0-9]+-?)+$/.test(user)
rest.length === 0 && && !ghReservedNames.check(user)
/^([a-zA-Z0-9]+-?)+$/.test(user) &&
!ghReservedNames.check(user)
) )
}) })
Hints.create(elements, Hints.dispatchMouseClick) Hints.create(elements, Hints.dispatchMouseClick)
@ -166,18 +163,16 @@ actions.gh.openFile = () => {
const u = new URL(a.href) const u = new URL(a.href)
const [user, repo, maybeBlob, ...rest] = u.pathname.split("/").filter(s => s !== "") const [user, repo, maybeBlob, ...rest] = u.pathname.split("/").filter(s => s !== "")
return ( return (
u.origin === util.getCurrentLocation("origin") && u.origin === util.getCurrentLocation("origin")
u.hash === "" && && typeof user === "string"
u.search === "" && && user.length > 0
typeof user === "string" && && typeof repo === "string"
user.length > 0 && && repo.length > 0
typeof repo === "string" && && typeof maybeBlob === "string"
repo.length > 0 && && (maybeBlob === "blob" || maybeBlob === "tree")
typeof maybeBlob === "string" && && rest.length !== 0
(maybeBlob === "blob" || maybeBlob === "tree") && && /^([a-zA-Z0-9]+-?)+$/.test(user)
rest.length !== 0 && && !ghReservedNames.check(user)
/^([a-zA-Z0-9]+-?)+$/.test(user) &&
!ghReservedNames.check(user)
) )
}) })
Hints.create(elements, Hints.dispatchMouseClick) Hints.create(elements, Hints.dispatchMouseClick)
@ -189,25 +184,43 @@ actions.gh.openIssue = () => {
const u = new URL(a.href) const u = new URL(a.href)
const [user, repo, maybeIssues] = u.pathname.split("/").filter(s => s !== "") const [user, repo, maybeIssues] = u.pathname.split("/").filter(s => s !== "")
return ( return (
u.origin === util.getCurrentLocation("origin") && u.origin === util.getCurrentLocation("origin")
u.hash === "" && && typeof user === "string"
u.search === "" && && user.length > 0
typeof user === "string" && && typeof repo === "string"
user.length > 0 && && repo.length > 0
typeof repo === "string" && && maybeIssues === "issues"
repo.length > 0 && && /^([a-zA-Z0-9]+-?)+$/.test(user)
maybeIssues === "issues" && && !ghReservedNames.check(user)
/^([a-zA-Z0-9]+-?)+$/.test(user) &&
!ghReservedNames.check(user)
) )
}) })
Hints.create(elements, Hints.dispatchMouseClick) Hints.create(elements, Hints.dispatchMouseClick)
} }
actions.gh.openPull = () => {
const elements = [...document.querySelectorAll("a[href]")]
.filter((a) => {
const u = new URL(a.href)
const [user, repo, maybePulls] = u.pathname.split("/").filter(s => s !== "")
return (
u.origin === util.getCurrentLocation("origin")
&& typeof user === "string"
&& user.length > 0
&& typeof repo === "string"
&& repo.length > 0
&& /^pulls?$/.test(maybePulls)
&& /^([a-zA-Z0-9]+-?)+$/.test(user)
&& !ghReservedNames.check(user)
)
})
Hints.create(elements, Hints.dispatchMouseClick)
}
actions.gh.toggleLangStats = () => document.querySelector("button.js-toggle-lang-stats").click()
actions.gh.goParent = () => { actions.gh.goParent = () => {
const segments = util.getCurrentLocation("pathname") const segments = util.getCurrentLocation("pathname")
.split("/").filter(s => s !== "") .split("/").filter(s => s !== "")
console.log(`goParent: ${segments}`)
const newPath = (() => { const newPath = (() => {
const [user, repo, maybeBlob] = segments const [user, repo, maybeBlob] = segments
switch (segments.length) { switch (segments.length) {
@ -220,18 +233,22 @@ actions.gh.goParent = () => {
return [user, repo] return [user, repo]
case "pull": case "pull":
return [user, repo, "pulls"] return [user, repo, "pulls"]
default:
break
} }
break
case 5: case 5:
if (maybeBlob === "blob") { if (maybeBlob === "blob") {
return [user, repo] return [user, repo]
} }
break
default:
break
} }
return segments.slice(0, segments.length - 1) return segments.slice(0, segments.length - 1)
})() })()
console.log(`newPath: ${newPath}`)
if (newPath !== false) { if (newPath !== false) {
const u = `${util.getCurrentLocation("origin")}/${newPath.join("/")}` const u = `${util.getCurrentLocation("origin")}/${newPath.join("/")}`
console.log(`newPath u: ${u}`)
actions.openLink(u)() actions.openLink(u)()
} }
} }
@ -271,7 +288,6 @@ actions.re.toggleVisibleExpandos = (dir = 0) => () => {
} else if (dir === 1) { } else if (dir === 1) {
sel += ".collapsed" sel += ".collapsed"
} }
console.log(sel)
Array.from(document.querySelectorAll(sel)) Array.from(document.querySelectorAll(sel))
.filter(e => util.isElementInViewport(e)) .filter(e => util.isElementInViewport(e))
.forEach(e => e.click()) .forEach(e => e.click())
@ -323,18 +339,16 @@ actions.hn.goPage = (dist = 1) => {
// ----------- // -----------
actions.ph = {} actions.ph = {}
actions.ph.openExternal = () => { actions.ph.openExternal = () => {
Hints.create("ul[class^='postsList_'] > li > div[class^='item_']", p => Hints.create("ul[class^='postsList_'] > li > div[class^='item_']", p => actions.openLink(
actions.openLink( p.querySelector("div[class^='meta_'] > div[class^='actions_'] > div[class^='minorActions_'] > a:nth-child(1)").href,
p.querySelector("div[class^='meta_'] > div[class^='actions_'] > div[class^='minorActions_'] > a:nth-child(1)").href { newTab: true }
, { newTab: true }
)()) )())
} }
// Dribbble // Dribbble
// -------- // --------
actions.dr = {} actions.dr = {}
actions.dr.attachment = (cb = a => actions.openLink(a, { newTab: true })()) => actions.dr.attachment = (cb = a => actions.openLink(a, { newTab: true })()) => actions.createHint(".attachments .thumb", a => cb(a.src.replace("/thumbnail/", "/")))
actions.createHint(".attachments .thumb", a => cb(a.src.replace("/thumbnail/", "/")))
// Wikipedia // Wikipedia
// --------- // ---------
@ -348,6 +362,7 @@ actions.wp.toggleSimple = () => {
} }
return s return s
}).filter(s => s !== "").join(".") }).filter(s => s !== "").join(".")
actions.openLink(u.href)()
} }
module.exports = actions module.exports = actions

View File

@ -18,6 +18,7 @@ const keys = {
google_yt: "", // https://developers.google.com/youtube/v3/docs/ google_yt: "", // https://developers.google.com/youtube/v3/docs/
wolframalpha: "", // https://products.wolframalpha.com/api/ wolframalpha: "", // https://products.wolframalpha.com/api/
domainr: "", // https://market.mashape.com/domainr/domainr domainr: "", // https://market.mashape.com/domainr/domainr
alternativeTo: "", // Extract the x-algolia-api-key sent with requests when typing in search box on alternativeto.net
// ****** Google Custom Search Engines ****** // // ****** Google Custom Search Engines ****** //
// Can be created at https://cse.google.com/cse // Can be created at https://cse.google.com/cse

35
keys.js
View File

@ -12,6 +12,7 @@ const unmaps = {
"zz", "zR", "ab", "zz", "zR", "ab",
"Q", "q", "ag", "Q", "q", "ag",
"af", ";s", "yp", "af", ";s", "yp",
"<Ctrl-j>", "<Ctrl-h>",
], ],
searchAliases: { searchAliases: {
s: ["g", "d", "b", s: ["g", "d", "b",
@ -92,6 +93,18 @@ const maps = {
description: "Lookup all information for domain", description: "Lookup all information for domain",
callback: actions.showDns({ verbose: true }), callback: actions.showDns({ verbose: true }),
}, },
{
alias: "=c",
category: categories.misc,
description: "Show Google's cached version of page",
callback: actions.showGoogleCache(),
},
{
alias: "=a",
category: categories.misc,
description: "Show Archive.org Wayback Machine for page",
callback: actions.showWayback(),
},
{ {
alias: ";pd", alias: ";pd",
category: categories.misc, category: categories.misc,
@ -112,12 +125,12 @@ const maps = {
{ {
alias: "a", alias: "a",
description: "Open search result", description: "Open search result",
callback: actions.createHint(".r>a"), callback: actions.createHint("a.fl, .r>a"),
}, },
{ {
alias: "A", alias: "A",
description: "Open search result (new tab)", description: "Open search result (new tab)",
callback: actions.createHint(".r>a", actions.openAnchor({ newTab: true })), callback: actions.createHint("a.fl, .r>a", actions.openAnchor({ newTab: true })),
}, },
], ],
@ -192,6 +205,11 @@ const maps = {
description: "View Issue", description: "View Issue",
callback: actions.gh.openIssue, callback: actions.gh.openIssue,
}, },
{
alias: "p",
description: "View Pull Request",
callback: actions.gh.openPull,
},
{ {
leader: "", leader: "",
alias: "gp", alias: "gp",
@ -218,6 +236,11 @@ const maps = {
description: "Copy Project Path (including domain)", description: "Copy Project Path (including domain)",
callback: actions.copyURLPath({ count: 2, domain: true }), callback: actions.copyURLPath({ count: 2, domain: true }),
}, },
{
alias: "l",
description: "Toggle repo language stats",
callback: actions.gh.toggleLangStats,
},
{ {
alias: "D", alias: "D",
description: "View GoDoc for Project", description: "View GoDoc for Project",
@ -493,7 +516,15 @@ const maps = {
description: "Toggle simple version of current article", description: "Toggle simple version of current article",
callback: actions.wp.toggleSimple, callback: actions.wp.toggleSimple,
}, },
{
alias: "a",
description: "View page",
callback: actions.createHint("#bodyContent :not(sup):not(.mw-editsection) > a"),
},
], ],
} }
// Aliases
maps["wiktionary.org"] = maps["wikipedia.org"]
module.exports = { unmaps, maps } module.exports = { unmaps, maps }