Skip to content

Instantly share code, notes, and snippets.

@TTTPOB
Last active August 29, 2022 11:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TTTPOB/9030d24ba1bac9440ad5b499af850e12 to your computer and use it in GitHub Desktop.
Save TTTPOB/9030d24ba1bac9440ad5b499af850e12 to your computer and use it in GitHub Desktop.
Surfingkeys configuration
// an example to create a new mapping `ctrl-y`
// an example to replace `T` with `gt`, click `Default mappings` to see how `T` works.
api.map('gt', 'T');
// hint displayed left
settings.hintAlign = "left";
// navigate forward and backward
api.unmap('H');
api.mapkey('HH', '#8Open opened URL in current tab', function() {
api.Front.openOmnibar({type: "URLs", extra: "getTabURLs", tabbed: "false"});
});
api.mapkey('H', '#4 Go back in history', function() {
history.go(-1);
});
api.mapkey('L', '#4 Go forward in history', function() {
history.go(1);
});
//my own way to switch tabs
api.mapkey('K', '#3Go one tab right', function(){
api.RUNTIME("nextTab");
}); //map('K', 'R');
api.mapkey('J', '#3Go one tab left', function(){
api.RUNTIME("previousTab");
}); //map('J', 'E');
api.map('g0', ':feedkeys 99J', 0, "#3Go to the first tab");
api.map('g$', ':feedkeys 99K', 0, "#3Go to the last tab");
api.unmap('R');
api.unmap('E');
// scroll distance
settings.scrollStepSize = 200;
// open link in current tab
api.unmap('go')
api.mapkey('oo', '#8Open a URL in current tab', function() {
api.Front.openOmnibar({type: "URLs", extra: "getAllSites", tabbed: false});
});
api.unmap('T')
api.mapkey('T', '#8Open a URL', function() {
api.Front.openOmnibar({type: "URLs", extra: "getAllSites"});
});
// open link in new tab
api.map('F', 'af')
// B for Bilibili, Not baidu
api.addSearchAlias('bz', 'bilibili', 'https://search.bilibili.com/all?keyword=', 's', 'https://s.search.bilibili.com/main/suggest?term=', function(response) {
var res = JSON.parse(response.text.replace(/\"\d\":/g, "").replace("\{\{", "[{").replace("\}\}", "}]"))
;
return res.map(function(d){
return d.value;
});
});
// cnd for anaconda
api.addSearchAlias('cnd', 'anaconda', 'https://anaconda.org/search?q=', 's')
// oed for oxfored english dictionary
api.addSearchAlias('oed', 'oxford english dictionary', 'https://www.oed.com/search?searchType=dictionary&isWritersAndEditors=true&searchUri=All&q=', 's')
//unpt for uniprot
api.addSearchAlias('unpt', 'uniprot', 'https://www.uniprot.org/uniprotkb?query=', 's')
// google scholar
api.addSearchAlias('gsc', 'Google Scholar', 'https://scholar.google.com/scholar?q=', 's', "https://scholar.google.com/scholar_complete?q=", function(response){
return JSON.parse(response.text).l;
});
// yeggi
api.addSearchAlias('ygi', 'yeggi', 'https://yeggi.com/q/', 's')
// open potplayer on my onedrive page
if(document.domain == "xkxme.tpob.xyz"){
mapkey('P', "#13open video in potplayer",function(){ window.open("potplayer://"+document.URL.replace(/tpob.xyz\/show/,
"tpob.xyz/down"))})
}
// set theme
settings.theme = `
.sk_theme {
font-family: Sarasa UI SC, 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;
}`;
const hintsCss =
"font-size: 10pt; font-family: Sarasa Mono SC, Consolas, Menlo, monospace; border: 0px; color: #f7f7a2; background: initial; background-color: #808080;";
api.Hints.style(hintsCss);
api.Hints.style(hintsCss, "text");
// click `Save` button to make above settings to take effect.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment