[src:feat] add WikiRank binding

This commit is contained in:
Maddison Hellstrom 2020-12-15 20:46:57 -08:00
parent 029869f8a0
commit 25b44e8f5c
2 changed files with 16 additions and 0 deletions

View File

@ -704,6 +704,17 @@ actions.wp.toggleSimple = () => {
actions.openLink(u.href)()
}
actions.wp.viewWikiRank = () => {
const h = document.location.hostname.split(".")
const lang = h.length > 2 && h[0] !== "www" ? h[0] : "en"
const p = document.location.pathname.split("/")
if (p.length < 3 || p[1] !== "wiki") {
return
}
const article = p.slice(2).join("/")
actions.openLink(`https://wikirank.net/${lang}/${article}`, { newTab: true })()
}
// Nest Thermostat Controller
// --------------------------
actions.nt = {}

View File

@ -733,6 +733,11 @@ const maps = {
description: "View external link",
callback: actions.createHint("a[rel=nofollow]"),
},
{
alias: "R",
description: "View WikiRank for current article",
callback: actions.wp.viewWikiRank,
},
],
"craigslist.org": [