Last active
December 8, 2018 13:48
-
-
Save duguyipiao/8daeb6cf285bbfeb3ff7aa9a9a82305c to your computer and use it in GitHub Desktop.
Config of surfingkeys
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Remap | |
// '>_w' is a temp key | |
map('>_w', 'w'); | |
map('w', 'S'); | |
map('S','>_w'); | |
unmap('>_w'); | |
map('q','D'); | |
map('h','E'); | |
map('l','R'); | |
map('u','X'); | |
map('f', 'gf', /arxiv.org\/list/i); | |
// Add exceptions for some websites | |
// unmapAllExcept(['x','h','E','R','f'], /theoldreader.com/i); | |
const unmapsReader = ['j','k','l','v','o'] | |
unmapsReader.forEach((u) => { | |
unmap(u, /theoldreader.com/i) | |
}); | |
// Add search engines | |
addSearchAliasX('i', 'iciba', 'http://www.iciba.com/'); | |
addSearchAliasX('t', 'translate(auto|en)', 'https://translate.google.com/#auto/en/'); | |
addSearchAliasX('z', 'translate(auto|zh-CN)', 'https://translate.google.com/#auto/zh-CN/'); | |
addSearchAliasX('c', 'cambridge', 'https://dictionary.cambridge.org/search/english/direct/?q='); | |
addSearchAliasX('w', 'merriam-webster', 'https://www.merriam-webster.com/dictionary/'); | |
addSearchAliasX('s', 'startpage', 'https://www.startpage.com/do/dsearch?query='); | |
addSearchAliasX('qr', 'qrcode', 'https://chart.apis.google.com/chart?cht=qr&chs=350x350&chl='); | |
// Open selected link or link from clipboard | |
function openLinkInNewTab(url) { | |
RUNTIME("openLink", { | |
tab: { | |
tabbed: true, | |
active: true | |
}, | |
url: url | |
}); | |
} | |
mapkey('sr', 'Open selected link or link from clipboard', function() { | |
if (window.getSelection().toString()) { | |
openLinkInNewTab(window.getSelection().toString()); | |
} else { | |
Front.getContentFromClipboard(function(response) { | |
openLinkInNewTab(response.data); | |
}); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment