Last active
August 7, 2022 19:38
-
-
Save Tanath/3802c263d90cbc78ec1ab2231f85505a to your computer and use it in GitHub Desktop.
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
const { | |
aceVimMap, | |
mapkey, | |
imap, | |
imapkey, | |
getClickableElements, | |
vmapkey, | |
map, | |
unmap, | |
unmapAllExcept, | |
vunmap, | |
cmap, | |
addSearchAlias, | |
removeSearchAlias, | |
tabOpenLink, | |
readText, | |
Clipboard, | |
Front, | |
Hints, | |
Visual, | |
RUNTIME | |
} = api; | |
// Misc settings | |
settings.hintExplicit = true; | |
settings.nextLinkRegex = /((>>|→|»|next|newer|forward)+)/i; | |
settings.prevLinkRegex = /((<<|←|«|prev(ious)?|older|back(ward)?)+)/i; | |
Hints.setCharacters("fdsagrewqtvcxzbuiopynm"); | |
settings.smoothScroll = false; | |
settings.scrollStepSize = 140 | |
// Searches | |
addSearchAlias('g', 'Google.ca', 'https://www.google.ca/search?safe=off&num=20&q=', 'https://www.google.ca/complete/search?client=chrome&q='); | |
addSearchAlias('alt', 'AlternativeTo', 'https://alternativeto.net/browse/search?q='); | |
addSearchAlias('ol', 'Onelook', 'https://www.onelook.com/?w='); | |
addSearchAlias('wp', 'Wikipedia', 'https://en.wikipedia.org/w/index.php?title=Special:Search&search='); | |
addSearchAlias('aw', 'Arch Wiki', 'https://wiki.archlinux.org/index.php?title=Special:Search&search=', 's'); | |
// Mappings | |
api.mapkey(';U', '#4Edit current URL with vim editor, and open in new tab', function() { | |
Front.showEditor(window.location.href, function(data) { | |
tabOpenLink(data); | |
}, 'url'); | |
}); | |
api.mapkey(';u', '#4Edit current URL with vim editor, and reload', function() { | |
Front.showEditor(window.location.href, function(data) { | |
window.location.href = data; | |
}, 'url'); | |
}); | |
api.mapkey('<Alt-]>', 'Increase video speed', function() { | |
document.querySelector('video').playbackRate+=0.2; | |
}); | |
api.mapkey('<Alt-[>', 'Decrease video speed', function() { | |
document.querySelector('video').playbackRate-=0.2; | |
}); | |
api.mapkey('<Alt-=>', 'Reset video speed', function() { | |
document.querySelector('video').playbackRate=1; | |
}); | |
api.mapkey('<Alt-/>', 'Enable selecting text', function() { | |
var style=document.createElement('style'); | |
style.type='text/css'; | |
style.innerHTML='*,p,div{user-select:text !important;-moz-user-select:text !important;-webkit-user-select:text !important;}'; | |
document.head.appendChild(style); | |
var elArray=document.body.getElementsByTagName('*'); | |
for(var i=0;i<elArray.length;i++){ | |
var el=elArray[i]; | |
el.onselectstart=el.ondragstart=el.ondrag=el.oncontextmenu=el.onmousedown=el.onmouseup=function(){return true}; | |
if(el instanceof HTMLInputElement&&['text','password','email','number','tel','url'].indexOf(el.type.toLowerCase())>-1){el.removeAttribute('disabled'); | |
el.onkeydown=el.onkeyup=function(){return true}; | |
} | |
} | |
}); | |
// unmap ZZ and ZQ since they only save the last window and accidentally losing your session sucks. | |
unmap('ZZ'); | |
unmap('ZQ'); | |
// youtube keys | |
unmap('j', /youtube.com/); | |
unmap('l', /youtube.com/); | |
unmap('c', /youtube.com/); | |
unmap('>', /youtube.com/); | |
unmap('<', /youtube.com/); | |
unmap(',', /youtube.com/); | |
unmap('.', /youtube.com/); | |
unmap('m', /youtube.com/); | |
unmap('f', /youtube.com/); | |
unmap('t', /youtube.com/); | |
unmap('P', /youtube.com/); | |
unmap('N', /youtube.com/); | |
// reddit keys | |
unmap('a', /reddit.com/); | |
unmap('z', /reddit.com/); | |
unmap('A', /reddit.com/); | |
unmap('Z', /reddit.com/); | |
unmap('j', /reddit.com/); | |
unmap('k', /reddit.com/); | |
unmap('h', /reddit.com/); | |
unmap('x', /reddit.com/); | |
unmap('J', /reddit.com/); | |
unmap('K', /reddit.com/); | |
unmap('p', /reddit.com/); | |
unmap('P', /reddit.com/); | |
unmap('s', /reddit.com/); | |
unmap('r', /reddit.com/); | |
unmap('e', /reddit.com/); | |
unmap('c', /reddit.com/); | |
unmap('C', /reddit.com/); | |
unmap('y', /reddit.com/); | |
unmap('Y', /reddit.com/); | |
unmap('u', /reddit.com/); | |
unmap('U', /reddit.com/); | |
unmap('?', /reddit.com/); | |
unmap('[', /reddit.com/); | |
unmap(']', /reddit.com/); | |
// inoreader keys | |
unmap('j', /inoreader.com/); | |
unmap('k', /inoreader.com/); | |
unmap('n', /inoreader.com/); | |
unmap('p', /inoreader.com/); | |
unmap('l', /inoreader.com/); | |
unmap('w', /inoreader.com/); | |
unmap('v', /inoreader.com/); | |
unmap('b', /inoreader.com/); | |
unmap('m', /inoreader.com/); | |
unmap('A', /inoreader.com/); | |
unmap('f', /inoreader.com/); | |
unmap('q', /inoreader.com/); | |
unmap('h', /inoreader.com/); | |
// blacklist | |
unmapAllExcept([''], /mail.google.com|docs.google.com|www.codecademy.com|gabrielecirulli.github.io|www.bankofcanada.ca/); | |
// Theming | |
// Hints.style('border: solid 3px #552a48; color:#efe1eb; background: initial; background-color: #552a48;'); | |
settings.omnibarPosition = 'bottom' | |
// Theme: Tomorrow-Night | |
api.Hints.style('border: solid 2px #373B41; color:#52C196; background: initial; background-color: #1D1F21;'); | |
api.Hints.style("border: solid 2px #373B41 !important; padding: 1px !important; color: #C5C8C6 !important; background: #1D1F21 !important;", "text"); | |
Visual.style('marks', 'background-color: #52C19699;'); | |
Visual.style('cursor', 'background-color: #81A2BE;'); | |
settings.theme = ` | |
/* Edit these variables for easy theme making */ | |
:root { | |
/* Font */ | |
--font: 'Source Code Pro', Ubuntu, sans; | |
--font-size: 12; | |
--font-weight: bold; | |
--fg: #C5C8C6; | |
--bg: #282A2E; | |
--bg-dark: #1D1F21; | |
--border: #373b41; | |
--main-fg: #81A2BE; | |
--accent-fg: #52C196; | |
--info-fg: #AC7BBA; | |
--select: #585858; | |
/* ---------- Generic ---------- */ | |
.sk_theme { | |
background: var(--bg); | |
color: var(--fg); | |
background-color: var(--bg); | |
border-color: var(--border); | |
font-family: var(--font); | |
font-size: var(--font-size); | |
font-weight: var(--font-weight); | |
} | |
input { | |
font-family: var(--font); | |
font-weight: var(--font-weight); | |
} | |
.sk_theme tbody { | |
color: var(--fg); | |
} | |
.sk_theme input { | |
color: var(--fg); | |
} | |
/* Hints */ | |
#sk_hints .begin { | |
color: var(--accent-fg) !important; | |
} | |
#sk_tabs .sk_tab { | |
background: var(--bg-dark); | |
border: 1px solid var(--border); | |
color: var(--fg); | |
} | |
#sk_tabs .sk_tab_hint { | |
background: var(--bg); | |
border: 1px solid var(--border); | |
color: var(--accent-fg); | |
} | |
.sk_theme #sk_frame { | |
background: var(--bg); | |
opacity: 0.2; | |
color: var(--accent-fg); | |
} | |
/* ---------- Omnibar ---------- */ | |
.sk_theme#sk_omnibar { | |
width: 100%; | |
left: 0; | |
} | |
.sk_theme .title { | |
color: var(--accent-fg); | |
} | |
.sk_theme .url { | |
color: var(--main-fg); | |
} | |
.sk_theme .annotation { | |
color: var(--accent-fg); | |
} | |
.sk_theme .omnibar_highlight { | |
color: var(--accent-fg); | |
} | |
.sk_theme .omnibar_timestamp { | |
color: var(--info-fg); | |
} | |
.sk_theme .omnibar_visitcount { | |
color: var(--accent-fg); | |
} | |
.sk_theme #sk_omnibarSearchResult ul li:nth-child(odd) { | |
background: var(--bg-dark); | |
} | |
.sk_theme #sk_omnibarSearchResult ul li.focused { | |
background: var(--border); | |
} | |
.sk_theme #sk_omnibarSearchArea { | |
border-top-color: var(--border); | |
border-bottom-color: var(--border); | |
} | |
.sk_theme #sk_omnibarSearchArea input, | |
.sk_theme #sk_omnibarSearchArea span { | |
font-size: var(--font-size); | |
} | |
.sk_theme .separator { | |
color: var(--accent-fg); | |
} | |
`; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment