-
Notifications
You must be signed in to change notification settings - Fork 0
/
surfingkeys-default.js
621 lines (617 loc) · 21.9 KB
/
surfingkeys-default.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
// ************************* WARNING *************************
//
// The file contains the default mappings, and it is released un-minified
// for your referrence on creating your own mappings.
//
// But please don't just copy statement from this file to your own settings.
// As the bound functions in this file may rely on some unstable functions/
// variables, which may be changed some day. If you insist on that, please
// compare your settings with this file to find what stops your keystrokes
// from working.
//
// Therefore, the best practice to remap is using map instead of mapkey, for
// example:
//
// map('F', 'af');
//
// is better than
//
// mapkey('F', '#1Open a link in new tab', 'Hints.create("", Hints.dispatchMouseClick, {tabbed: true})');
//
// ************************* WARNING *************************
imapkey("<Ctrl-'>", '#15Toggle quotes in an input element', toggleQuote);
imapkey('<Ctrl-i>', '#15Open vim editor for current input', function() {
var element = getRealEdit();
Front.showEditor(element);
});
function toggleProxySite(host) {
RUNTIME('updateProxy', {
host: host,
operation: "toggle"
});
return true;
}
mapkey('cp', '#13Toggle proxy for current site', function() {
var host = window.location.host.replace(/:\d+/,'');
if (host && host.length) {
toggleProxySite(host);
}
});
mapkey(';cp', '#13Copy proxy info', function() {
runtime.command({
action: 'getSettings',
key: ['proxyMode', 'proxy', 'autoproxy_hosts']
}, function(response) {
Clipboard.write(JSON.stringify(response.settings, null, 4));
});
});
mapkey(';ap', '#13Apply proxy info from clipboard', function() {
Clipboard.read(function(response) {
var proxyConf = JSON.parse(response.data);
RUNTIME('updateProxy', {
host: proxyConf.autoproxy_hosts.join(","),
operation: 'add',
proxy: proxyConf.proxy,
mode: proxyConf.proxyMode
});
});
});
// create shortcuts for the command with different parameters
map('spa', ':setProxyMode always', 0, '#13set proxy mode `always`');
map('spb', ':setProxyMode byhost', 0, '#13set proxy mode `byhost`');
map('spd', ':setProxyMode direct', 0, '#13set proxy mode `direct`');
map('sps', ':setProxyMode system', 0, '#13set proxy mode `system`');
map('spc', ':setProxyMode clear', 0, '#13set proxy mode `clear`');
mapkey('gr', '#14Read selected text or text from clipboard', function() {
Clipboard.read(function(response) {
readText(window.getSelection().toString() || response.data, {verbose: true});
});
});
vmapkey('gr', '#9Read selected text', function() {
readText(window.getSelection().toString(), {verbose: true});
});
mapkey('sfr', '#13show failed web requests of current page', function() {
runtime.command({
action: 'getTabErrors'
}, function(response) {
if (response.tabError && response.tabError.length) {
var errors = response.tabError.map(function(e) {
var url = new URL(e.url);
return "<tr><td>{0}</td><td>{1}</td><td>{2}</td></tr>".format(e.error, e.type, url.host);
});
Front.showPopup("<table style='width:100%'>{0}</table>".format(errors.join('')));
} else {
Front.showPopup("No errors from webRequest.");
}
});
});
map('g0', ':feedkeys 99E', 0, "#3Go to the first tab");
map('g$', ':feedkeys 99R', 0, "#3Go to the last tab");
mapkey('zr', '#3zoom reset', function() {
RUNTIME('setZoom', {
zoomFactor: 0
});
});
mapkey('zi', '#3zoom in', function() {
RUNTIME('setZoom', {
zoomFactor: 0.1
});
});
mapkey('zo', '#3zoom out', function() {
RUNTIME('setZoom', {
zoomFactor: -0.1
});
});
map('ZQ', ':quit');
mapkey(".", '#0Repeat last action', Normal.repeatLast, {repeatIgnore: true});
mapkey("sql", '#0Show last action', function() {
Front.showPopup($.htmlEncode(runtime.conf.lastKeys.map(function(k) {
return KeyboardUtils.decodeKeystroke(k);
}).join(' → ')));
}, {repeatIgnore: true});
mapkey('ZZ', '#5Save session and quit', function() {
RUNTIME('createSession', {
name: 'LAST',
quitAfterSaved: true
});
});
mapkey('ZR', '#5Restore last session', function() {
RUNTIME('openSession', {
name: 'LAST'
});
});
mapkey('T', '#3Choose a tab', function() {
Front.chooseTab();
});
mapkey('?', '#0Show usage', function() {
Front.showUsage();
});
map('u', 'e');
mapkey('af', '#1Open a link in new tab', function() {
Hints.create("", Hints.dispatchMouseClick, {tabbed: true});
});
mapkey('gf', '#1Open a link in non-active new tab', function() {
Hints.create("", Hints.dispatchMouseClick, {tabbed: true, active: false});
});
mapkey('cf', '#1Open multiple links in a new tab', function() {
Hints.create("", Hints.dispatchMouseClick, {multipleHits: true});
});
map('C', 'gf');
mapkey('<Ctrl-h>', '#1Mouse over elements.', function() {
Hints.create("", Hints.dispatchMouseClick, {mouseEvents: ["mouseover"]});
});
mapkey('<Ctrl-j>', '#1Mouse out elements.', function() {
Hints.create("", Hints.dispatchMouseClick, {mouseEvents: ["mouseout"]});
});
mapkey('ya', '#7Copy a link URL to the clipboard', function() {
Hints.create('*[href]', function(element) {
Clipboard.write(element.href);
});
});
mapkey('yma', '#7Copy multiple link URLs to the clipboard', function() {
var linksToYank = [];
Hints.create('*[href]', function(element) {
linksToYank.push(element.href);
Clipboard.write(linksToYank.join('\n'));
}, {multipleHits: true});
});
mapkey('yc', '#7Copy a column of a table', function() {
Hints.create($("table").find('tr:first').find('>*'), function(element) {
var column = $(element).closest('table')
.find('tr').find(`>*:nth(${$(element).index()})`)
.toArray().map(function(t) {
return t.innerText;
}).join("\n");
Clipboard.write(column);
});
});
mapkey('ymc', '#7Copy multiple columns of a table', function() {
var rows = null;
Hints.create($("table").find('tr:first').find('>*'), function(element) {
var column = $(element).closest('table')
.find('tr').find(`>*:nth(${$(element).index()})`)
.toArray().map(function(t) {
return t.innerText;
});
if (!rows) {
rows = column;
} else {
column.forEach(function(c, i) {
rows[i] += "\t" + c;
});
}
Clipboard.write(rows.join("\n"));
}, {multipleHits: true});
});
mapkey('yq', '#7Copy pre text.', function() {
Hints.create("pre", function(element) {
Clipboard.write(element.innerText);
});
});
mapkey('i', '#1Go to edit box', function() {
Hints.create("input:visible, textarea:visible, *[contenteditable=true], select:visible", Hints.dispatchMouseClick);
});
mapkey('gi', '#1Go to the first edit box', function() {
Hints.createInputLayer();
});
mapkey('I', '#1Go to edit box with vim editor', function() {
Hints.create("input:visible, textarea:visible, *[contenteditable=true], select:visible", function(element) {
Front.showEditor(element);
});
});
mapkey('O', '#1Open detected links from text', function() {
Hints.create(runtime.conf.clickablePat, function(element) {
$(`<a href=${element[2]}>`)[0].click();
}, {statusLine: "Open detected links from text"});
});
mapkey(';s', 'Toggle PDF viewer from SurfingKeys', function() {
var pdfUrl = window.location.href;
if (pdfUrl.indexOf(chrome.extension.getURL("/pages/pdf_viewer.html")) === 0) {
pdfUrl = window.location.search.substr(3);
chrome.storage.local.set({"noPdfViewer": 1}, function() {
window.location.replace(pdfUrl);
});
} else {
if ($("EMBED").attr("type") === "application/pdf") {
chrome.storage.local.remove("noPdfViewer", function() {
window.location.replace(pdfUrl);
});
} else {
chrome.storage.local.get("noPdfViewer", function(resp) {
if(!resp.noPdfViewer) {
chrome.storage.local.set({"noPdfViewer": 1}, function() {
Front.showBanner("PDF viewer disabled.");
});
} else {
chrome.storage.local.remove("noPdfViewer", function() {
Front.showBanner("PDF viewer enabled.");
});
}
});
}
}
});
map('<Ctrl-i>', 'I');
cmap('<ArrowDown>', '<Tab>');
cmap('<ArrowUp>', '<Shift-Tab>');
cmap('<Ctrl-n>', '<Tab>');
cmap('<Ctrl-p>', '<Shift-Tab>');
mapkey('q', '#1Click on an Image or a button', function() {
Hints.create("img, button", Hints.dispatchMouseClick);
});
mapkey('<Alt-p>', '#3pin/unpin current tab', function() {
RUNTIME("togglePinTab");
});
mapkey('<Alt-m>', '#3mute/unmute current tab', function() {
RUNTIME("muteTab");
});
mapkey('B', '#4Go one tab history back', function() {
RUNTIME("historyTab", {backward: true});
}, {repeatIgnore: true});
mapkey('F', '#4Go one tab history forward', function() {
RUNTIME("historyTab", {backward: false});
}, {repeatIgnore: true});
mapkey('<Ctrl-6>', '#4Go to last used tab', function() {
RUNTIME("goToLastTab");
});
mapkey('gT', '#4Go to first activated tab', function() {
RUNTIME("historyTab", {index: 0});
}, {repeatIgnore: true});
mapkey('gt', '#4Go to last activated tab', function() {
RUNTIME("historyTab", {index: -1});
}, {repeatIgnore: true});
mapkey('S', '#4Go back in history', function() {
history.go(-1);
}, {repeatIgnore: true});
mapkey('D', '#4Go forward in history', function() {
history.go(1);
}, {repeatIgnore: true});
mapkey('r', '#4Reload the page', function() {
RUNTIME("reloadTab", { nocache: false });
});
mapkey('t', '#8Open a URL', function() {
Front.openOmnibar({type: "URLs", extra: "getAllSites"});
});
mapkey('go', '#8Open a URL in current tab', function() {
Front.openOmnibar({type: "URLs", extra: "getAllSites", tabbed: false});
});
mapkey('ox', '#8Open recently closed URL', function() {
Front.openOmnibar({type: "URLs", extra: "getRecentlyClosed"});
});
mapkey('H', '#8Open opened URL in current tab', function() {
Front.openOmnibar({type: "URLs", extra: "getTabURLs"});
});
function renderShanbay(res) {
var exp = res.msg;
if (res.data.definition) {
var tmp = [];
for (var reg in res.data.pronunciations) {
tmp.push('<div>[{0}] {1}</div>'.format(reg, res.data.pronunciations[reg]));
tmp.push('<div><audio src="{0}" controls></audio></div>'.format(res.data[reg+'_audio']));
}
tmp.push('<div>{0}</div>'.format(res.data.definition));
exp = '<div>{0}</div>'.format(tmp.join('\n'));
}
return exp;
}
mapkey('Q', '#8Open omnibar for word translation', function() {
Front.openOmniquery({
url: "https://api.shanbay.com/bdc/search/?word=",
/*
* or
url: function(q) {
return "https://api.shanbay.com/bdc/search/?word=" + q
},
*/
query: Visual.getWordUnderCursor(),
style: "opacity: 0.8;",
parseResult: function(res) {
var res = JSON.parse(res.text);
return [ renderShanbay(res) ];
}
});
});
Visual.setTranslationService("https://api.shanbay.com/bdc/search/?word=", function(res) {
var res = JSON.parse(res.text);
return renderShanbay(res);
});
mapkey('b', '#8Open a bookmark', function() {
Front.openOmnibar(({type: "Bookmarks"}));
});
mapkey('ab', '#8Bookmark current page to selected folder', function() {
var page = {
url: window.location.href,
title: document.title
};
Front.openOmnibar(({type: "AddBookmark", extra: page}));
});
mapkey('oh', '#8Open URL from history', function() {
Front.openOmnibar({type: "History"});
});
mapkey('om', '#8Open URL from vim-like marks', function() {
Front.openOmnibar({type: "VIMarks"});
});
mapkey(':', '#8Open commands', function() {
Front.openOmnibar({type: "Commands"});
});
mapkey('zv', '#9Enter visual mode, and select whole element', function() {
Visual.toggle("z");
});
mapkey('yv', '#9Yank text of an element', function() {
Visual.toggle("y");
});
mapkey('ymv', '#9Yank text of multiple elements', function() {
Visual.toggle("ym");
});
mapkey('V', '#9Restore visual mode', function() {
Visual.restore();
});
mapkey('*', '#9Find selected text in current page', function() {
Visual.star();
Visual.toggle();
});
vmapkey('<Ctrl-u>', '#9Backward 20 lines', function() {
Visual.feedkeys('20k');
});
vmapkey('<Ctrl-d>', '#9Forward 20 lines', function() {
Visual.feedkeys('20j');
});
mapkey('x', '#3Close current tab', function() {
RUNTIME("closeTab");
});
mapkey('X', '#3Restore closed tab', function() {
RUNTIME("openLast");
});
mapkey('W', '#3New window with current tab', function() {
RUNTIME("newWindow");
});
mapkey('m', '#10Add current URL to vim-like marks', Normal.addVIMark);
mapkey("'", '#10Jump to vim-like mark', Normal.jumpVIMark);
mapkey("<Ctrl-'>", '#10Jump to vim-like mark in new tab.', function(mark) {
Normal.jumpVIMark(mark, true);
});
mapkey('<<', '#3Move current tab to left', function() {
RUNTIME('moveTab', {
step: -1
});
});
mapkey('>>', '#3Move current tab to right', function() {
RUNTIME('moveTab', {
step: 1
});
});
mapkey('w', '#2Switch frames', function() {
Normal.rotateFrame();
});
mapkey('cc', '#7Open selected link or link from clipboard', function() {
if (window.getSelection().toString()) {
tabOpenLink(window.getSelection().toString());
} else {
Clipboard.read(function(response) {
tabOpenLink(response.data);
});
}
});
mapkey('[[', '#1Click on the previous link on current page', previousPage);
mapkey(']]', '#1Click on the next link on current page', nextPage);
mapkey('ys', "#7Copy current page's source", function() {
var aa = document.documentElement.cloneNode(true);
Clipboard.write(aa.outerHTML);
});
mapkey('yj', "#7Copy current settings", function() {
runtime.command({
action: 'getSettings',
key: "RAW"
}, function(response) {
Clipboard.write(JSON.stringify(response.settings, null, 4));
});
});
mapkey('yd', "#7Copy current downloading URL", function() {
runtime.command({
action: 'getDownloads',
query: {state: "in_progress"}
}, function(response) {
var items = response.downloads.map(function(o) {
return o.url;
});
Clipboard.write(items.join(','));
});
});
mapkey('yt', '#3Duplicate current tab', function() {
RUNTIME("duplicateTab");
});
mapkey('yy', "#7Copy current page's URL", function() {
Clipboard.write(window.location.href);
});
mapkey('yl', "#7Copy current page's title", function() {
Clipboard.write(document.title);
});
mapkey('yf', '#7Copy form data in JSON on current page', function() {
var fd = {};
$('form').each(function() {
fd[(this.method || "get") + "::" + this.action] = getFormData(this, "json");
});
Clipboard.write(JSON.stringify(fd, null, 4));
});
mapkey(';pf', '#7Paste form data from clipboard', function() {
Hints.create('form', function(element, event) {
var formKey = (element.method || "get") + "::" + element.action;
Clipboard.read(function(response) {
var forms = JSON.parse(response.data.trim());
if (forms.hasOwnProperty(formKey)) {
var fd = forms[formKey];
$(element).find('input[type=text]:visible').toArray().forEach(function(ip) {
if (fd.hasOwnProperty(ip.name)) {
ip.value = fd[ip.name];
}
});
} else {
Front.showBanner("No form data found for your selection from clipboard.");
}
});
});
});
mapkey('yg', '#7Capture current page', function() {
Front.toggleStatus(false);
setTimeout(function() {
runtime.command({
action: 'captureVisibleTab'
}, function(response) {
Front.toggleStatus(true);
Front.showPopup("<img src='{0}' />".format(response.dataUrl));
});
}, 500);
});
mapkey('yp', '#7Copy form data for POST on current page', function() {
var aa = [];
$('form').each(function() {
var fd = {};
fd[(this.method || "get") + "::" + this.action] = getFormData(this);
aa.push(fd);
});
Clipboard.write(JSON.stringify(aa, null, 4));
});
mapkey('ob', '#8Open Search with alias b', function() {
Front.openOmnibar({type: "SearchEngine", extra: "b"});
});
mapkey('og', '#8Open Search with alias g', function() {
Front.openOmnibar({type: "SearchEngine", extra: "g"});
});
mapkey('ow', '#8Open Search with alias w', function() {
Front.openOmnibar({type: "SearchEngine", extra: "w"});
});
if (window.navigator.userAgent.indexOf("Firefox") > 0) {
mapkey('on', '#3Open Chrome newtab', function() {
tabOpenLink("/pages/start.html");
});
} else {
mapkey('on', '#3Open Chrome newtab', function() {
tabOpenLink("chrome://newtab/");
});
mapkey('ga', '#12Open Chrome About', function() {
tabOpenLink("chrome://help/");
});
mapkey('gb', '#12Open Chrome Bookmarks', function() {
tabOpenLink("chrome://bookmarks/");
});
mapkey('gc', '#12Open Chrome Cache', function() {
tabOpenLink("chrome://cache/");
});
mapkey('gd', '#12Open Chrome Downloads', function() {
tabOpenLink("chrome://downloads/");
});
mapkey('gh', '#12Open Chrome History', function() {
tabOpenLink("chrome://history/");
});
mapkey('gk', '#12Open Chrome Cookies', function() {
tabOpenLink("chrome://settings/content/cookies");
});
mapkey('ge', '#12Open Chrome Extensions', function() {
tabOpenLink("chrome://extensions/");
});
mapkey('gn', '#12Open Chrome net-internals', function() {
tabOpenLink("chrome://net-internals/#proxy");
});
mapkey('si', '#12Open Chrome Inspect', function() {
tabOpenLink("chrome://inspect/#devices");
});
}
mapkey('gs', '#12View page source', function() {
RUNTIME("viewSource", { tab: { tabbed: true }});
});
mapkey('gu', '#4Go up one path in the URL', function() {
var pathname = location.pathname;
if (pathname.length > 1) {
pathname = pathname.endsWith('/') ? pathname.substr(0, pathname.length - 1) : pathname;
var last = pathname.lastIndexOf('/'), repeats = RUNTIME.repeats;
RUNTIME.repeats = 1;
while (repeats-- > 1) {
var p = pathname.lastIndexOf('/', last - 1);
if (p === -1) {
break;
} else {
last = p;
}
}
pathname = pathname.substr(0, last);
}
window.location.href = location.origin + pathname;
});
mapkey('g?', '#4Reload current page without query string(all parts after question mark)', function() {
window.location.href = window.location.href.replace(/\?[^\?]*$/, '');
});
mapkey('gU', '#4Go to root of current URL hierarchy', function() {
window.location.href = window.location.origin;
});
mapkey('gxt', '#3Close tab on left', function() {
RUNTIME("closeTabLeft");
});
mapkey('gxT', '#3Close tab on right', function() {
RUNTIME("closeTabRight");
});
mapkey('gx0', '#3Close all tabs on left', function() {
RUNTIME("closeTabsToLeft");
});
mapkey('gx$', '#3Close all tabs on right', function() {
RUNTIME("closeTabsToRight");
});
mapkey('se', '#11Edit Settings', function() {
tabOpenLink("/pages/options.html");
});
mapkey('sm', '#11Preview markdown', function() {
tabOpenLink("/pages/markdown.html");
});
mapkey('<Ctrl-Alt-d>', '#11Mermaid diagram generator', function() {
tabOpenLink("/pages/mermaid.html");
});
mapkey('su', '#4Edit current URL with vim editor', function() {
Front.showEditor(window.location.href, function(data) {
tabOpenLink(data);
}, 'url');
});
mapkey(';m', '#1mouse out last element', function() {
Hints.mouseoutLastElement();
});
mapkey(';j', '#12Close Downloads Shelf', function() {
RUNTIME("closeDownloadsShelf", {clearHistory: true});
});
mapkey(';pp', '#7Paste html on current page', function() {
Clipboard.read(function(response) {
document.body.innerHTML = response.data;
});
});
mapkey(';q', '#14Insert jquery library on current page', function() {
Normal.insertJS("//ajax.aspnetcdn.com/ajax/jQuery/jquery-2.1.4.min.js");
});
mapkey(';t', 'Translate selected text with google', function() {
searchSelectedWith('https://translate.google.com/?hl=en#auto/en/', false, false, '');
});
mapkey(';dh', '#14Delete history older than 30 days', function() {
RUNTIME('deleteHistoryOlderThan', {
days: 30
});
});
mapkey(';db', '#14Remove bookmark for current page', function() {
RUNTIME('removeBookmark');
});
addSearchAliasX('g', 'google', 'https://www.google.com/search?q=', 's', 'https://www.google.com/complete/search?client=chrome-omni&gs_ri=chrome-ext&oit=1&cp=1&pgcl=7&q=', function(response) {
var res = JSON.parse(response.text);
return res[1];
});
addSearchAliasX('d', 'duckduckgo', 'https://duckduckgo.com/?q=', 's', 'https://duckduckgo.com/ac/?q=', function(response) {
var res = JSON.parse(response.text);
return res.map(function(r){
return r.phrase;
});
});
addSearchAliasX('b', 'baidu', 'https://www.baidu.com/s?wd=', 's', 'http://suggestion.baidu.com/su?cb=&wd=', function(response) {
var res = response.text.match(/,s:\[("[^\]]+")]}/);
return res ? res[1].replace(/"/g, '').split(",") : [];
});
addSearchAliasX('w', 'bing', 'http://global.bing.com/search?setmkt=en-us&setlang=en-us&q=', 's', 'http://api.bing.com/osjson.aspx?query=', function(response) {
var res = JSON.parse(response.text);
return res[1];
});
addSearchAliasX('s', 'stackoverflow', 'http://stackoverflow.com/search?q=');
addSearchAliasX('h', 'github', 'https://github.com/search?type=Code&utf8=%E2%9C%93&q=');
document.dispatchEvent(new CustomEvent('surfingkeys:defaultSettingsLoaded'));