Skip to content

Instantly share code, notes, and snippets.

@utick
Last active July 15, 2018 06:43
Show Gist options
  • Save utick/83297b4f15f32ffdeb61206e47390776 to your computer and use it in GitHub Desktop.
Save utick/83297b4f15f32ffdeb61206e47390776 to your computer and use it in GitHub Desktop.
//for the left&&right hand ...
Hints.characters = 'dsaewqcxzvr';
// set theme
settings.theme = '\
.sk_theme { \
background: #fff; \
color: #000; \
} \
.sk_theme tbody { \
color: #000; \
} \
.sk_theme input { \
color: #000; \
} \
.sk_theme .url { \
color: #555; \
} \
.sk_theme .annotation { \
color: #555; \
} \
.sk_theme .focused { \
background: #f0f0f0; \
}';
//方便浏览微博的视频与图片
mapkey('zz', '收起', "clickOn($('a').regex(/tosmall/i, $.fn.attr, ['action-type']))", {domain: /weibo.com/i});
mapkey('q', '点开微博上的图片/视频', 'Hints.create("div.media_box img", Hints.dispatchMouseClick)', {domain: /weibo.com/i});
//Google Search可用上一页与下一页
mapkey('[[', 'Click on the previous link on current page', function() {
var prevLinks = $('a').regex(/((上页|上一页|<<|prev(ious)?)+)/i);
if (prevLinks.length) {
clickOn(prevLinks);
} else {
walkPageUrl(-1);
}
},{domain:/google.com|baidu.com/i});
mapkey(']]', 'Click on the next link on current page', function() {
var nextLinks = $('a').regex(/((下页|下一页|>>|next)+)/i);
if (nextLinks.length) {
clickOn(nextLinks);
} else {
walkPageUrl(1);
}
},{domain:/google.com|baidu.com/i});
mapkey('zz','收起知乎的详情',function() {
var sticky = $('.is-sticky');//获取页面上显示的收起元素
clickOn(sticky);
},{domain:/zhihu.com/i});
//cancel smoothScroll
settings.smoothScroll = true;
//使用GithubMarkdown引擎进行渲染
settings.useLocalMarkdownAPI = false;
//一直用搜索栏来选择标签页
settings.tabsThreshold = 0;
//知乎搜素
addSearchAliasX('z', 'zhihu search', 'https://www.zhihu.com/search?type=question&q=');
//不怎么会用Surfingkeys的Proxy功能,习惯用Omega了,所以把这些取消掉 以免误触
unmap('spa');
unmap('spb');
unmap('spd');
unmap('sps');
unmap('spc');
map('?', 'u');//bind the pop help panel to ?
unmap('u');//cancel pop help panel
unmap('sr');//cancel reset config
Hints.style("background: #000; color: #fff; border-color: #000");
settings.hintAlign="left"
unmap('<Ctrl-i>');
map('<Ctrl-Alt-s>', '<Alt-s>'); // FIXME it not works https://github.com/brookhong/Surfingkeys/issues/290
// Insert mode
iunmap('<Ctrl-f>');
iunmap('<Ctrl-e>');
// Navigator
map('h', 'E'); // tab focus left
map('l', 'R'); // tab focus right
map('J', 'E'); // tab focus left
map('K', 'R'); // tab focus right
map('u', 'e'); // ⬆️
map('o', 'go'); // open in current tab
map('H', 'S'); // backward
map('L', 'D'); // forward
map('T', 'on');
// Action
map('`', "'");
// map('F', 'af'); // open in new tab
map('F', 'gf'); // open in new unactive tab
mapkey('p', "Open the clipboard's URL in the current tab", function() {
Front.getContentFromClipboard(function(response) {
window.location.href = response.data;
});
});
map('P', 'cc');
// source: https://gist.github.com/Echostream/fe560aa30271172398cf432b7b281fd5
mapkey('gi', '#1Go to edit box', function() {
var inputs = document.getElementsByTagName('input');
var input = null;
for(var i=0; i<inputs.length; i++) {
if(inputs[i].type=='text') {
input = inputs[i];
break;
}
}
if(input) {
input.click();
input.focus();
}
});
mapkey('ym', "#7Copy current page's URL as markdown", function() {
Front.writeClipboard('[' + document.title + '](' + window.location.href + ')');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment