Last active
February 16, 2020 04:52
-
-
Save indam/1879d1dd40f5f76b9e3439bbd40cf1c6 to your computer and use it in GitHub Desktop.
surfingkeys-config
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: 16pt; | |
bottom: 1px; | |
} | |
#sk_status>span, sk_find>span { | |
line-height: 28px; | |
}`; | |
// click `Save` button to make above settings to take effect. | |
// My configuration | |
// navigation with left hand only | |
Hints.characters = "asdfgqwertzxcv"; | |
// align the hints to the left of the link | |
settings.hintAlign = "left"; | |
//settings.omnibarPosition = "bottom"; | |
// use 'a' to go forward in history | |
map('Af', 'af'); | |
map('Ab', 'ab'); | |
map('a', 'D'); | |
// use 'q' to go back in history instead of 'S' | |
unmap('S'); | |
mapkey('q', '#4Go back in history', function() { | |
history.go(-1); | |
}, {repeatIgnore: true}); | |
// show image hint also with 'f' | |
mapkey('f', '#1Open a link in new tab', function() { | |
Hints.create("img, a, select, input, textarea, span", Hints.dispatchMouseClick); | |
}); | |
// use 'S' to replace 's' | |
map('Spa', 'spa'); | |
map('Spb', 'spb'); | |
map('Spd', 'spd'); | |
map('Sps', 'sps'); | |
map('Spc', 'spc'); | |
map('Sfr', 'sfr'); | |
map('Si', 'si'); | |
map('Sm', 'sm'); | |
map('Se', 'se'); | |
map('Su', 'su'); | |
map('SU', 'sU'); | |
map('Sb', 'sb'); | |
map('Sd', 'sd'); | |
map('Sg', 'sg'); | |
map('Sh', 'sh'); | |
map('Sql', 'sql'); | |
map('Ss', 'ss'); | |
map('Sw', 'sw'); | |
map('Sy', 'sy'); | |
// use 's'/'w' for going downward/upward | |
map('s', 'j'); | |
map('w', 'k'); | |
// translation service using shanbay, toggled by 'Q' | |
Front.registerInlineQuery({ | |
url: "https://api.shanbay.com/bdc/search/?word=", | |
parseResult: function(res) { | |
try { | |
res = JSON.parse(res.text); | |
var exp = res.msg; | |
if (res.data.definition) { | |
var pronunciations = []; | |
for (var reg in res.data.pronunciations) { | |
pronunciations.push(`<div>[${reg}] ${res.data.pronunciations[reg]}</div>`); | |
// pronunciations.push(`<div><audio src="${res.data[reg+'_audio']}" controls></audio></div>`); | |
} | |
var definition = res.data.definition.split("\n").map(function(d) { | |
return `<li>${d}</li>`; | |
}).join(""); | |
exp = `${pronunciations.join("")}<ul>${definition}</ul>`; | |
} | |
if (res.data.en_definitions) { | |
exp += "<hr/>"; | |
for (var lex in res.data.en_definitions) { | |
var sense = res.data.en_definitions[lex].map(function(s) { | |
return `<li>${s}</li>`; | |
}).join(""); | |
exp += `<div>${lex}</div><ul>${sense}</ul>`; | |
} | |
} | |
return exp; | |
} catch (e) { | |
return ""; | |
} | |
} | |
} | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment