Last active
November 6, 2019 06:21
-
-
Save moshohayeb/446efe415b1dc2bdcc5aeea630f99676 to your computer and use it in GitHub Desktop.
SurfingKeys
This file contains 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
// an example to create a new mapping `ctrl-y` | |
mapkey('<Ctrl-y>', 'Show me the money', function() { | |
Front.showPopup('a well-known phrase uttered by characters in the 1996 film Jerry Maguire (Escape to close).'); | |
}); | |
// an example to replace `T` with `gt`, click `Default mappings` to see how `T` works. | |
map('gt', 'T'); | |
// an example to remove mapkey `Ctrl-i` | |
unmap('<Ctrl-i>'); | |
// set theme | |
settings.theme = ` | |
.sk_theme { | |
font-family: Input Sans Condensed, Charcoal, sans-serif; | |
font-size: 10pt; | |
background: #24272e; | |
color: #abb2bf; | |
} | |
.sk_theme tbody { | |
color: #fff; | |
} | |
.sk_theme input { | |
color: #d0d0d0; | |
} | |
.sk_theme .url { | |
color: #61afef; | |
} | |
.sk_theme .annotation { | |
color: #56b6c2; | |
} | |
.sk_theme .omnibar_highlight { | |
color: #528bff; | |
} | |
.sk_theme .omnibar_timestamp { | |
color: #e5c07b; | |
} | |
.sk_theme .omnibar_visitcount { | |
color: #98c379; | |
} | |
.sk_theme #sk_omnibarSearchResult>ul>li:nth-child(odd) { | |
background: #303030; | |
} | |
.sk_theme #sk_omnibarSearchResult>ul>li.focused { | |
background: #3e4452; | |
} | |
#sk_status, #sk_find { | |
font-size: 20pt; | |
}`; | |
// click `Save` button to make above settings to take effect. | |
// Styles | |
Hints.style('border: solid 1px #527b96; color:#1B2229; background: initial; background-color: #51afef;'); | |
// Hints.style("border: solid 8px #C38A22;padding: 1px;background: #e39913", "text"); | |
// Settings | |
settings.modeAfterYank = "Normal"; | |
settings.hintsThreshold = 1000; | |
settings.focusFirstCandidate = true; | |
settings.tabsThreshold = 10; | |
settings.scrollStepSize = 140; | |
settings.showProxyInStatusBar = false; | |
settings.interceptedErrors = ['*']; | |
settings.newTabPosition = "default" | |
settings.hintAlign = "left"; | |
settings.cursorAtEndOfInput = true; | |
settings.blacklist = { } | |
// Search Engines | |
addSearchAliasX('s', 'stackoverflow', 'http://stackoverflow.com/search?q=', 'o'); | |
addSearchAliasX('h', 'github', 'https://github.com/search?q=', '1') | |
// Change Baidu to Bing | |
vmap("sB", "sW"); | |
vmap("sb", "sw"); | |
vmap("sob", "sow"); | |
map("ob", "ow"); | |
// General bindings | |
map("F", "af") // Open link follow | |
map("gF", "gf") // Open link no follow | |
map("gs", "se"); // Goto settings | |
map("oc", "go"); // Open URL current tab | |
map("ga", "oh"); // Open URL new tab | |
map("<Ctrl-f>", "d"); // Scroll down | |
map("<Ctrl-b>", "e"); // Scroll up | |
map('P', 'cc'); // Open clipboard URL | |
map('gr', 'r'); // Refresh | |
map("oe", "sU") // Edit current URL new tab | |
map("oE", "su") // Edit current URL | |
// Navigation | |
map('a', "S"); // Forward | |
map('d', "D"); // Back | |
map('r', 'R'); // Right | |
map('e', 'E'); // Left | |
// map('T', 't'); | |
map('t', 'T'); | |
// AceEditor | |
aceVimMap('jk', '<Esc>', 'insert'); | |
// Tabs | |
mapkey('<Space><Space>', 'Choose a tab with omnibar', function() { | |
Front.openOmnibar({type: "Tabs"}); | |
}); | |
// Youtube | |
mapkey('p', "Toggle fullscreen (YouTube)", click('.ytp-play-button'), { domain: /(youtube\.com)/i }); | |
mapkey('f', "Toggle fullscreen (YouTube)", click('.ytp-fullscreen-button'), { domain: /(youtube\.com)/i }); | |
mapkey('m', 'Mute (Youtube)', click('.ytp-mute-button'), { domain: /(youtube\.com)/i }); | |
mapkey("c", "Toggle Top Comment (Reddit)", | |
click(".sitetable.nestedlisting > .noncollapsed.comment > .entry a.expand"), | |
{ domain: /(reddit\.com)/i } | |
); | |
// FakeSpot | |
mapkey(',fs', "Run fakespot for the current page (Amazon, Yelp)", fakeSpot, { | |
repeatIgnore: true, | |
domain: /(amazon\.com|yelp\.com)/i | |
}); | |
// Whois | |
mapkey(',wi', "Lookup whois information for domain", whois, { | |
repeatIgnore: true | |
}); | |
// Functions | |
function click(selector) { | |
return _click.bind(this, selector); | |
} | |
function _click(selector) { | |
document.querySelectorAll(selector)[0].click(); | |
} | |
function fakeSpot() { | |
var url = "http://fakespot.com/analyze?url=" + window.location.href; | |
window.open(url, '_blank').focus(); | |
} | |
function whois() { | |
var url = "https://who.is/whois/" + window.location.hostname; | |
window.open(url, '_blank').focus(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment