-
Notifications
You must be signed in to change notification settings - Fork 2
/
surfingkeys-config.js
1193 lines (1072 loc) · 44.9 KB
/
surfingkeys-config.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
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
//////////////////////////////////////////////////////////////////////////////////////////////////
// //
// Korean Specific Surfing Keys config //
// Version - 1.0 - debug copy all tab urls //
// Korean specific surfing key config //
// Please copy this url to text box [load settings from:], and 'Save' //
// https: raw.githubusercontent.com/mindgitrwx/gitconventions/master/SurfingKeys-config-ko.js //
// //
//////////////////////////////////////////////////////////////////////////////////////////////////
// ------------ for page moving -------------- (every time it would be returned zero when refreshed)
var namuPage = 0;
wikiPage = 0;
stackAnswer = 0;
naverAnswer = 0;
codeWrapper = 0;
lineNum = 0;
var linkCounter = 0;
// Properties list
api.Hints.numericHints = false;
// api.Hints.characters = "asdfgqwertzxcvbyuiopmnhlk"; // without j for esc (TODO: jj for esc when hints mode)
api.Hints.scrollKeys = "G";
settings.caseSensitive = true;
settings.omnibarSuggestion = true;
// settings.defaultSearchEngine = 'L'; // Google I'm Feeling Luckey
settings.nextLinkRegex = /((forward|>>|next)+)/i;
settings.prevLinkRegex = /((back|<<|prev(ious)?)+)/i;
settings.tabsThreshold = 0;
////////////////////////////////
// api.unapi.map default key api.mapings //
////////////////////////////////
api.unmap('<Ctrl-6>');
// api.cmap('<Ctrl-p>');
// api.cmap('<Ctrl-n>');
api.unmap('<Ctrl-p>');
api.unmap('<Ctrl-n>');
api.map(']', ']]');
api.map('[', '[[');
// My default vim key binding: https://gist.github.com/millermedeiros/1262085
//--Like Nerd Tree--- TODO: FIX IT LIKE VERTICALLY
// api.map(',nt', 'T');
// api.map(',q', 'x');
// api.mapkey(',s', 'opne new tab and split', function () {
// RUNTIME("newWindow");
// });
api.cmap('<Ctrl-j>', '<Ctrl-n>');
api.cmap('<Ctrl-k>', '<Ctrl-p>');
//TODO: making spell check ,ts
// FIXME: it doesn't work
// iapi.map('<Ctrl-[>', "<Esc>");
// api.vmap('<Ctrl-[>', "<Esc>");
api.removeSearchAlias('g');
// api.removeSearchAlias('d');
api.removeSearchAlias('w');
api.removeSearchAlias('s');
//////////////////////////
// for url heml extract //
//////////////////////////
// var request = require('request'),
// cheerio = require('cheerio');
// request(url, function (err, res, html) {
// if (!err) {
// var $ = cheerio.load(html);
// }
// })
// 광고차단 즉시 실행
//
// (function stop(){
// document.getElementById('slide-close').click(); // NULL 실행 안됨
// document.getElementByClassName('slide-close').click();
// })();
let zenModeActive = false;
let originalStyles = []; // Store the original styles to restore later
// Function to restore styles
function restoreStyles() {
originalStyles.forEach(({ el, style }) => {
el.style.opacity = style.opacity; // Restore original opacity
});
originalStyles = []; // Clear the array after resetting styles
}
function applyZenModeToElement(targetElement) {
let parentElements = [];
for (let el = targetElement; el; el = el.parentElement) {
parentElements.push(el);
}
document.querySelectorAll('body *').forEach(function (el) {
if (!parentElements.includes(el) && el.tagName !== 'SCRIPT' && el.tagName !== 'NOSCRIPT') {
originalStyles.push({ el, style: { opacity: el.style.opacity } }); // Save original opacity
el.style.opacity = '0.1'; // Dim non-focused elements
}
});
originalStyles.push({ el: targetElement, style: { opacity: targetElement.style.opacity } }); // Save targetDiv's original opacity
targetElement.style.opacity = '1'; // Ensure the targetDiv is fully visible
}
api.mapkey('Z', 'Toggle Zen Mode', function () {
if (zenModeActive) {
restoreStyles();
zenModeActive = false;
} else {
// Use Hints.create to allow selection of a div
api.Hints.create('div', function (element) {
let targetDiv = element instanceof HTMLElement && element.tagName === 'DIV' ? element : element.closest('div');
if (targetDiv) {
applyZenModeToElement(targetDiv);
console.log(targetDiv)
zenModeActive = true;
} else {
console.error('Zen Mode: No target div found.');
}
});
}
});
api.mapkey('os', '#8Open Search Engines Omnibar', function () {
Front.openOmnibar({ type: "SearchEngine", extra: "searchEngines" });
});
api.mapkey('on', '#3Open newtab', function () {
api.tabOpenLink("www.google.com"); // TODO: addded api, but not work
});
api.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.");
}
});
});
// TODO: to try think conflict prefix g,c (google and github)
//General
api.addSearchAlias('L', 'Im feeling lucky', 'https://duckduckgo.com/?q=\\');
api.addSearchAlias('D', 'download', 'https://www.google.com/search?q=download+');
api.addSearchAlias('G', 'google', 'https://www.google.com/search?q=');
//Google
api.addSearchAlias(
"gm",
"Google Month",
"https://www.google.com/search?q={0}&tbs=qdr:m",
);
api.addSearchAlias(
"gw",
"Google Week",
"https://www.google.com/search?q={0}&tbs=qdr:w",
);
api.addSearchAlias(
"gy",
"Google Year",
"https://www.google.com/search?q={0}&tbs=qdr:y",
);
api.addSearchAlias(
"gd",
"Google Day",
"https://www.google.com/search?q={0}&tbs=qdr:d",
);
api.addSearchAlias(
"gH",
"Google Hour",
"https://www.google.com/search?q={0}&tbs=qdr:h",
);
api.addSearchAlias(
"gsh",
"Google Search History",
"https://myactivity.google.com/myactivity?authuser=0&q={0}",
);
api.addSearchAlias(
"gi",
"Google Images",
"https://www.google.com/search?q={0}&tbm=isch",
);
api.addSearchAlias(
"os",
"One Search",
"https://historysearch.com/search/list?q={0}",
);
api.addSearchAlias(
"Hs",
"History Search",
"https://historysearch.com/search/list?q={0}",
);
//ai
api.addSearchAlias('af', 'futurepedia', 'https://www.futurepedia.io/?searchTerm=');
api.addSearchAlias('Y', 'you', 'https://you.com/search?q=');
api.addSearchAlias('ap', 'perplexity', 'https://www.perplexity.ai/?q=');
//Microsoft
api.addSearchAlias('b', 'bing', 'https://www.bing.com/search?q=');
//GoogleTrand
api.addSearchAlias('gT', 'google trend', 'trends.google.com/trends/explore?q=');
api.addSearchAlias('gtK', 'google trend Korea', 'trends.google.com/trends/explore?geo=KR&q=');
api.addSearchAlias('gtU', 'google trend USA', 'trends.google.com/trends/explore?geo=US&q=');
api.addSearchAlias('gtI', 'google trend India', 'trends.google.com/trends/explore?geo=IN&q=');
//api
api.addSearchAlias('gM', 'Google map', 'https://www.google.com/maps?q=');
api.addSearchAlias('R', '도로명주소', 'http://www.juso.go.kr/support/AddressMainSearch.do?searchType=location_newaddr&searchKeyword=');
// network
api.addSearchAlias('ip', 'ipinfo', 'https://ipinfo.io/');
//coding -- 미완성
api.addSearchAlias('C', 'search coding', 'https://searchcode.com/?q=');
api.addSearchAlias('cA', 'Alternative', 'https://alternativeto.net/browse/search?q=');
api.addSearchAlias('cC', 'search coding', 'https://searchcode.com/?q=');
api.addSearchAlias('cW', 'chrome webstore', 'https://chrome.google.com/webstore/search/'); // chrome
api.addSearchAlias('cr', 'rfc search', 'https://rfc.fyi/?search=');
api.addSearchAlias('rfC', 'rfc search', 'https://rfc.fyi/?search=');
api.addSearchAlias('cs', 'codesandbox (online interactive IDE)', 'https://codesandbox.io/search?query=');
api.addSearchAlias('cS', 'slant (editor 비교 사이트)', 'https://www.slant.co/search?query=');
api.addSearchAlias(
"gH",
"GitHub Repositories",
"https://github.com/search?q={0}&type=repositories",
);
api.addSearchAlias(
"ghc",
"GitHub Code",
"https://github.com/search?q={0}&type=code",
);
api.addSearchAlias(
"ghi",
"GitHub Issues",
"https://github.com/search?q={0}&type=issues",
);
api.addSearchAlias(
"ghd",
"GitHub Discussions",
"https://github.com/search?q={0}&type=discussions",
);
api.addSearchAlias(
"ghr",
"GitHub Registry",
"https://github.com/search?q={0}&type=registrypackages",
);
api.addSearchAlias(
"ghm",
"GitHub Marketplace",
"https://github.com/search?q={0}&type=marketplace",
);
api.addSearchAlias(
"ght",
"GitHub Topics",
"https://github.com/search?q={0}&type=topics",
);
api.addSearchAlias(
"ghw",
"GitHub Wiki",
"https://github.com/search?q={0}&type=wikis",
);
api.addSearchAlias(
"ghu",
"GitHub Users",
"https://github.com/search?q={0}&type=users",
);
api.addSearchAlias(
"Hnm",
"Hacker News Month",
"https://hn.algolia.com/?dateRange=pastMonth&page=0&prefix=false&query={0}&sort=byPopularity&type=story"
),
api.addSearchAlias('ghS', 'githubStars', 'https://github.com/mindgitrwx?page=1&q=face&tab=stars&utf8=%E2%9C%93&utf8=%E2%9C%93&q=');
// slides
api.addSearchAlias('ss', 'slideshare', 'https://www.slideshare.net/search/slideshow?searchfrom=header&q=');
api.addSearchAlias('sd', 'soundsnap', 'https://www.soundsnap.com/search/audio/');
// Front-end development references
api.addSearchAlias('lt', 'tailwind', 'https://duckduckgo.com/?q=!ducky+tailwind+{0}');
api.addSearchAlias('ly', 'tailwind', 'https://duckduckgo.com/?q=!ducky+youtube+{0}');
api.addSearchAlias('ds', 'svg vectors', 'https://www.svgrepo.com/vectors/{0}');
api.addSearchAlias('di', 'react vectors', 'https://react-icons.github.io/react-icons/search/#q={0}');
api.addSearchAlias('ln', 'Next.js', 'https://duckduckgo.com/?q=!ducky+Next.js+{0}');
api.addSearchAlias('lm', 'MDN', 'https://duckduckgo.com/?q=!ducky+MDN+{0}');
api.addSearchAlias('lr', 'react', 'https://duckduckgo.com/?q=!ducky+react+dev+docs+{0}');
api.addSearchAlias('lp', 'producthunt', 'https://duckduckgo.com/?q=!ducky+producthunt+{0}');
api.addSearchAlias('li', 'Issues', 'https://duckduckgo.com/?q=!ducky+github+issues+{0}');
api.addSearchAlias('lT', 'TypeScript', 'https://duckduckgo.com/?q=!ducky+TypeScript+{0}');
api.addSearchAlias('lR', 'React', 'https://duckduckgo.com/?q=!ducky+React+{0}');
api.addSearchAlias('lj', 'React', 'https://duckduckgo.com/?q=!ducky+exploringjs+impatient-js+{0}');
// Add more aliases for other front-end development references here
//sentence search
api.addSearchAlias('S', 'sentencestack', 'https://sentencestack.com/q/');
//book
api.addSearchAlias('bS', 'snu library', 'https://primoapac01.hosted.exlibrisgroup.com/primo-explore/search?vid=82SNU&query=any,contains,');
api.addSearchAlias('bY', 'yonsei library', 'https://library.yonsei.ac.kr/main/searchBrief?q=');
api.addSearchAlias('bP', 'pnu library', 'https://lib.pusan.ac.kr/en/resource/?query=');
//rate
api.addSearchAlias('rmA', 'rate your music artist', 'https://rateyourmusic.com/search?bx=82d55e544de2ee5b27b2fd0e7153bbee&searchtype=a&searchterm=');
api.addSearchAlias('rmR', 'rate your music releases', 'https://rateyourmusic.com/search?bx=dfd8f4911473234b6e1362952e1b29e4&searchtype=l&searchterm=');
//sns
api.addSearchAlias('fB', 'faceBook', 'https://www.facebook.com/search/top/?q=');
api.addSearchAlias('tW', 'tWitter', 'https://twitter.com/search?q=');
api.addSearchAlias('ig', 'InstaGram HashTag', 'https://www.instagram.com/explore/tags/');
api.addSearchAlias('rD', 'redDit', 'https://www.reddit.com/search?q=');
//shorten - what is.. who is.. where is..
api.addSearchAlias('wA', 'advanced', 'https://www.google.com/search?q=advanced+');
api.addSearchAlias('wB', 'basic', 'https://www.google.com/search?q=basic+');
api.addSearchAlias('wC', '분류', 'https://www.google.com/search?q=classification+of+');
api.addSearchAlias('wD', '차이점', 'https://www.google.com/search?q=difference+between+');
api.addSearchAlias('wE', '예제', 'https://www.google.com/search?q=example+of+');
api.addSearchAlias('wF', '어디서부터', 'https://www.google.com/search?q=where+from+');
api.addSearchAlias('wG', '목적', 'https://www.google.com/search?q=what+is+goal+of+');
api.addSearchAlias('wH', '역사', 'https://www.google.com/search?q=history+of+');
api.addSearchAlias('wI', '소개', 'https://www.google.com/search?q=Introduction+of+');
api.addSearchAlias('wJ', '직업', 'https://www.google.com/search?q=jo+of+');
api.addSearchAlias('wK', '한국', 'https://www.google.com/search?q=Korea+');
api.addSearchAlias('wL', '리스트', 'https://www.google.com/search?q=list+of+');
api.addSearchAlias('wM', '방법', 'https://www.google.com/search?q=method+of+');
api.addSearchAlias('wm', '뜻', 'https://www.google.com/search?q=what+is+the+meaning+of+');
api.addSearchAlias('wN', '이름', 'https://www.google.com/search?q=name+of+');
api.addSearchAlias('wO', '순서', 'https://www.google.com/search?q=order+of+');
api.addSearchAlias('wP', '문제', 'https://www.google.com/search?q=problem+of+');
api.addSearchAlias('wQ', '질문', 'https://www.google.com/search?q=questions+of+');
api.addSearchAlias('wR', '랭킹', 'https://www.google.com/search?q=rank+of+');
api.addSearchAlias('wS', '공통점', 'https://www.google.com/search?q=common+point+of+');
api.addSearchAlias('wT', '표', 'https://www.google.com/search?q=q=table+of+');
api.addSearchAlias('wU', '사용예', 'https://www.google.com/search?q=usage+of+');
api.addSearchAlias('wW', '사용예', 'https://www.google.com/search?q=usage+of+');
api.addSearchAlias('wX', '사용예', 'https://www.google.com/search?q=usage+of+');
api.addSearchAlias('wY', '사용예', 'https://www.google.com/search?q=usage+of+');
api.addSearchAlias('wZ', '사용예', 'https://www.google.com/search?q=usage+of+');
//file
api.addSearchAlias('pdF', 'pdf', 'https://www.google.com/search?hl=en&biw=1600&bih=817&ei=ufUTW5_5FcGVmAXPqAc&q=filetype%3Apdf+');
api.addSearchAlias('cpP', 'cpp', 'https://www.google.com/search?hl=en&biw=1600&bih=817&ei=ufUTW5_5FcGVmAXPqAc&q=filetype%3Acpp+');
api.addSearchAlias('hwP', 'hwp', 'https://www.google.com/search?hl=en&biw=1600&bih=817&ei=ufUTW5_5FcGVmAXPqAc&q=filetype%3Ahwp+');
api.addSearchAlias('ppT', 'ppt', 'https://www.google.com/search?hl=en&biw=1600&bih=817&ei=ufUTW5_5FcGVmAXPqAc&q=filetype%3Appt+');
api.addSearchAlias('giF', 'gif', 'https://giphy.com/search/');
//translation
api.addSearchAlias('t', 'tlanslate Hangle to English 한글영어번역', 'https://translate.google.co.kr/?hl=ko#ko/en/');
api.addSearchAlias('T', 'tlanslate English to Hangle 영어한글번역', 'https://translate.google.co.kr/?hl=ko#en/ko/');
api.addSearchAlias('tA', 'tlanslate All 네이버사전all', 'http://dic.naver.com/search.nhn?dicQuery=');
api.addSearchAlias('tE', 'tlanslate Examples 네어버사전example', 'http://endic.naver.com/search_example.nhn?sLn=kr&query=');
// api.addSearchAlias('tL', 'tlanslate lyrics 가사해석', 'https://www.google.com/search?q=가사+해석+');
// api.addSearchAlias('ll', '가사', 'https://www.google.com/search?q=lyrics+of+');
//TODO: 검색을 통해서 google tlanslated 된 걸 clipboard에 복사 붙여넣는 것 만들기
api.addSearchAlias('ty', '한글영어번역', 'https://translate.google.co.kr/?hl=ko#ko/en/');
api.addSearchAlias('Ty', '영어한글번역', 'https://translate.google.co.kr/?hl=ko#en/ko/');
//naver : naver is one of the most famous potal site of korea
api.addSearchAlias('N', 'naver', 'https://search.naver.com/search.naver?sm=tab_hty.top&where=nexearch&query=');
api.addSearchAlias('nM', 'navermap', 'https://map.naver.com/?query=');
api.addSearchAlias('nA', 'naver all 네이버사전all', 'https://dict.naver.com/dict.search?query=');
api.addSearchAlias('nD', 'naver Dictionary 네이버사전all', 'https://dict.naver.com/dict.search?query=');
api.addSearchAlias('nE', 'naver Example 네어버사전example', 'http://endic.naver.com/search_example.nhn?sLn=kr&query=');
//Daum : daum is one of the most famous potal site of korea
api.addSearchAlias('D', '다음', 'https://search.daum.net/search?w=');
api.addSearchAlias('dA', '다음 사전all', 'http://dic.daum.net/search.do?q=');
api.addSearchAlias('dD', '다음 사전all', 'http://dic.daum.net/search.do?q=');
api.addSearchAlias('dE', '다음 사전example', 'http://endic.naver.com/search_example.nhn?sLn=kr&query=');
api.addSearchAlias('dM', '다음 map', 'http://local.daum.net/map/index.jsp?q=');
//Shopping : without amazon, all the sites are korean-specific sites.
api.addSearchAlias('aZ', '아마존', 'https://www.amazon.com/s?k=');
api.addSearchAlias('sA', 'shop아마존', 'https://www.amazon.com/s?k='); // gmarket 과 자리를 바꿔야 할 지 고민
api.addSearchAlias('sE', 'shopEbay', 'https://www.ebay.com/sch/i.html?_from=R40&_trksid=m570.l1313&_nkw=');
api.addSearchAlias('sC', 'shop 쿠팡', 'http://www.coupang.com/np/search?component=&q=');
api.addSearchAlias('sI', 'shop 인터파크', 'http://isearch.interpark.com/isearch?q=');
api.addSearchAlias('sY', 'shop yes24', 'http://www.yes24.com/searchcorner/Search?keywordAd=&keyword=&domain=ALL&qdomain=%C0%FC%C3%BC&Wcode=001_005&query=');
//music
api.addSearchAlias('msC', 'soundcloud', 'https://soundcloud.com/search?q=');
api.addSearchAlias('msI', 'soundcloudid', 'https://soundcloud.com/');
api.addSearchAlias('mS', 'spotify', 'https://open.spotify.com/search/results/');
api.addSearchAlias('msA', 'spotify Albums', 'https://open.spotify.com/search/albums/');
api.addSearchAlias('mL', 'meLon', 'https://www.melon.com/search/total/index.htm?q=');
api.addSearchAlias('mfM', 'lastFm', 'https://www.last.fm/search?q=');
api.addSearchAlias('mH', 'Hiphople', 'http://hiphople.com/index.php?_filter=search&mid=lyrics&search_keyword=');
api.addSearchAlias('mG', 'Genius', 'https://genius.com/search?q=');
api.addSearchAlias('mP', 'Pitchfork', 'https://pitchfork.com/search/?query=');
api.addSearchAlias('mC', 'metaCritic', 'http://www.metacritic.com/search/all/');
//Video
api.addSearchAlias('ym', 'youtube', 'https://www.youtube.com/results?search_query={0}EgIIBA%3D%3D');
api.addSearchAlias('yg', 'youglish', 'https://youglish.com/pronounce/');
api.addSearchAlias('ul', 'underline', 'https://underline.io/library/search?query=');
//Wiki
api.addSearchAlias('nW', '나무위키', 'https://namu.wiki/w/');
api.addSearchAlias('eW', '영문위키', 'https://www.wikiwand.com/en/');
api.addSearchAlias('kW', '한글위키', 'https://www.wikiwand.com/ko/');
//papaers
api.addSearchAlias('pS', 'paper copilot (SCISPACE)', 'https://typeset.io/search?q=');
api.addSearchAlias('pG', 'paper 구글 스콜라', 'https://scholar.google.co.kr/scholar?hl=ko&as_sdt=0%2C5&q=');
api.addSearchAlias('pB', 'paper (biology) nCBI', 'http://www.ncbi.nlm.nih.gov/search/?term=');
api.addSearchAlias('pR', 'paper RISS', 'http://www.riss.kr/search/Search.do?detailSearch=false&searchGubun=true&strQuery=&queryText=&exQuery=&colName=all&query=');
api.addSearchAlias('pE', 'paper ELSEVIER', 'https://www.elsevier.com/search-results?query=');
api.addSearchAlias('pC', 'paper with code', 'https://paperswithcode.com/search?q_meta=&q_type=&q=');
api.addSearchAlias('pN', 'paper Nature', 'https://www.nature.com/search?q=');
// FIXME: focus 관련 명령어는 바로 redirect 되지 않음
api.mapkey('osA', '#7 open stackoverflow ask', function () {
window.location.replace("https://stackoverflow.com/questions/ask");
//It cannot be happened document.getElementById('title').focus(); // 제목에 포커스
//
//document.getElementById('wmd-input').focus();
});
api.mapkey('ouA', '#7 open ubuntu ask', function () {
window.location.replace("https://askubuntu.com/questions/ask");
//It cannot be happened document.getElementById('title').focus(); // 제목에 포커스
//
//document.getElementById('wmd-input').focus();
});
// api.mapkey('oo', '#7 open chatgpt4 ', function () {
// window.location.replace("https://chat.openai.com/?model=gpt-4")
// });
// api.mapkey('oO', '#7 open chatgpt ', function () {
// window.location.replace("https://chat.openai.com")
// });
api.mapkey('ll', '#7 open twitter like ', function () {
window.location.replace("https://twitter.com/mindgitrwx/likes")
});
api.mapkey('oSA', '#7 open stackoverflow ask', function () {
window.location.replace("https://stackoverflow.com/questions/ask").getElementById('wmd-input').addEventListener('paste', handlePaste).focus();
// It cannot be happened
// document.getElementById('wmd-input').addEventListener('paste',handlePaste).focus();
});
api.mapkey('oR', '#7 open reddit write', function () {
window.location.replace("https://www.reddit.com/submit");
});
api.mapkey('oGM', '#7 open gmail send ', function () {
window.location.replace("https://mail.google.com/mail/u/1/#inbox?compose=new")
});
api.mapkey('oGD', '#7 open google docs send ', function () {
window.location.replace("https://docs.google.com/document/u/0/")
});
api.mapkey('oGI', '#7 open gist', function () {
window.location.replace("https://gist.github.com/")
});
api.mapkey('oP', '#7 open pastebin', function () {
window.location.replace("https://pastebin.com/")
});
api.mapkey('oGB', '#7 open google Book', function () {
window.location.replace("https://books.google.com/books?")
});
api.mapkey('oK', '#7 open kindle', function () {
window.location.replace("https://read.amazon.com/")
});
api.mapkey('Q', '#1Click on an Image or a button', function () {
function imageToBlob(imageURL) {
const img = new Image;
const c = document.createElement("canvas");
const ctx = c.getContext("2d");
img.crossOrigin = "";
img.src = imageURL;
return new Promise(resolve => {
img.onload = function () {
c.width = this.naturalWidth;
c.height = this.naturalHeight;
ctx.drawImage(this, 0, 0);
c.toBlob((blob) => {
https://www.w3.org/ // here the image is a blob
resolve(blob);
}, "image/png", 0.75);
};
});
}
async function copyImage(imageURL) {
const blob = await imageToBlob(imageURL);
const item = new ClipboardItem({ "image/png": blob });
navigator.clipboard.write([item]);
}
api.Hints.create("img, button", function (element) {
copyImage(element.src);
});
});
api.mapkey('gq', '#1get image address with wget', function () {
async function copyImageAddress(imgAddress) {
imageFormats = ["jpg", "jpeg", "png", "gif", "bmp", "svg", "webp", "ico", "tiff", "tif", "jfif", "pjpeg", "pjp", "avif", "apng"];
// if imgAddress string has imageFormats, then cut the trailing address after the imageFormats
for (var i = 0; i < imageFormats.length; i++) {
if (imgAddress.includes(imageFormats[i])) {
imgAddress = imgAddress.split(imageFormats[i])[0] + imageFormats[i];
api.Clipboard.write("wget " + imgAddress);
break;
}
}
}
api.Hints.create("img, button", function (element) {
copyImageAddress(element.src);
});
});
// wiki를 copy 할때 [1] 이런 정보가 나오는 것이 annoying 하므로 없애준다.
api.vmapkey('y', "copy without reference notation on wikipedia", function () {
api.Clipboard.write(window.getSelection().toString().replace(/\[[0-9]*\]/g, "test")); // TODO: 동작하지 않음
}, {
domain: /www\.wikiwand\.com/i
}); // TODO: 여러 도메인을 한꺼번에 집어 넣는 것 추가해야 함
api.mapkey('ymr', '#7Copy multiple link regex URLs to the clipboard', function () {
var linksToYank = [];
api.Hints.create('*[href]', function (element) {
linksToYank.push('domain: ' + '\/' + element.href.slice(8,).split('/')[0].replace(/\./g, "\\\.") + '\/' + 'i');
api.Clipboard.write(linksToYank.join('\n'));
}, {
multipleHits: true
});
});
// Map 'yg' to copy the git clone command for GitHub repositories
api.mapkey("yg", "Copy git clone command", function () {
// Check if the current page is a GitHub repository
if (/github\.com/i.test(window.location.href)) {
// Construct the git clone command
var gitCommand = "git clone " + window.location.href + ".git";
// Copy the command to the clipboard
api.Clipboard.write(gitCommand);
// Optionally, you can display a message to the user
api.Front.showBanner(`Copied to clipboard: ${gitCommand}`);
} else {
api.Front.showBanner("Not a GitHub repository page", 3000);
}
});
// api.mapkey('yg', '#7 git blog', function () {
// var address = window.location.href.split(".");
// var githubId = address[0].replace(/(^\w+:|^)\/\//, '');
// var githubAddress = 'github.com' + '/' + githubId;
// api.Clipboard.write(githubAddress);
// window.location.href(githubAddress);
// })
//TODO: git clone , get id
api.mapkey('yG', '#7 git clone', function () {
api.Clipboard.write('git clone ' + window.location.href + '.git');
}, {
domain: /github\.com/i
});
api.mapkey('yeI', '#7 Yank Element ID', function () {
api.Hints.create("", function (element) {
api.Clipboard.write(element.id);
});
});
api.mapkey('yeC', '#7 Yank Element Class Name', function () {
api.Hints.create("", function (element) {
api.Clipboard.write(element.className);
});
});
api.mapkey('yeT', '#7 Yank Element Type', function () {
api.Hints.create("", function (element) {
api.Clipboard.write(element.type);
});
});
api.mapkey('yeS', '#7 Yank Element Style', function () {
api.Hints.create("", function (element) {
api.Clipboard.write(element.style);
});
});
api.mapkey('yeA', '#7 Yank Element Alt', function () {
api.Hints.create("", function (element) {
api.Clipboard.write(element.alt);
});
});
api.mapkey('ymE', '#7 Yank Multiple Element info (copy multiple link element id or classname)', function () {
var linksToYank = [];
api.Hints.create('*[href]', function (element) {
linksToYank.push('id: ' + element.id + '\n');
linksToYank.push('innertext: ' + element.innerText + '\n');
linksToYank.push('className: ' + element.className + '\n');
(api.Clipboard.write(linksToYank.join('\n')));
}, {
multipleHits: true
});
});
api.mapkey('yE', '#7 Yank Element info. copy link element id or classname', function () {
var linksToYank = [];
api.Hints.create("", function (element) {
linksToYank.push('id: ' + element.id + '\n');
linksToYank.push('innertext: ' + element.innerText + '\n');
linksToYank.push('className: ' + element.className + '\n');
linksToYank.push('href: ' + element.href + '\n');
linksToYank.push('type: ' + element.type + '\n');
linksToYank.push('style: ' + element.style + '\n');
linksToYank.push('src: ' + element.src + '\n');
linksToYank.push('alt: ' + element.alt + '\n');
(api.Clipboard.write(linksToYank.join('\n')));
});
});
api.mapkey('ymR', '#7Copy multiple link Regex URLs to the clipboard and add commas', function () {
var linksToYank = [];
api.Hints.create('*[href]', function (element) {
if (linkCounter === 0) {
api.Clipboard.write('{')
}
linksToYank.push('"' + element.href + '"',);
api.Clipboard.write(linksToYank.join('\n'));
linkCounter++;
}, {
multipleHits: true
});
});
// Copy url as regex of SurfingKeys
api.mapkey('yr', "Copy url as regex", function () {
api.Clipboard.write('domain: ' + '\/' + window.location.href.slice(8,).split('/')[0].replace(/\./g, "\\\.") + '\/' + 'i');
});
// pre is often used for insert codeblocks on webpage. some code blocks just in pre,
// yQ와 동일함
api.mapkey('gyq', "Copy first pre and exist", function () {
var cssSelector = "pre";
var elements = getVisibleElements(function (e, v) {
if (e.matches(cssSelector)) {
v.push(e);
}
});
if (elements.length === 0 &&
document.querySelector(cssSelector) !== null) {
document.querySelector(cssSelector).scrollIntoView();
elements = getVisibleElements(function (e, v) {
if (e.matches(cssSelector)) {
v.push(e);
}
});
}
api.Clipboard.write(elements[0].innerText);
RUNTIME("closeTab");
});
api.mapkey('yQ', "Copy first pre", function () {
var cssSelector = "pre";
var elements = getVisibleElements(function (e, v) {
if (e.matches(cssSelector)) {
v.push(e);
}
});
if (elements.length === 0 &&
document.querySelector(cssSelector) !== null) {
document.querySelector(cssSelector).scrollIntoView();
elements = getVisibleElements(function (e, v) {
if (e.matches(cssSelector)) {
v.push(e);
}
});
}
api.Clipboard.write(elements[0].innerText);
});
// for get search url
api.mapkey('yk', "Copy url before Keyowrd insertion", function () {
api.Clipboard.write(window.location.href.split('=')[0] + '=');
});
// surrounded
api.mapkey('"yy', "surround url with double quotation mark", function () {
api.Clipboard.write('"' + window.location.href + '"');
});
// for get badename
api.mapkey('yb', "Copy basename url (last path)", function () {
api.Clipboard.write(window.location.href.split('/').pop());
});
//////////////////////////////////////////////////////////
// visualmode setting - vsual mode에 진입했을 때 동작가능 //
//////////////////////////////////////////////////////////
api.vmapkey('"y', "surround selection with doube quotation mark", function () {
api.Clipboard.write('"' + window.getSelection().toString().replace(/\n/g, " ") + '"');
});
api.vmapkey('<y', "surround selection ", function () {
api.Clipboard.write('<' + window.getSelection().toString() + '>');
});
api.mapkey('(y', "surround selection ", function () {
api.Clipboard.write('(' + window.getSelection().toString() + ')');
});
api.mapkey('[y', "surround selection ", function () {
api.Clipboard.write('[' + window.getSelection().toString() + ']');
});
api.vmapkey('{y', "surround selection ", function () {
api.Clipboard.write('{' + window.getSelection().toString() + '}');
});
api.vmapkey('/*y', "surround selection ", function () {
api.Clipboard.write('/*' + window.getSelection().toString() + '*/');
});
api.vmapkey('<--!y', "surround selection ", function () {
api.Clipboard.write('<--!' + window.getSelection().toString() + '-->');
});
api.vmapkey('~y', "surround selection ", function () {
var UpperSelected = window.getSelection().toString()
api.Clipboard.write(UpperSelected.toUpperCase());
});
api.vmapkey('~jy', "Remove enter", function () {
api.Clipboard.write(window.getSelection().toString().replace(/\n/g, " "));
});
api.vmapkey('~cy', "Added comma", function () {
api.Clipboard.write(window.getSelection().toString().replace(/[ ,]+/g, ","));
});
api.vmapkey('~dy', "Delete first 1 character", function () {
api.Clipboard.write(window.getSelection().toString().substr(1));
});
api.vmapkey('~Dy', "Delete surrounded", function () {
api.Clipboard.write(window.getSelection().toString().slice(1, -1));
});
api.vmapkey('~sy', "Remove special character (blank is not considered as special character", function () { //TODO: Black is not work
api.Clipboard.write(window.getSelection().toString().replace(/[^A-Z0-9:blank:]/ig, ""));
});
api.vmapkey('~dy', "Markdown Strikethrough", function () {
api.Clipboard.write('~~ ' + window.getSelection().toString() + ' ~~');
});
// markdown
api.vmapkey('miy', "Markdown italic", function () {
api.Clipboard.write('*' + window.getSelection().toString() + '*');
});
api.vmapkey('mby', "Markdown bold", function () {
api.Clipboard.write('**' + window.getSelection().toString() + '**');
});
api.vmapkey('mly', "Markdown link", function () {
api.Clipboard.write('[replaceit](' + window.getSelection().toString() + ')');
});
api.vmapkey('msy', "Markdown Strikethrough", function () {
api.Clipboard.write('~~ ' + window.getSelection().toString() + ' ~~');
});
// etc
api.mapkey('"yma', '#7Copy multiple link URLs to the clipboard', function () {
var linksToYank = [];
api.Hints.create('*[href]', function (element) {
linksToYank.push('"' + element.href + '"');
api.Clipboard.write(linksToYank.join('\n'));
}, {
multipleHits: true
});
});
//setting
api.mapkey('gs', '#12 go Setting - Open Chrome Settings', function () {
tabOpenLink("chrome://settings/");
});
api.mapkey('gE', '#12 go Extensions - Open Chrome extensions Shortcut setting', function () {
tabOpenLink("chrome://extensions/shortcuts");
});
// intellij bind
api.mapkey('<Ctrl-Alt-s>', '#12Open Chrome Settings', function () {
tabOpenLink("chrome://settings/");
});
api.map('<Ctrl-V>', 'sm'); // markdown preview
api.mapkey('D', '', function () {
pageHeadLine = document.querySelectorAll("pre");
if (pageHeadLine.length > codeWrapper) {
codeWrapper++;
}
pageHeadLine[codeWrapper].scrollIntoView();
});
api.mapkey('U', '', function () {
pageHeadLine = document.querySelectorAll("pre");
if (0 < codeWrapper) {
codeWrapper--;
}
pageHeadLine[codeWrapper].scrollIntoView();
});
api.mapkey('D', '나무위키 목차 대단위 다운스크롤', function () {
pageHeadLine = document.querySelectorAll(".wiki-heading");
if (pageHeadLine.length > namuPage) {
namuPage++;
}
pageHeadLine[namuPage].scrollIntoView();
}, {
domain: /namu\.wiki/i
});
api.mapkey('U', '나무위키 목차 대단위 up스크롤', function () {
pageHeadLine = document.querySelectorAll(".wiki-heading");
if (0 < namuPage) {
namuPage--;
}
pageHeadLine[namuPage].scrollIntoView();
}, {
domain: /namu\.wiki/i
});
api.mapkey('D', '위키 목차 대단위 다운스크롤', function () {
pageHeadLine = document.querySelectorAll(".mw-headline");
if (pageHeadLine.length > wikiPage) {
wikiPage++;
}
wikiPage++;
pageHeadLine[wikiPage].scrollIntoView();
}, {
domain: /\.wikipedia\.org/i
});
api.mapkey('U', '위키 목차 대단위 up스크롤', function () {
pageHeadLine = document.querySelectorAll(".mw-headline");
if (0 < wikiPage) {
wikiPage--;
}
pageHeadLine[wikiPage].scrollIntoView();
}, {
domain: /\.wikipedia\.org/i
});
api.mapkey('D', '위키 목차 대단위 다운스크롤', function () {
pageHeadLine = document.querySelectorAll(".mw-headline");
if (pageHeadLine.length > wikiPage) {
wikiPage++;
}
wikiPage++;
pageHeadLine[wikiPage].scrollIntoView();
}, {
domain: /en\.wiktionary\.org/i
});
api.mapkey('U', '위키 목차 대단위 up스크롤', function () {
pageHeadLine = document.querySelectorAll(".mw-headline");
if (0 < wikiPage) {
wikiPage--;
}
pageHeadLine[wikiPage].scrollIntoView();
}, {
domain: /en\.wiktionary\.org/i
});
api.mapkey('D', 'wikiwand 목차 대단위 스크롤 ', function () {
pageHeadLine = document.querySelectorAll(".mw-headline");
if (pageHeadLine.length > wikiPage) {
wikiPage++;
}
pageHeadLine[wikiPage].scrollIntoView();
}, {
domain: /www\.wikiwand\.com/i
});
api.mapkey('U', 'wikiwand 목차 up 스크롤 ', function () {
pageHeadLine = document.querySelectorAll(".mw-headline");
if (0 < wikiPage) {
wikiPage--;
}
pageHeadLine[wikiPage].scrollIntoView();
}, {
domain: /www\.wikiwand\.com/i
});
// query select all 내부에서 regular expression 이 먹히지 않음
api.mapkey('D', 'stackoverflow 답변 다운 스크롤', function () {
pageHeadLine = document.querySelectorAll(".answer");
if (pageHeadLine.length > stackAnswer) {
stackAnswer++;
}
pageHeadLine[stackAnswer].scrollIntoView();
window.scrollBy(0, -47); // Adjust scrolling with a negative value : stackoverflow upper bar
}, {
domain: /stackoverflow\.com/i
});
api.mapkey('U', 'stackoverflow 답변 up 스크롤 ', function () {
pageHeadLine = document.querySelectorAll(".answer");
if (0 < stackAnswer) {
stackAnswer--;
}
pageHeadLine[stackAnswer].scrollIntoView();
window.scrollBy(0, -47); // Adjust scrolling with a negative value here : stackoverflow upper bar
}, {
domain: /stackoverflow\.com/i
});
api.mapkey('D', 'naver 답변 다운 스크롤', function () {
pageHeadLine = document.querySelectorAll(".line_horizontal");
if (pageHeadLine.length > naverAnswer) {
naverAnswer++;
}
pageHeadLine[naverAnswer].scrollIntoView();
}, {
domain: /kin\.naver\.com/i
});
api.mapkey('U', 'naver 답변 up 스크롤 ', function () {
pageHeadLine = document.querySelectorAll(".line_horizontal");
if (0 < naverAnswer) {
naverAnswer--;
}
pageHeadLine[naverAnswer].scrollIntoView();
}, {
domain: /kin\.naver\.com/i
});
//https://www.slideshare.net/mandrewmartin/regression-presentation
//div.j-prev-btn.arrow-left btnPrevious
//div.j-prev-btn.arrow-right btnNext
//
//--------------End of D key and U key ----------------------
/*
window.onload = function(){
}
*/
// github default shortcut lists
// https://help.github.com/articles/using-keyboard-shortcuts/
api.mapkey('gC', 'Go to the code tab', function () {
document.querySelectorAll('.js-selected-navigation-item.reponav-item')[0].click();
}, {
domain: /github\.com/i
});
api.mapkey('gI', 'Go to the Issues tab. ', function () {
document.querySelectorAll('.js-selected-navigation-item.reponav-item')[1].click();
}, {
domain: /github\.com/i
});
api.mapkey('gP', 'Go to the Pull requests tab. ', function () {
document.querySelectorAll('.js-selected-navigation-item.reponav-item')[2].click();
}, {
domain: /github\.com/i
});
api.mapkey('gB', 'Go to the Projects tab. "', function () {
document.querySelectorAll('.js-selected-navigation-item.reponav-item')[3].click();
}, {
domain: /github\.com/i
});
api.mapkey('gW', 'Go to the Wiki tab. ', function () {
document.querySelectorAll('.js-selected-navigation-item.reponav-item')[4].click();
}, {
domain: /github\.com/i
});
api.mapkey('gO', 'Go to the Overview tab. ', function () {
document.querySelectorAll('.UnderlineNav-item')[0].click();
}, {
domain: /github\.com/i
});
api.mapkey('gR', 'Go to the Repository tab. ', function () {
document.querySelectorAll('.UnderlineNav-item')[1].click();
}, {
domain: /github\.com/i
});
api.mapkey('gS', 'Go to the Stars tab. ', function () {
document.querySelectorAll('.UnderlineNav-item')[2].click();
}, {
domain: /github\.com/i
});
api.mapkey('h', 'slideshare previous page', function () {