-
Notifications
You must be signed in to change notification settings - Fork 6
/
main.js
2209 lines (2009 loc) · 102 KB
/
main.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
// ==UserScript==
// @name Onestep Search - 一键快搜
// @namespace https://greasyfork.org/zh-CN/scripts/440000
// @version 2.0.1
// @author eyinwei
// @description 无缝集成 划词搜索 + 快捷键搜索 + 搜索跳转 + 网址导航, 享受丝滑搜索体验
// @homepageURL none
// @icon https://s2.loli.net/2022/08/16/kwm38v2TxY4OtCs.png
// @match *://*/*
// @grant GM_openInTab
// @grant GM_setClipboard
// @grant GM_getValue
// @grant GM_setValue
// @grant GM_xmlhttpRequest
// @run-at document-end
// @license MIT
// @original-author smallx
// ==/UserScript==
(function () {
'use strict';
///////////////////////////////////////////////////////////////////
// 配置
///////////////////////////////////////////////////////////////////
//=========================定义网站数据=======================================
function SiteInfo(_name, _url, _homepage, _icon) {
this.name = _name;
this.url = _url;
this.home = _homepage;
this.icon = _icon;
this.callSiteInformation = function (_enable = true) {
return {
name: _name,
url: _url,
home: _homepage,
icon: _icon,
enable: _enable,
};
};
// this.callSiteInformationNoHomepage = function (_enable = true) {
// return {
// name: _name,
// url: _url,
// icon: _icon,
// enable: _enable,
// };
// };
};
// 百度系列
const Baidu = new SiteInfo('百度', 'https://www.baidu.com/s?wd=%s&ie=utf-8', 'https://www.baidu.com/', 'https://www.baidu.com/favicon.ico');
const Baidufanyi = new SiteInfo('百度翻译', 'https://fanyi.baidu.com/#auto/zh/%s', 'https://fanyi.baidu.com/', 'https://fanyi-cdn.cdn.bcebos.com/webStatic/translation/img/favicon/favicon.ico');
const Baiduwangpan = new SiteInfo('百度网盘', 'https://pan.baidu.com/disk/home?#/search?key=%s', 'https://pan.baidu.com/', 'https://nd-static.bdstatic.com/m-static/v20-main/favicon-main.ico');
const Baidubaike = new SiteInfo('百度百科', 'https://baike.baidu.com/search/word?pic=1&sug=1&word=%s', 'https://baike.baidu.com/', 'https://baike.baidu.com/favicon.ico');
const Baiduzhidao = new SiteInfo('百度知道', 'https://zhidao.baidu.com/search?word=%s', 'https://zhidao.baidu.com/', 'https://www.baidu.com/favicon.ico?t=20171027');
const Baiduxinwen = new SiteInfo('百度新闻', 'https://www.baidu.com/s?rtt=1&bsst=1&cl=2&tn=news&rsv_dl=ns_pc&word=%s', 'http://news.baidu.com/', 'https://www.baidu.com/favicon.ico');
const Baiduwenku = new SiteInfo('百度文库', 'https://wenku.baidu.com/search?word=%s', '', 'https://www.baidu.com/favicon.ico');
const Baidumap = new SiteInfo('百度地图', 'https://map.baidu.com/search?querytype=s&wd=%s', '', 'https://map.baidu.com/favicon.ico');
const Baidutupian = new SiteInfo('百度图片', 'https://image.baidu.com/search/index?tn=baiduimage&ie=utf-8&word=%s', '', 'https://www.baidu.com/favicon.ico');
const Baiduxueshu = new SiteInfo('百度学术', 'http://xueshu.baidu.com/s?wd=%s', '', 'https://www.baidu.com/favicon.ico');
const Baidutieba = new SiteInfo('贴吧', 'https://tieba.baidu.com/f?kw=%s&ie=utf-8', 'https://tieba.baidu.com/', 'https://www.baidu.com/favicon.ico');
// 谷歌系列
const Google = new SiteInfo('谷歌', 'https://www.google.com/search?q=%s&ie=utf-8&oe=utf-8', 'https://www.google.com/', 'https://s2.loli.net/2022/08/16/QUL3cvA4t7Tx5sE.png');
const Googlefanyi = new SiteInfo('谷歌翻译', 'https://translate.google.com/?q=%s', '', 'https://ssl.gstatic.com/translate/favicon.ico');
const Googlemap = new SiteInfo('谷歌地图', 'https://www.google.com/maps/search/%s', 'https://www.google.com/maps/', 'https://s2.loli.net/2022/08/17/SloXZzf9nC6LPbq.png');
const Googleearth = new SiteInfo('谷歌地球', 'https://earth.google.com/web/search/%s', 'https://earth.google.com/web/', 'https://s2.loli.net/2022/08/17/IOiPDl7YX3QnmsC.png');
const Googlexueshu = new SiteInfo('谷歌学术', 'https://scholar.google.com/scholar?hl=zh-CN&q=%s', '', 'https://s2.loli.net/2022/08/17/4BaC1Acu2ebXJR9.png');
const Googlepic = new SiteInfo('谷歌图片', 'https://www.google.com/search?q=%s&tbm=isch', 'https://www.google.com/imghp?hl=zh-CN', Google.icon);
const Googlenews = new SiteInfo('谷歌新闻', 'https://news.google.com/search?q=%s&hl=zh-CN&gl=CN&ceid=CN:zh-Hans', 'https://news.google.com/topstories?hl=zh-CN&gl=CN&ceid=CN:zh-Hans', 'https://s2.loli.net/2022/08/17/RTdZQMD2Aw8eobn.png');
const StackOverflow = new SiteInfo('StackOverflow', 'https://stackoverflow.com/search?q=%s', '', 'https://s2.loli.net/2022/08/16/mgMHa8UTekYIdV4.png');
const Zhihu = new SiteInfo('知乎', 'https://www.zhihu.com/search?q=%s', 'https://www.zhihu.com/', 'https://static.zhihu.com/heifetz/favicon.ico');
const Bing = new SiteInfo('必应', 'https://cn.bing.com/search?q=%s', 'https://cn.bing.com/', 'https://s2.loli.net/2022/08/16/3uWMUjDVAlS8c9T.png');
const Bilibili = new SiteInfo('哔哩哔哩', 'https://search.bilibili.com/all?keyword=%s', 'https://www.bilibili.com/', 'https://www.bilibili.com/favicon.ico?v=1');
const Taobao = new SiteInfo('淘宝', 'https://s.taobao.com/search?q=%s', 'https://www.taobao.com/', 'https://www.taobao.com/favicon.ico');
const Jingdong = new SiteInfo('京东', 'https://search.jd.com/Search?keyword=%s&enc=utf-8', 'https://www.jd.com/', 'https://search.jd.com/favicon.ico');
const Tianmao = new SiteInfo('天猫', 'https://list.tmall.com/search_product.htm?q=%s', 'https://www.tmall.com/', 'https://www.tmall.com/favicon.ico');
const Maimai = new SiteInfo('脉脉', 'https://maimai.cn/web/search_center?type=gossip&query=%s&highlight=true', 'https://maimai.cn/feed_list', 'https://maimai.cn/favicon.ico');
const Weibo = new SiteInfo('微博', 'https://s.weibo.com/weibo/%s', 'https://weibo.com/', 'https://s.weibo.com/favicon.ico');
const GitHub = new SiteInfo('GitHub', 'https://github.com/search?q=%s', 'https://s2.loli.net/2022/08/17/OedrPVhtkn5Mug4.png');
//=========================定义网站数据=======================================
const defaultConf = {
//
// 基本配置
//
showToolbar: true, // 显示划词工具条
showFrequentEngines: true, // 显示常用搜索引擎
showClassifiedEngines: true, // 显示分类搜索引擎
showPlaceholder: false, // 显示使用方式提示信息(如搜索框placeholder)
enableOnInput: true, // 是否在input/textarea上启用划词和快捷键
autoCopyToClipboard: false, // 划词时自动复制到剪贴板(内容为文本格式)
//
// 搜索建议配置
//
// 可选值baidu|google, 可根据需要调整顺序
engineSuggestions: [
{
name: 'google',
showCount: 5,
enable: false
},
{
name: 'baidu',
showCount: 5,
enable: false
},
],
//
// 搜索框默认搜索引擎
// 属性:
// - name 搜索引擎名称
// - url 搜索引擎搜索url
// - home 搜索引擎主页url
//
defaultEngine: {
name: Bing.name,
url: Bing.url,
home: Bing.home,
},
//
// 绑定快捷键的搜索引擎列表
// 属性:
// - name 搜索引擎名称
// - url 搜索引擎搜索url
// - home 搜索引擎主页url
// - hotkeys 快捷键列表, 仅支持配置单字符按键的code值, 实际起作用的是Alt+单字符键, S/D/F/L键已被脚本征用
// - enable 是否启用
//
hotkeyEngines: [
{
name: '百度百科',
url: 'https://baike.baidu.com/search/word?pic=1&sug=1&word=%s',
home: 'https://baike.baidu.com/',
hotkeys: ['KeyW'],
enable: true,
},
{
name: '百度翻译',
url: 'https://fanyi.baidu.com/#auto/zh/%s',
home: 'https://fanyi.baidu.com/',
hotkeys: ['KeyE'],
enable: true,
},
{
name: '百度',
url: Baidu.url,
home: Baidu.home,
hotkeys: ['KeyB'],
enable: true,
},
{
name: 'Google',
url: Google.url,
home: Google.home,
hotkeys: ['KeyG'],
enable: true,
},
],
//
// 常用搜索引擎列表
// 属性:
// - name 搜索引擎名称
// - url 搜索引擎搜索url
// - home 搜索引擎主页url
// - icon 搜索引擎图标, base64编码
// - enable 是否启用
//
frequentEngines: [
Baidu.callSiteInformation(),
Google.callSiteInformation(),
Bing.callSiteInformation(),
Baidufanyi.callSiteInformation(),
GitHub.callSiteInformation(false),
Zhihu.callSiteInformation(),
Googlenews.callSiteInformation(false),
Bilibili.callSiteInformation(),
Taobao.callSiteInformation(false),
Jingdong.callSiteInformation(),
Tianmao.callSiteInformation(false),
Baiduwangpan.callSiteInformation(false),
Maimai.callSiteInformation(false),
],
//
// 分类搜索引擎列表, 二维数组, 默认认为该配置包含了所有已配置搜索引擎
// 一级分类属性:
// - name 分类名称
// - enable 该分类是否启用
// - engines 该分类下的搜索引擎列表
// 二级搜索引擎属性:
// - name 搜索引擎名称
// - url 搜索引擎搜索url
// - home 搜索引擎主页url
// - icon 搜索引擎图标, base64编码
// - enable 搜索引擎是否启用
//
classifiedEngines: [
{
name: '搜索引擎',
enable: true,
engines: [
Baidu.callSiteInformation(),
Google.callSiteInformation(),
Bing.callSiteInformation(),
{
name: '搜狗',
url: 'https://www.sogou.com/web?query=%s',
icon: 'https://dlweb.sogoucdn.com/translate/favicon.ico?v=20180424',
enable: true
},
{
name: '360',
url: 'https://www.so.com/s?ie=utf-8&q=%s',
icon: 'https://s.ssl.qhimg.com/static/121a1737750aa53d.ico',
enable: true
}
]
},
{
name: '知识',
enable: true,
engines: [
Zhihu.callSiteInformation(),
StackOverflow.callSiteInformation(),
Maimai.callSiteInformation(),
{
name: 'Quora',
url: 'https://www.quora.com/search?q=%s',
icon: 'data:image/x-icon;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAA81JREFUWAntVluIjFEc/51vlkUiLMot7LBo5ZoSudSSOyu7s6554EFC8iBFNg/a8uTysOVSbmlG7bh7cC0PiiKXbMsMDyRWucsuu3P8zuR8e+acb8Ymb/bUdP6X3/9/fud3vu98A7SN/10B0VoBLoXR5YuHUjRjlgTGsrA353zWv6WdFAJXEEK8vA51re2pcH8kEJuIjvIdtkqJjcR3y9WczQhDvL2H7YufoTYXVudyEoiFMYIdo2xa7BcIPCDtI8LDY6rxnfG+KYm5VGAFsXkKx6YqvimSxEHl5xpZCaQXB26xaXfdgIvuF6Oxufw0l7ZGrBDjUuAxGCp5AtvKE6iyoBluIIGaYejxswkPuHhfA30rksBU7pSCBA+SXkA1zppZkl4WeYZTZsy0PdPR9o+f2G0tDhHCrlyLq1ru9hz1v6/7pGeJvRdGZn92HALxMAopy9qMJsAHMQo3rFigS5JxM8GN9PzagC1mzLQdAj+ACDW2j+Ze0LmbjbQtUrirbX+WWOrbluEQ4AnPtjDKTQbEsoUSTkJicKwIRU6cAZcAMMAGUo6PdiyrL/ApKCebMTAo7hIQ6G0DpUCDHcvm54eCsXwWnL6qh0tA4r3dnAqoK7dVo1GiSxCQD+fboLhLQOClA5To6sSyBbyWi8uEtMvDC9PXdvrq1I6a+QZc5zTBjPGdKNR+dCjmyBRWU5UhjHUm/jnzNV4BjpXfxne+Bb001p+5qdIKJFDpR3zDUSAv5N5aXGSMrIR3tgh9eAmfI8synulo/sK0ZyKFalmPO/FhGJhKYbzf/bfBRQ6JSqIChkNgSR0eEleTgZUoiJ3E5IV1eC09rOeOq6hAxmeXJIsbm3ApTcgo5tm/y+uEaiOUYbKPO84Uon8j8IhN/bMn8Cq/bjM0+sY0dKh/heNUYYmO2TNrpBfC3LKnuGzntO8ooBKLknjJwvlsoD6r6UEyJdEwqtRRqMD0m2jo1Q8raSrFnMHaZu5+fa7FVRFx2Ud0CKZwh6coax+NYtM7vBfS/wdof5ZNmEfMbp3XMxuXUrEz2k8T3wnJGu6lZeQkoGDnh6LgWzP2sND/w9FSnsMSOFyRwBqF4JtTwpvwCs1rFUmUmFV/JKDBvMsHsckq+rP4G8tdt1c5NnjD6QmNSYxlXFjMXVSK8fFfxX2rr+w+qrJJ1enRagK6QM/6Gz/vET6oGI9rB++HXTofOAuMoyr3zNxfEzCbKDtWhpC8j6NUYbmdS/sCB7j4Bjv3zwioxupBi57AUiGxjkcynLKHONfyvamOPMVRe/E2v00BpcAvNM8U1IpUANcAAAAASUVORK5CYII=',
enable: false
},
Baiduzhidao.callSiteInformation(),
{
name: '维基百科',
url: 'https://zh.wikipedia.org/wiki/%s',
icon: 'https://s2.loli.net/2022/08/17/uycfXb6FIGRV5mN.png',
enable: true
},
Baidubaike.callSiteInformation(),
{
name: '萌娘百科',
url: 'https://zh.moegirl.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C4A/wC9ALIAswD/AG8AAAAAAAAAAAD/AAEAogDmAM4AVADVABEAAAAAAAAAAAAAAAAAAAAAAKwAhQCfALsAyQDBAOwA/wDqAP8A8gD9AMkApQCPAGkAlwBqAJcA8QChAKsAqwBkAJAATgCvADsAAAAAAAAAAAC0AEsAmQB8AMoAlQDzAPYA/wD/APkA6gCgALcAngDCAJQAwgCSANwAkAD9AJcA0QCcAN0AqACfAAAAAAAAAAAAAAAAAAAAAAAAAAAAoQCVAK0AnAD/AB8AAAAAAAAAAAAAAAAAwgAqAJgA+AD/AAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOEADgD4AAoAAAAAAAAAAAAAAAAAAAAAAAAAAAD/AAoA/wABAAAAAAAAAAAAAAAA//+sQf8zrEHAM6xBgDGsQZgBrEGAAaxBgDmsQYABrEGAAaxBgAGsQcIBrEHhh6xBgAGsQYABrEHxx6xB8+esQQ==',
enable: false
},
{
name: '豆丁文档',
url: 'https://www.docin.com/search.do?searchcat=2&searchType_banner=p&nkey=%s',
icon: 'https://st.douding.cn/images_cn/topic/favicon.ico?rand=24220809',
enable: true
},
{
name: '豆瓣读书',
url: 'https://search.douban.com/book/subject_search?search_text=%s',
home: 'https://book.douban.com/',
icon: 'https://www.douban.com/favicon.ico',
enable: true
},
{
name: '微信(搜狗)',
url: 'https://weixin.sogou.com/weixin?ie=utf8&type=2&query=%s',
icon: 'https://dlweb.sogoucdn.com/translate/favicon.ico?v=20180424',
enable: true
},
{
name: '果壳',
url: 'https://www.guokr.com/search/all/?wd=%s',
icon: 'https://www.guokr.com/favicon.ico',
enable: false
}
]
},
{
name: '开发',
enable: true,
engines: [
StackOverflow.callSiteInformation(),
{
name: 'Apache Issues',
url: 'https://issues.apache.org/jira/secure/QuickSearch.jspa?searchString=%s',
home: 'https://issues.apache.org/jira/',
icon: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAA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EAAP//AAA=',
enable: true
}
]
},
{
name: '翻译',
enable: true,
engines: [
Baidufanyi.callSiteInformation(),
Googlefanyi.callSiteInformation(),
{
name: '有道词典',
url: 'https://youdao.com/w/%s',
icon: 'https://shared-https.ydstatic.com/images/favicon.ico',
enable: true
},
{
name: '必应翻译',
url: 'https://cn.bing.com/dict/search?q=%s',
home: 'https://www.bing.com/dict',
icon: Bing.icon,
enable: true
},
{
name: '海词词典',
url: 'http://dict.cn/%s',
icon: 'http://i1.haidii.com/favicon.ico',
enable: true
},
{
name: 'CNKI翻译',
url: 'http://dict.cnki.net/dict_result.aspx?scw=%s',
icon: 'https://epub.cnki.net/favicon.ico',
enable: false
},
{
name: '汉典',
url: 'https://www.zdic.net/hans/%s',
icon: 'https://www.zdic.net/favicon.ico',
enable: false
},
{
name: 'deepL',
url: 'https://www.deepl.com/translator#en/zh/%s',
icon: 'https://s2.loli.net/2022/08/17/m3H5BdLRAexbVsz.png',
enable: true
},
]
},
{
name: '地图',
enable: true,
engines: [
Baidumap.callSiteInformation(),
{
name: '高德地图',
url: 'https://www.amap.com/search?query=%s',
icon: 'https://a.amap.com/pc/static/favicon.ico',
enable: true
},
Googlemap.callSiteInformation(),
Googleearth.callSiteInformation()
]
},
{
name: '图片',
enable: true,
engines: [
Baidutupian.callSiteInformation(),
{
name: '搜狗图片',
url: 'https://pic.sogou.com/pics?query=%s',
icon: 'https://dlweb.sogoucdn.com/translate/favicon.ico?v=20180424',
enable: true
},
Googlepic.callSiteInformation(),
{
name: '必应图片',
url: 'https://www.bing.com/images/search?q=%s',
home: 'https://www.bing.com/images/trending',
icon: Bing.icon,
enable: true
},
{
name: 'pixiv',
url: 'https://www.pixiv.net/tags/%s',
icon: 'https://s2.loli.net/2022/08/17/OxGZLn26TlWyQt9.png',
enable: true
},
{
name: 'flickr',
url: 'https://www.flickr.com/search/?q=%s',
icon: 'https://combo.staticflickr.com/pw/favicon.ico',
enable: true
},
{
name: '花瓣',
url: 'https://huaban.com/search/?q=%s',
icon: 'https://huaban.com/favicon.ico',
enable: true
}
]
},
{
name: '音乐',
enable: true,
engines: [
{
name: '网易云音乐',
url: 'https://music.163.com/#/search/m/?s=%s',
icon: 'https://s1.music.126.net/style/favicon.ico?v20180823',
enable: true
},
{
name: 'QQ音乐',
url: 'https://y.qq.com/portal/search.html#page=1&searchid=1&remoteplace=txt.yqq.top&t=song&w=%s',
icon: 'https://y.qq.com/favicon.ico?max_age=2592000',
enable: true
},
{
name: '酷我音乐',
url: 'http://www.kuwo.cn/search/list?type=all&key=%s',
icon: 'http://www.kuwo.cn/favicon.ico',
enable: true
},
{
name: '咪咕音乐',
url: 'https://music.migu.cn/v3',
icon: 'https://music.migu.cn/favicon.ico',
enable: true
},
{
name: '酷狗5sing',
url: 'http://search.5sing.kugou.com/?keyword=%s',
home: 'http://5sing.kugou.com/index.html',
icon: 'http://5sing.kugou.com/favicon.ico',
enable: true
}
]
},
{
name: '购物',
enable: true,
engines: [
Taobao.callSiteInformation(),
Jingdong.callSiteInformation(),
Tianmao.callSiteInformation(),
{
name: '当当',
url: 'http://search.dangdang.com/?key=%s&act=input',
home: 'http://www.dangdang.com/',
icon: 'http://www.dangdang.com/favicon.ico',
enable: false
},
{
name: '苏宁',
url: 'https://search.suning.com/%s/',
home: 'https://www.suning.com/',
icon: 'https://www.suning.com/favicon.ico',
enable: false
},
{
name: '亚马逊',
url: 'https://www.amazon.cn/s?k=%s',
icon: 'https://www.amazon.cn/favicon.ico',
enable: false
}
]
},
/*{
name: '自定义',
enable: true,
engines: [
Baiduwangpan.callSiteInformation(),
]
},*/
{
name: '学术',
enable: true,
engines: [
Googlexueshu.callSiteInformation(),
Baiduxueshu.callSiteInformation(),
{
name: '知网',
url: 'http://epub.cnki.net/kns/brief/default_result.aspx?txt_1_value1=%s&dbPrefix=SCDB&db_opt=CJFQ%2CCJFN%2CCDFD%2CCMFD%2CCPFD%2CIPFD%2CCCND%2CCCJD%2CHBRD&singleDB=SCDB&action=scdbsearch',
icon: 'https://epub.cnki.net/favicon.ico',
enable: true
},
{
name: '万方',
url: 'http://www.wanfangdata.com.cn/search/searchList.do?searchType=all&searchWord=%s',
icon: 'https://cdn.s.wanfangdata.com.cn/favicon.ico',
enable: true
},
{
name: 'WOS',
url: 'http://apps.webofknowledge.com/UA_GeneralSearch.do?fieldCount=3&action=search&product=UA&search_mode=GeneralSearch&max_field_count=25&max_field_notice=Notice%3A+You+cannot+add+another+field.&input_invalid_notice=Search+Error%3A+Please+enter+a+search+term.&input_invalid_notice_limits=+%3Cbr%2F%3ENote%3A+Fields+displayed+in+scrolling+boxes+must+be+combined+with+at+least+one+other+search+field.&sa_img_alt=Select+terms+from+the+index&value(input1)=%s&value%28select1%29=TI&value%28hidInput1%29=initVoid&value%28hidShowIcon1%29=0&value%28bool_1_2%29=AND&value%28input2%29=&value%28select2%29=AU&value%28hidInput2%29=initAuthor&value%28hidShowIcon2%29=1&value%28bool_2_3%29=AND&value%28input3%29=&value%28select3%29=SO&value%28hidInput3%29=initSource&value%28hidShowIcon3%29=1&limitStatus=collapsed&expand_alt=Expand+these+settings&expand_title=Expand+these+settings&collapse_alt=Collapse+these+settings&collapse_title=Collapse+these+settings&SinceLastVisit_UTC=&SinceLastVisit_DATE=×panStatus=display%3A+block&timeSpanCollapsedListStatus=display%3A+none&period=Range+Selection&range=ALL&ssStatus=display%3Anone&ss_lemmatization=On&ss_query_language=&rsStatus=display%3Anone&rs_rec_per_page=10&rs_sort_by=PY.D%3BLD.D%3BVL.D%3BSO.A%3BPG.A%3BAU.A&rs_refinePanel=visibility%3Ashow',
icon: 'data:image/x-icon;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAABEpJREFUWAmdVl1sFFUUPmfY2S3QVoMI7XYhUSsmGqttjRZqtCIBEoT4YGrQPuiDoSXCA4nRREPqi/ENSYWiUVQSSRNSS9Q3I0GFtmoN8aeJQbQrrNAaq7S2pWS7c/3OtjPO7N6ZzuxJzt57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+lkNvRsfbwRCXpdqa5jaXGEEpkEZ2VbUedGFPJbkaBfd+0Aa99N7wPOYYeclnnX9EY0kk5FE7vFZSY2BeAg+9gQQKesVatcSKL83m3AZjimlX4XLHhDatbW7N/+ih0V4efDVXY8N2mL68evuaoIO2fYBRvTn2aN248AAwDlS8jXdEymWAAAAABJRU5ErkJggg==',
enable: true
},
{
name: 'Letpub',
url: 'https://www.letpub.com.cn/index.php?page=journalapp&view=search&searchsort=relevance&searchname=%s',
home: 'https://www.letpub.com.cn/',
icon: 'https://www.letpub.com.cn/images/favicon.ico',
enable: true
},
{
name: '科研通',
url: 'https://www.ablesci.com/journal/index?keywords=%s',
home: 'https://www.ablesci.com/',
icon: 'https://www.ablesci.com/favicon.ico/',
enable: true
}
]
},
{
name: '社交',
enable: true,
engines: [
Weibo.callSiteInformation(),
Baidutieba.callSiteInformation(),
Zhihu.callSiteInformation(),
{
name: '豆瓣',
url: 'https://www.douban.com/search?q=%s',
home: 'https://www.douban.com/',
icon: 'https://www.douban.com/favicon.ico',
enable: true
},
{
name: 'Twitter',
url: 'https://twitter.com/search?q=%s',
icon: 'https://s2.loli.net/2022/08/17/rsbLXJA1lG5hmfe.png',
enable: false
},
{
name: 'Facebook',
url: 'https://www.facebook.com/search/results.php?q=%s',
icon: 'https://s2.loli.net/2022/08/17/69R4ObX3kUctNvM.png',
enable: false
}
]
},
{
name: '新闻',
enable: false,
engines: [
Googlenews.callSiteInformation(),
Baiduxinwen.callSiteInformation(),
{
name: '今日头条',
url: 'https://www.toutiao.com/search/?keyword=%s',
icon: 'https://lf3-search.searchpstatp.com/obj/card-system/favicon_5995b44.ico',
enable: true
},
Weibo.callSiteInformation(),
Zhihu.callSiteInformation()
]
}
],
};
///////////////////////////////////////////////////////////////////
// css样式
///////////////////////////////////////////////////////////////////
const sheet = `
/*
注意: 为了避免网页style对该工具的影响, 所有样式均进行初始化并加入!important,
js中设置style时也要注意将其设置为important, 否则不能生效.
*/
/* 划词工具条 */
.qs-toolbar {
/* 初始化所有style, 避免被网页本身的style影响 */
all: initial !important;
position: absolute !important;
display: block !important;
height: 26px !important;
padding: 2px !important;
white-space: nowrap !important;
border: 1px solid #F5F5F5 !important;
box-shadow: 0px 0px 2px #BBB !important;
background-color: #FFF !important;
z-index: 10000 !important;
}
.qs-toolbar-icon {
all: initial !important;
display: inline-block !important;
margin: 0px !important;
padding: 2px !important;
width: 20px !important;
height: 20px !important;
border: 1px solid #FFF !important;
cursor: pointer !important;
}
.qs-toolbar-icon:hover {
border: 1px solid #CCC !important;
}
/* 快搜主窗口背景层 */
.qs-main-background-layer {
all: initial !important;
position: fixed !important;
display: block !important;
top: 0px !important;
left: 0px !important;
width: 100% !important;
height: 100% !important;
border: 0px !important;
background-color: rgba(255,255,255,0.3) !important;
/* 使背景层背后的所有元素虚化 */
backdrop-filter: blur(5px) !important;
z-index: 20000 !important;
}
/* 快搜主窗口 */
.qs-mainbox {
all: initial !important;
position: fixed !important;
display: block !important;
text-align: center !important;
overflow: scroll !important;
left: 50% !important;
top: 50% !important;
transform: translate(-50%, -50%) !important;
/* 宽度优先展示 */
width: max-content !important;
min-width: 500px !important;
max-width: 1400px !important;
min-height: 75px !important;
max-height: 650px !important;
padding: 10px !important;
border: 1px solid #F5F5F5 !important;
box-shadow: 0px 0px 6px #BBB !important;
border-radius: 10px !important;
background-color: #FFF !important;
opacity: 1 !important;
z-index: 30000 !important;
}
/* 快搜主窗口搜索框 */
.qs-main-search-box {
all: initial !important;
display: block !important;
text-align: center !important;
width: 100% !important;
margin: 5px 0px !important;
border: 0px !important;
}
.qs-main-search-input {
all: initial !important;
text-align: left !important;
width: 80% !important;
min-width: 400px !important;
max-width: 600px !important;
height: 40px !important;
padding: 0px 13px !important;
font: 17px/20px arial !important;
border: 2px solid #C4C7CE !important;
border-radius: 10px !important;
outline: none !important;
}
.qs-main-search-input:hover, .qs-main-search-input:focus {
border-color: #4E71F2 !important;
}
.qs-main-search-input::selection {
color: #FFF !important;
background-color: #425d78 !important;
}
.qs-main-search-input::placeholder {
color: #DDD !important;
opacity: 1 !important;
}
/* 快搜主窗口常用搜索引擎列表 */
.qs-main-frequent-box {
all: initial !important;
display: block !important;
text-align: center !important;
width: 100% !important;
height: 38px !important;
margin: 15px 0px 5px 0px !important;
white-space: nowrap !important;
border: 0px !important;
}
.qs-main-frequent-icon {
all: initial !important;
display: inline-block !important;
width: 28px !important;
height: 28px !important;
margin: 0px 6px !important;
padding: 3px !important;
border: 2px solid #FFF !important;
cursor: pointer !important;
}
.qs-main-frequent-icon:hover {
border: 2px solid #CCC !important;
}
/* 快搜主窗口分类搜索引擎列表 */
.qs-main-classified-box {
all: initial !important;
display: block !important;
text-align: center !important;
width: 100% !important;
margin-top: 15px !important;
padding-top: 5px !important;
border: 0px !important;
border-top: 1px solid #DDD !important;
}
.qs-main-classified-family-box {
all: initial !important;
display: inline-block !important;
text-align: left !important;
vertical-align: top !important;
min-width: 50px !important;
max-width: 150px !important;
height: 100% !important;
margin: 5px 3px !important;
border: 0px !important;
}
.qs-main-classified-family-title {
all: initial !important;
display: block !important;
text-align: left !important;
margin: 5px 4px !important;
font-size: 18px !important;
font-weight: 300 !important;
color: #777 !important;
border: 0px !important;
}
.qs-main-classified-family-engine {
all: initial !important;
display: block !important;
text-align: left !important;
vertical-align: middle !important;
height: 26px !important;
border: 2px solid #FFF !important;
cursor: pointer !important;
}
.qs-main-classified-family-engine:hover {
border: 2px solid #CCC !important;
}
.qs-main-classified-family-engine-icon {
all: initial !important;
display: inline-block !important;
vertical-align: middle !important;
width: 16px !important;
height: 16px !important;
margin: 0px 3px 0px 2px !important;
border: 0px !important;
cursor: pointer !important;
}
.qs-main-classified-family-engine-name {
all: initial !important;
display: inline-block !important;
vertical-align: middle !important;
margin-right: 2px !important;
font-size: 13px !important;
font-family: arial,sans-serif !important;
font-weight: 400 !important;
color: #5F5F5F !important;
border: 0px !important;
cursor: pointer !important;
}
.qs-main-help-info-box {
all: initial !important;
display: block !important;
text-align: center !important;
width: 100% !important;
margin: 5px 0px !important;
border: 0px !important;
}
.qs-main-help-info-item {
all: initial !important;
margin: 0px 10px !important;
font-size: 8px !important;
color: #DDD !important;
cursor: pointer !important;
text-decoration: none !important;
}
.qs-main-help-info-item:hover {
color: #4E71F2 !important;
}
/* 设置窗口 */
.qs-setting-box {
all: initial !important;
position: fixed !important;
display: block !important;
left: 50% !important;
top: 50% !important;
transform: translate(-50%, -50%) !important;
width: fit-content !important;
height: fit-content !important;
padding: 10px !important;
border: 1px solid #F5F5F5 !important;
box-shadow: 0px 0px 6px #BBB !important;
border-radius: 10px !important;
background-color: #FFF !important;
opacity: 1 !important;
z-index: 40000 !important;
}
.qs-setting-config-textarea {
all: initial !important;
display: block !important;
width: 800px !important;
height: 650px !important;
padding: 5px !important;
white-space: pre !important;
overflow-wrap: normal !important;
font: 400 13.3333px Arial !important;
border: 1px solid #CCC !important;
border-radius: 5px !important;
}
.qs-setting-config-textarea:focus {
border-color: #4E71F2 !important;
}
.qs-setting-button-bar {
all: initial !important;
display: block !important;
width: 100% !important;
text-align: right !important;
border: 0px !important;
}
.qs-setting-button {
all: initial !important;
display: inline-block !important;
width: 60px !important;
margin: 10px 0px 5px 20px !important;
font-size: 13px !important;
color: #555 !important;
border: 0px !important;
cursor: pointer !important;
}
.qs-setting-button:hover {
color: #4E71F2 !important;
}
/* 信息提示浮层 */
.qs-info-tips-layer {
all: initial !important;
position: fixed !important;
display: block !important;
overflow: hidden !important;
bottom: 30px !important;
right: 30px !important;
width: fit-content !important;
height: fit-content !important;
padding: 10px !important;
font-size: 13px !important;
color: #FFF !important;
border: 0px !important;
border-radius: 3px !important;
background-color: rgba(0,0,0,0.7) !important;
z-index: 50000 !important;
}
/* 搜索建议浮层 */
.qs-suggestions-layer {
all: initial !important;
position: fixed !important;
display: block !important;
overflow: hidden !important;
height: fit-content !important;
border: 1px solid #F5F5F5 !important;
z-index: 30001 !important;
}
.qs-suggestion-item, .qs-suggestion-item-selected {
all: initial !important;
display: block !important;
text-align: left !important;
vertical-align: middle !important;
width: 100% !important;
height: 33px !important;
line-height: 33px !important;
padding-left: 13px !important;
font-size: 15px !important;
font-family: arial,sans-serif !important;
font-weight: 400 !important;
color: #555 !important;
border: 0px !important;
background-color: rgba(255,255,255,0.9) !important;
}
.qs-suggestion-item-selected {
background-color: rgba(230,230,230,0.9) !important;
}
.qs-suggestion-item:hover {
cursor: pointer !important;
background-color: rgba(230,230,230,0.9) !important;
}
`;
///////////////////////////////////////////////////////////////////
// 全局变量
///////////////////////////////////////////////////////////////////
var conf = GM_getValue('qs-conf', defaultConf);
var hotkey2Engine = {}; // 自定义快捷键搜索的hotkey到engine的映射表
var qsPageLock = false; // 是否在当前页面锁定快搜所有功能, 锁定之后仅响应解锁快捷键
var qsToolbar = null; // 快搜划词工具条
var qsBackgroundLayer = null; // 快搜主窗口背景层
var qsMainBox = null; // 快搜主窗口
var qsSearchInput = null; // 快搜主窗口搜索框
var qsSettingBox = null; // 快搜设置窗口
var qsConfigTextarea = null; // 快搜设置窗口配置框
var qsInfoTipsLayer = null; // 快搜信息提示浮层
var qsSuggestionsLayer = null; // 快搜搜索建议浮层
var qsSuggestionItems = []; // 快搜搜索建议所有item元素(不一定都显示)
///////////////////////////////////////////////////////////////////
// 版本升级更新配置
///////////////////////////////////////////////////////////////////
//
// for 1.1 -> 1.2
//
if (!conf.engineSuggestions) {
conf.engineSuggestions = defaultConf.engineSuggestions;
GM_setValue('qs-conf', conf);
}
///////////////////////////////////////////////////////////////////
// 功能函数
///////////////////////////////////////////////////////////////////
// 获取元素style属性, 包括css中的
function getStyleByElement(e, styleProp) {
if (window.getComputedStyle) {
return document.defaultView.getComputedStyle(e, null).getPropertyValue(styleProp);
} else if (e.currentStyle) {
return e.currentStyle[styleProp];
}
}
// 计算元素在文档(页面)中的绝对位置
function getElementPosition(e) {
return {
top: e.getBoundingClientRect().top + window.scrollY, // 元素顶部相对于文档顶部距离
bottom: e.getBoundingClientRect().bottom + window.scrollY, // 元素底部相对于文档顶部距离
left: e.getBoundingClientRect().left + window.scrollX, // 元素左边相对于文档左侧距离
right: e.getBoundingClientRect().right + window.scrollX // 元素右边相对于文档左侧距离
};
}
// 获取可视窗口在文档(页面)中的绝对位置
function getWindowPosition() {
return {
top: window.scrollY,
bottom: window.scrollY + window.innerHeight,
left: window.scrollX,
right: window.scrollX + window.innerWidth
};
}
// 判断元素在文档(页面)中是否可见
function isVisualOnPage(ele) {
if (getStyleByElement(ele, 'display') == 'none'
|| getStyleByElement(ele, 'visibility') == 'hidden'
|| getStyleByElement(ele, 'opacity') == '0') {
return false;
}
if (getStyleByElement(ele, 'position') != 'fixed'
&& ele.offsetParent == null) {
return false;