-
Notifications
You must be signed in to change notification settings - Fork 226
/
Copy pathAC-Baidu-SoGou-Google-NoRedirect_26.99.user.js
4088 lines (3865 loc) · 202 KB
/
AC-Baidu-SoGou-Google-NoRedirect_26.99.user.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 AC-baidu-重定向优化百度搜狗谷歌必应搜索_favicon_双列
// @name:en AC-baidu-google_sogou_bing_RedirectRemove_favicon_adaway_TwoLine
// @name:zh AC-baidu-重定向优化百度搜狗谷歌必应搜索_favicon_双列
// @name:ja AC-baidu-重定向最適化Baiduの搜狗のGoogleのBing検索結果のリダイレクト除去+favicon
// @description 1.繞過百度、搜狗、谷歌、好搜搜索結果中的自己的跳轉鏈接,直接訪問原始網頁-反正都能看懂 2.新增自定义网站拦截功能 3添加Favicon显示 4.页面CSS 5.添加计数 6.开关选择以上功能 7.自动翻页功能
// @description:en 1.bypass the redirect link at baidu\sogou\google\haosou; 2.remove ads at baidu; 3.add Favicon for each website; 4.render your own style; 5.counter; 6.Switch to handle all 7.Auto Pager
// @description:ja 1.迂回Baidu、Sogou、Google、Haosou検索検索結果の中の自分の遷移リンク; 2.Baiduの余分な広告を取り除く; 3.コメントを追加; 4.ページのカスタムCSP; 5.カウントを追加; 6.スイッチは以上の機能を選択します; 7.自動ページめくり.
// @icon https://ae01.alicdn.com/kf/Hac1a58055c5047cdb91349e91aa208d5k.jpg
// @author AC
// @license GPL-3.0-only
// @create 2015-11-25
// @run-at document-body
// @version 26.99
// @connect baidu.com
// @connect google.com
// @connect google.com.hk
// @connect google.com.jp
// @connect bing.com
// @connect duckduckgo.com
// @connect dogedoge.com
// @connect so.com
// @include *://ipv6.baidu.com/*
// @include *://www.baidu.com/*
// @include *://www1.baidu.com/*
// @include *://m.baidu.com/*
// @include *://xueshu.baidu.com/s*
// @include *://www.so.com/s?*
// @include *://*.bing.com/*
// @include *://encrypted.google.*/search*
// @include *://*.google*/search*
// @include *://scholar.google.com/scholar*
// @include *://*.google*/webhp*
// @include *://*.zhihu.com/*
// @include *://*duckduckgo.com/*
// @include *://*.dogedoge.com/*
// @exclude *://*.google*/sorry*
// @exclude https://zhidao.baidu.com/*
// @exclude https://*.zhidao.baidu.com/*
// @exclude https://www.baidu.com/img/*
// @exclude https://lens.google.com/*
// @supportURL https://ac.tujidu.com/
// @home-url https://greasyfork.org/zh-TW/scripts/14178
// @home-url2 https://github.com/langren1353/GM_script
// @homepageURL https://greasyfork.org/zh-TW/scripts/14178
// @copyright 2015-2023, AC
// @lastmodified 2024-08-06
// @feedback-url https://github.com/langren1353/GM_script
// @note 2024.08-06-V26.99 feature:增加样式表的缓存功能;修复谷歌等正常样式;本版本为自有面板的最后一版,后续将转移到外部面板设置
// @note 2024.03-05-V26.10 fix: 谷歌白屏的问题;再次支持鸭鸭搜索引擎,鸭鸭三列支持;baidu\Google双列功能
// @note 2023.12-16-V26.07 日常维护;优化各页面加载卡顿的问题,优化搜索引擎显示效果
// @note 2023.06-19-V26.06 修复谷歌显示效果的错位问题等,修复谷歌异常白屏问题
// @note 2022.12-07-V26.04 修复必应错位问题;优化谷歌双列动画问题
// @note 2022.08-23-V26.03 修复因背景图引起的看不清字的问题;修复百度单列错位问题;修复google自定义按钮不可见
// @note 2022.08-23-V26.02 加快代码执行速度;减少动画撕裂;替换CDN的md5库
// @note 2022.08-22-V26.01 因甲癌手术和公司事务停更了2个月,目前补上,推荐更新。 1.修复百度加载缓慢的问题;2.修复谷歌样式加载顺序异常的问题;3.整体优化样式加载时间,更流畅了
// @note 2022.06-18-V25.09 修复可能出现的脚本参数读取失败导致的脚本不执行的异常 & 修复 拦截规则特殊参数的问题 & 更换CDN地址
// @note 2022.06-16-V25.06 优化重定向逻辑,部分网站只需要稍作处理,不用做接口请求了,感谢众多搜索引擎的版本迭代更新
// @note 2022.04-08-V25.05 主要修复Block功能;其次优化样式加载速度-减少撕裂感
// @note 2022.03-07-V25.04 修复谷歌、必应样式问题;修复并优化拦截功能
// @note 2022.01-29-V25.02 修复谷歌、百度、必应的部分样式错位的问题
// @note 2021.12-06-V25.01 修复百度样式偏左 & 修复谷歌样式显示
// @note 2021.10-31-V24.29 fixed Less requirement for faster Load
// @note 2021.10-29-V24.27 移除必应能选择的广告;增加自定义样式less的支持
// @note 2021.09-02-V24.26 修复必应多favicon,修复百度百科问题;修复谷歌一个小问题
// @note 2021.07-16-V24.25 修复一个bug;兼容百度下搜索股票tag;
// @note 2021.06-15-V24.24 更换cdn地址
// @note 2017.05.12 -> 2021.06-15 && V8.6 -> V24.24 各种各样的历史更新记录,从一个版本迭代到另一个版本
// @note 2017.05.12-V8.4 新增:默认屏蔽谷歌的安全搜索功能
// @note 2017.05.05-V8.3 修复include范围太小导致的百度知道的屏蔽问题
// @note 2017.05.04-V8.2 终于修复了百度知道图片替换了文字的这个大BUG; 顺便处理了superapi.zhidao.baidu.com; 新增谷歌搜索结果重定向去除
// @note 2017.05.04-V8.1 终于修复了百度知道图片替换了文字的这个大BUG,顺便处理了superapi.zhidao.baidu.com
// @note 2017.05.04-V8.0 终于修复了百度知道图片替换了文字的这个大BUG,待测试
// @note 2017.03.28-V7.6 修复在ViolentMonkey上的不支持的问题
// @note 2017.03.28-V7.5 尝试修复chrome上的问题
// @note 2017.03.21-V7.4 尝试处理Edge上不支持的问题,结果发现是Edge本身的TamperMonkey支持有问题
// @note 2017.03.19-V7.3 修复打开百度之后再次点击“百度一下”导致的无法更新重定向问题
// @note 2017.03.19-V7.2 未知原因chrome的MutationObserver无法使用了,继续回归以前的DOMNodeInserted
// @note 2017.02.17-V7.0 修复搜狗的搜索结果重定向问题+改个名字
// @note 2017.02.17-V6.9 修复搜狗的搜索结果重定向问题
// @note 2016.10.27-V6.7 修复了以前的重复请求,现在的请求数应该小了很多,网络也就不卡了,感觉萌萌哒
// @note 2016.04.24-V6.6 恢复以前的版本,因为兼容性问题
// @note 2015.12.01-V5.0 加入搜狗的支持,但是支持不是很好
// @note 2015.11.25-V2.0 优化,已经是真实地址的不再尝试获取
// @note 2015.11.25-V1.0 完成去掉百度重定向的功能
// @resource baiduCommonStyle https://ibaidu.tujidu.com/newcss/baiduCommonStyle.less?t=26.09
// @resource baiduOnePageStyle https://ibaidu.tujidu.com/newcss/baiduOnePageStyle.less?t=26.09
// @resource baiduTwoPageStyle https://ibaidu.tujidu.com/newcss/baiduTwoPageStyle.less?t=26.09
// @resource googleCommonStyle https://ibaidu.tujidu.com/newcss/googleCommonStyle.less?t=26.09
// @resource googleOnePageStyle https://ibaidu.tujidu.com/newcss/googleOnePageStyle.less?t=26.09
// @resource googleTwoPageStyle https://ibaidu.tujidu.com/newcss/googleTwoPageStyle.less?t=26.09
// @resource bingCommonStyle https://ibaidu.tujidu.com/newcss/bingCommonStyle.less?t=26.09
// @resource bingOnePageStyle https://ibaidu.tujidu.com/newcss/bingOnePageStyle.less?t=26.09
// @resource bingTwoPageStyle https://ibaidu.tujidu.com/newcss/bingTwoPageStyle.less?t=26.09
// @resource duckCommonStyle https://ibaidu.tujidu.com/newcss/duckCommonStyle.less?t=26.09
// @resource duckOnePageStyle https://ibaidu.tujidu.com/newcss/duckOnePageStyle.less?t=26.09
// @resource duckTwoPageStyle https://ibaidu.tujidu.com/newcss/duckTwoPageStyle.less?t=26.09
// @resource dogeCommonStyle https://ibaidu.tujidu.com/newcss/dogeCommonStyle.less?t=26.09
// @resource dogeOnePageStyle https://ibaidu.tujidu.com/newcss/dogeOnePageStyle.less?t=26.09
// @resource dogeTwoPageStyle https://ibaidu.tujidu.com/newcss/dogeTwoPageStyle.less?t=26.09
// @resource MainHuYanStyle https://ibaidu.tujidu.com/newcss/HuYanStyle.less?t=26.09
// @resource BgAutoFit https://ibaidu.tujidu.com/newcss/BgAutoFit.less?t=26.09
// @resource baiduLiteStyle https://gitcode.net/-/snippets/1906/raw/master/LiteStyle.css?inline=false
// @require https://lib.baomitu.com/vue/2.6.14/vue.min.js
// @require https://lib.baomitu.com/less.js/4.1.2/less.min.js
// @require https://lib.baomitu.com/md5-wasm/1.2.0/md5-wasm.min.js
// @grant GM_getValue
// @grant GM.getValue
// @grant GM_setValue
// @grant GM.setValue
// @grant GM_addStyle
// @grant GM_getResourceURL
// @grant GM_listValues
// @grant GM.getResourceUrl
// @grant GM_xmlhttpRequest
// @grant GM_getResourceText
// @grant GM_registerMenuCommand
// @grant unsafeWindow
// ==/UserScript==
// calc(X1(vw) + X2(px)) -> B(px) 使用 http://www.yunsuan.info/matrixcomputations/solvelinearsystems.html 进行计算
!function () {
let isdebug = false; // 调试日志用
let isLocalDebug = false; // 加载本地资源用,调试的时候小心GM的缓存机制
let debug = isdebug ? console.log.bind(console) : ()=>{}
let acCssLoadFlag = false;
let inExtMode = typeof (isExtension) !== "undefined";
let inGMMode = typeof (GM_info.scriptHandler) !== "undefined"; // = "Greasemonkey" || "Tampermonkey" || "ViolentMonkey"
// inExtMode & inGMMode
// true true =扩展下的GM代码 不执行
// true false=扩展下代码 执行
// false true =仅GM代码 执行
// false false=异常 但是还是要执行代码
debug("程序开始");
if (inExtMode === true && inGMMode === true || typeof(window.AC666Init) !== 'undefined') {
console.log("扩展模式-脚本不启用");
return;
}
window.AC666Init = true
if (typeof (GM) === "undefined") {
// 这个是ViolentMonkey的支持选项
GM = {};
GM.setValue = GM_setValue;
GM.getValue = GM_getValue;
}
// 增加了一个css的缓冲层,保证多次CSS操作不导致页面卡顿,减少重排的次数
class FlushDomFragment {
constructor() {
this.init()
}
init() {
this.length = 0
this.fragmentHead = document.createDocumentFragment();
this.fragmentBody = document.createDocumentFragment();
this.fragmentDOM = document.createDocumentFragment();
this.reloadList = [] // 所有需要动态刷新的都在这里面
}
_removeReload() {
this.reloadList.map(selector => {
safeRemove(selector)
})
}
_singleInsert(node, toDom, checkDom) {
if(node) {
const { dataset: { xclass: selector = '' } = {}, tagName = '' } = node
if(tagName.toUpperCase() === 'STYLE') {
if(selector) {
if(checkDom.querySelector(selector)) return
} else {
console.error('出现没有样式的节点', node)
}
}
toDom.appendChild(node)
this.length += 1
debug('增加节点', node)
debug('长度变化', this.length)
}
}
// 如果CSS已经存在了,那么就不再添加了
_dropMultiCSS(fragment) {
const newFrag = document.createDocumentFragment();
[...fragment.childNodes].map(node => {
this._singleInsert(node, newFrag, document)
})
return newFrag
}
flush() {
if(this.length > 0) { // 有数据,才进行flush,否则没有必要
this._removeReload()
// MARK 保证线程安全,将现有数据暂存,然后生成新的节点,避免其他js插入后丢失
const curBodyFrag = this.fragmentBody
const curHeadFrag = this.fragmentHead
const curDomFrag = this.fragmentDOM
this.init()
// 数据清除
const newBodyFrag = this._dropMultiCSS(curBodyFrag)
const newHeadFrag = this._dropMultiCSS(curHeadFrag)
const newDomFrag = this._dropMultiCSS(curDomFrag)
debug('数据flush1', newBodyFrag.children.length)
debug('数据flush2', newHeadFrag.children.length)
debug('数据flush3', newDomFrag.children.length)
safeWaitFunc("body", body => {
document.body.appendChild(newBodyFrag)
})
safeWaitFunc("head", body => {
document.head.appendChild(newHeadFrag)
})
while (newDomFrag.firstChild) {
document.head.insertBefore(newDomFrag, document.head.firstChild)
}
}
}
appendChild(node, to = 'head', config = {
isReload: false
}) {
return this.insert(node, to, config)
}
insert(node, to = 'head', config= {
isReload: false
}) {
if (to === 'body') {
this._singleInsert(node, this.fragmentBody, this.fragmentBody)
} else if(to === 'head') {
this._singleInsert(node, this.fragmentHead, this.fragmentHead)
} else if(to === 'DOM') {
this._singleInsert(node, this.fragmentDOM, this.fragmentDOM)
} else{
console.error('不支持的节点操作')
return
}
const { isReload } = config
if(isReload) {
const { classList = [] } = node
if(classList.length) {
this.reloadList.push('.' + [...(node.classList || [])].join('.'))
} else {
console.error('异常的reload参数,没有classList', node)
}
}
return this
}
}
function safeRemoveAd(cssSelectorOrNodeList) {
safeRemove(cssSelectorOrNodeList, {
withAni: false,
isAd: true // 标志是广告
})
}
function safeRemove(cssSelectorOrNodeList, option = {
withAni: false, // 带动效的删除
isAd: false // true = 有日志,false = 无日志
}) {
safeFunction(() => {
const { withAni = false, isAd = false} = option
let removeNodes = cssSelectorOrNodeList
if(typeof cssSelectorOrNodeList === 'string') {
removeNodes = document.querySelectorAll(cssSelectorOrNodeList);
}
if(removeNodes.length) {
if(isAd) {
console.log(`删除广告节点:${removeNodes.length}个`)
console.table(removeNodes)
}
for (let i = 0; i < removeNodes.length; i++) {
aniRemove(removeNodes[i], withAni)
}
}
})
}
function aniRemove(node, withAni) {
if(withAni) {
node.classList.add('aniDelete')
setTimeout(() => {
node.remove();
}, 200)
} else {
node.remove();
}
}
function safeFunction(func, failCb) {
try {
func();
} catch (e) {
failCb && failCb()
}
}
/**
*
* @param callback interval执行的函数,【注意this指针】
* @param timeout 时间周期
* @param slowAfterTime 等待多少时间后,调整时间周期
* @param newTimeout 新的时间周期
* @returns {{cancel: intervalInstance.cancel, reNew: intervalInstance.reNew, clear: intervalInstance.clear}}
*/
function setSlowInterval(callback = instance => {}, timeout = 50, slowAfterTime = 6000, newTimeout = 1500) {
const runAt = new Date().getTime()
let _timeout = timeout
let shouldPause = false
let shouldEnd = false
let intervalInstance = {
reNew: () => {
shouldPause = false
_timeout = new Date().getTime()
},
pause: () => {
shouldPause = true
},
cancel: () => {
shouldEnd = true
}
}
function newCallBack() {
const deltaT = new Date().getTime() - runAt
if(deltaT > slowAfterTime) {
_timeout = newTimeout
}
if(shouldEnd) {
return
}
if(!shouldPause) {
callback(intervalInstance)
setTimeout(newCallBack, _timeout)
} else {
setTimeout(() => {}, 5000)
}
}
newCallBack()
return intervalInstance
}
/**
* 每隔多少周期执行一次callback,减少调用周期
* 会先执行一次callback,然后开始计数
*
* @param callback 回调函数,【注意this指针】
* @param countPeriod 每隔多少周期
*/
function setCountFunction(callback, countPeriod) {
let t = 0
if(t % countPeriod === 0) {
callback()
t ++
}
}
function safeWaitFunc(selector, callbackFunc, time, notClear) {
time = time || 60;
notClear = notClear || false;
let doClear = !notClear;
setSlowInterval(instance => {
if ((typeof (selector) === "string" && document.querySelector(selector) != null)) {
callbackFunc(document.querySelector(selector));
if (doClear) instance.pause();
} else if (typeof (selector) === "function" && (selector() != null || (selector() || []).length > 0)) {
callbackFunc(selector()[0]);
if (doClear) instance.pause();
}
}, time);
}
(function () {
debug("程序执行");
let needDisplayNewFun = true; // 本次更新是否有新功能需要展示
if (window.NodeList && !NodeList.prototype.forEach) {
NodeList.prototype.forEach = function (callback, thisArg) {
thisArg = thisArg || window;
for (let i = 0; i < this.length; i++) {
callback.call(thisArg, this[i], i, this);
}
};
}
GM_registerMenuCommand('AC-重定向脚本设置', function() {
document.querySelector("#sp-ac-content").style.display = 'block';
});
GM_registerMenuCommand('脚本重置 - 修复脚本', function() {
GM_setValue('Config', '{}');
localStorage.setItem('ACConfig', '{}');
location.reload();
});
// let RedirectMap = new Map();
let ACConfig = {};
let DBConfig = {}; // 仅作为普通ACConfig的原始备份,在其他非关键位置时进行保存使用
/*存在对未初始化变量的初始化赋值-无需担心迭代兼容问题*/
let DefaultConfig = {
isRedirectEnable: false, // 是否开启重定向功能
isAdsEnable: false, // 是否开启去广告模式
isAutopage: true, // 是否开启自动翻页功能
isBlockEnable: false, // 是否开启去拦截模式
isBlockDisplay: false, // 是否删除已拦截的条目
isBlockBtnNotDisplay: false, // 是否显示block按钮
AdsStyleEnable: true, // 是否开启自定义样式模式
baidu: {
name: 'baidu', // CSS load 的前缀标志
AdsStyleMode: '1', // 0-不带css;1-单列靠左;2-单列居中;3-双列居中
HuYanMode: false, // 护眼模式-百度
defaultBgUrl: '', // 默认背景图
BgFit: true,
},
google: {
name: 'google',
AdsStyleMode: '3', // 0-不带css;1-单列靠左;2-单列居中;3-双列居中
HuYanMode: false, // 护眼模式-谷歌
defaultBgUrl: '', // 默认背景图
BgFit: true,
},
bing: {
name: 'bing',
AdsStyleMode: '3', // 0-不带css;1-单列靠左;2-单列居中;3-双列居中
HuYanMode: false, // 护眼模式-必应
defaultBgUrl: '', // 默认背景图
BgFit: true,
},
duck: {
name: 'duck',
AdsStyleMode: '3', // 0-不带css;1-单列靠左;2-单列居中;3-双列居中
HuYanMode: false, // 护眼模式-DuckGOGO
},
doge: {
name: 'doge',
AdsStyleMode: '3', // 0-不带css;1-单列靠左;2-单列居中;3-双列居中
HuYanMode: false, // 护眼模式-DuckGOGO
},
sogou: {
name: 'sogou',
AdsStyleMode: '1', // 0-不带css;1-单列靠左;2-单列居中;3-双列居中
HuYanMode: false, // 护眼模式-搜狗
},
zhihu: {
name: 'zhihu',
AdsStyleMode: '0', // 0-不带css;1-单列靠左;2-单列居中;3-双列居中
HuYanMode: false, // 护眼模式-搜狗
},
other: {
name: 'other',
AdsStyleMode: '0', // 0-不带css;1-单列靠左;2-单列居中;3-双列居中
HuYanMode: false, // 护眼模式-搜狗
},
Style_BaiduLite: false, // Baidu_Lite样式表
defaultHuYanColor: "#DEF1EF",
isUserColorEnable: true, // 是否开启favicon图标功能
isFaviconEnable: true, // 是否开启favicon图标功能
defaultFaviconUrl: "https://ae01.alicdn.com/kf/HTB1dRY0X8OD3KVjSZFFq6An9pXay.jpg", // 默认图标地址
doDisableSug: true, // 是否禁止百度搜索预测
isRightDisplayEnable: true, // 是否开启右侧边栏
isCounterEnable: false, // 是否显示计数器
isALineEnable: false, // 是否禁止下划线
isUserStyleEnable: false, // 是否开启自定义样式
normalizeDuck: true, // 是否按照常用习惯去配置DuckDuckGo
acceptLicense: false,
isEnLang: false,
isGooleInBaiduModeEnable: false, // 是否开启谷歌搜索结果页的百度图标显示
UserBlockList: [],
UserStyleText:
`/**计数器的颜色样式*/
div .AC-CounterT {
background: #FD9999;
}
/**百度样式区域**/
body[baidu] {
position: relative;
/**右侧栏的样式-其实不开启更好看一些*/
#content_right {
padding: 20px 15px 15px !important;
border-radius: 5px;
background-color: #FFFFFF66;
box-sizing: border-box;
box-shadow: 0 0 20px 2px rgba(0, 0, 0, .1);
-webkit-box-shadow: 0 0 20px 2px rgba(0, 0, 0, .1);
-moz-box-shadow: 0 0 20px 2px rgba(0, 0, 0, .1);
}
&:before {
position: fixed;
width: 100%;
height: 100%;
top: 0;
left: 0;
content: '';
background-size: 100% auto;
opacity: 0.6; /*背景图透明度=0.8,最大1*/
}
/**隐藏首页的大图标-修复可能导致外援样式异常**/
#s_lg_img_new {
display: none !important;
}
#wrapper #s_tab {
background-color: rgba(248, 248, 248, 0.4);
}
#content_left>.c-container {
border-radius: 5px;
background-color: rgba(255, 255, 255, 0.6) !important; /*百度搜索块体的颜色;透明度=0.1,最大1*/
h3 {
background-color: rgba(248, 248, 248, 0.6) !important; /*百度搜索块体 - 标题的颜色;透明度=0.1,最大1*/
}
}
}
body[google] {
&:before {
position: fixed;
width: 100%;
height: 100%;
top: 0;
left: 0;
content: '';
background-size: 100% auto;
opacity: 0.4; /*背景图透明度=0.8,最大1*/
}
#rso .g, .sfbg, .f6F9Be, .k8XOCe {
background-color: rgba(248, 248, 248, 0.6) !important;
}
.sfbg {
margin-top: -10px;
}
.yg51vc {
background-color: transparent !important;
}
}`,
oldVersion: "",
lastSaveTime: new Date().getTime(),
};
let CONST = {
hasNewFuncNeedDisplay: true,
sortIndex: 1,
isGoogleImageUrl: false,
isGoogleSpecial: false, // 判断是否存在#rso>.g; true=存在
useItem: {},
fsBaidu: null,
flushNode: new FlushDomFragment(),
BG_List: {
1: 'https://img.90dao.com/images/2023/10/02/651a347eef3f5.jpg',
2: 'https://img.90dao.com/images/2023/12/17/657de42cb631e.webp',
3: 'https://img.90dao.com/images/2023/12/16/657d34e933276.png',
4: 'https://img.90dao.com/images/2023/10/26/653985cf1a46d.png',
}
};
var curSite = {
SiteTypeID: 1, // 当前站点的ID
MainType: "", // 主体节点,很多个的父节点
Stype_Normal: "", // 重定向选择器,只有百度-搜狗-好搜
FaviconType: "", // favicon的域名检查器cite,用于获取host用
FaviconAddTo: "", // favicon选择器,用于插入到title之前的
CounterType: "", // 计数器添加的位置,一般和favicon位置一致
BlockType: "", // 屏蔽按钮的位置,一般在title之后
GMStyleList: {},
};
let DBSite = {
baidu: {
SiteTypeID: 1,
MainType: "#content_left>.c-container",
Stype_Normal: "h3.t>a, .c-container article a",
FaviconType: ".c-showurl, .c-title a",
FaviconAddTo: "h3",
CounterType: "#content_left>#double>div[srcid] *[class~=t]>a:first-child,[class~=op_best_answer_question],#content_left>div[srcid] *[class~=t]>a:first-child,[class~=op_best_answer_question]",
BlockType: "h3 a",
pager: {
nextLink: '//div[@id="page"]//a[contains(text(),"下一页")][@href]',
pageElement: "css;div#content_left > *",
HT_insert: ["css;div#content_left", 2], // 1 = beforebegin; 2 = beforeend
replaceE: "css;#page",
stylish: ".autopagerize_page_info, div.sp-separator {margin-bottom: 10px !important;}.c-img-border{display:none}",
}
},
sogou: {
SiteTypeID: 2,
MainType: "#main .results>div",
Stype_Normal: "h3.pt>a, h3.vrTitle>a",
FaviconType: "cite[id*='cacheresult_info_']",
FaviconAddTo: "h3",
CounterType: ".results>div",
BlockType: "h3 a",
pager: {
nextLink: "//div[@id=\"pagebar_container\"]//a[@id=\"sogou_next\"]",
pageElement: "//div[@class=\"results\"]/div",
HT_insert: ["//div[@class=\"results\"]", 2], // 1 = beforebegin; 2 = beforeend
replaceE: "id(\"pagebar_container\")"
}
},
haosou: {
SiteTypeID: 3,
MainType: ".res-list",
Stype_Normal: "h3>a",
FaviconType: "cite",
FaviconAddTo: "h3",
CounterType: ".results>div",
BlockType: "h3 a",
pager: {
nextLink: "//div[@id='page']//a[text()='下一页>'] | id('snext')",
pageElement: "//div[@id='container']/div",
HT_insert: ["//div[@id='container']", 2], // 1 = beforebegin; 2 = beforeend
replaceE: "id('page')"
}
},
google: {
SiteTypeID: 4,
MainType: "#rso .g, div[data-micp-id='rso'] .g",
FaviconType: ".iUh30",
FaviconAddTo: "h3",
CounterType: "#rso .g h3:not(table h3),._yE>div[class~=_kk] h3",
BlockType: "a:not([href*='translate.google.com'])", // 修复block翻页的问题
pager: {
nextLink: "id('pnnext')|id('navbar navcnt nav')//td[span]/following-sibling::td[1]/a|id('nn')/parent::a",
pageElement: "id('rso')|id('center_col')/style[contains(.,'relative')][id('rso')]",
HT_insert: ["css;#res", 2], // 1 = beforebegin; 2 = beforeend
replaceE: '//div[@id="navcnt"] | //div[@id="rcnt"]//div[@role="navigation"]',
}
},
google_scholar: {
SiteTypeID: 4.1,
MainType: "#rso .g, div[data-micp-id='rso'] .g",
FaviconType: ".iUh30",
FaviconAddTo: "h3",
CounterType: "#rso .g h3:not(table h3),._yE>div[class~=_kk] h3",
BlockType: "a:not([href*='translate.google.com'])", // 修复block翻页的问题
pager: {
nextLink: '//a[./span[@class="gs_ico gs_ico_nav_next"]]',
pageElement: '//div[@class="gs_r gs_or gs_scl"]',
HT_insert: null, // 1 = beforebegin; 2 = beforeend
replaceE: '//div[@id="navcnt"] | //div[@id="rcnt"]//div[@role="navigation"]',
}
},
bing: {
SiteTypeID: 5,
MainType: "#b_results>li",
FaviconType: ".b_attribution>cite",
FaviconAddTo: "h2",
CounterType: "#b_results>li[class~=b_ans] h2,#b_results>li[class~=b_algo] h2",
BlockType: "h2 a",
Stype_Normal: "h2>a",
pager: {
nextLink: "//a[contains(@class,\"sb_pagN\")]",
pageElement: "id(\"b_results\")/li[not(contains(@class,\"b_pag\") or contains(@class,\"b_ans b_top\"))]",
HT_insert: ["id(\"b_results\")/li[@class=\"b_pag\"]", 1], // 1 = beforebegin; 2 = beforeend
replaceE: "id(\"b_results\")//nav[@role=\"navigation\"]",
}
},
duck: {
SiteTypeID: 10,
MainType: "#react-layout li",
FaviconType: ".nrn-react-div .result__url__domain",
FaviconAddTo: "h2",
CounterType: "#react-layout li h2",
BlockType: "h2 a",
pager: {
nextLink: "//a[contains(@class,\"sb_pagN\")]",
pageElement: "id(\"b_results\")/li[not(contains(@class,\"b_pag\") or contains(@class,\"b_ans b_top\"))]",
HT_insert: ["id(\"b_results\")/li[@class=\"b_pag\"]", 1], // 1 = beforebegin; 2 = beforeend
replaceE: "id(\"b_results\")//nav[@role=\"navigation\"]",
}
},
doge: {
SiteTypeID: 11,
MainType: "#links_wrapper #links .results_links_deep",
FaviconType: ".results_links_deep .result__url__domain",
FaviconAddTo: "h2",
CounterType: "#links_wrapper #links .results_links_deep h2",
BlockType: "h2 a",
pager: {
nextLink: "//a[contains(@class,\"sb_pagN\")]",
pageElement: "id(\"b_results\")/li[not(contains(@class,\"b_pag\") or contains(@class,\"b_ans b_top\"))]",
HT_insert: ["id(\"b_results\")/li[@class=\"b_pag\"]", 1], // 1 = beforebegin; 2 = beforeend
replaceE: "id(\"b_results\")//nav[@role=\"navigation\"]",
}
},
mBaidu: {
SiteTypeID: 6,
MainType: "#b_results>li",
FaviconType: ".b_attribution>cite",
FaviconAddTo: "h2",
CounterType: "#b_results>li[class~=b_ans]>h2,#b_results>li[class~=b_algo]>h2,#b_results>li[class~=b_algo]>h2",
BlockType: "h2 a",
},
zhihu: {
SiteTypeID: 7,
},
baidu_xueshu: {
SiteTypeID: 8,
MainType: "#content_left .result",
Stype_Normal: "h3.t>a, #results .c-container>.c-blocka",
FaviconType: ".result-op, .c-showurl", // baidu 似乎要改版了?
FaviconAddTo: "h3",
CounterType: "#content_left>#double>div[srcid] *[class~=t]>a,[class~=op_best_answer_question],#content_left>div[srcid] *[class~=t]>a,[class~=op_best_answer_question]",
BlockType: "h3 a",
},
other: {
SiteTypeID: 9,
}
};
let SiteType = {
BAIDU: DBSite.baidu.SiteTypeID,
MBAIDU: DBSite.mBaidu.SiteTypeID,
SOGOU: DBSite.sogou.SiteTypeID,
SO: DBSite.haosou.SiteTypeID,
GOOGLE: DBSite.google.SiteTypeID,
BING: DBSite.bing.SiteTypeID,
DUCK: DBSite.duck.SiteTypeID,
DOGE: DBSite.doge.SiteTypeID,
ZHIHU: DBSite.zhihu.SiteTypeID,
BAIDU_XUESHU: DBSite.baidu_xueshu.SiteTypeID,
OTHERS: DBSite.other.SiteTypeID
};
let otherData = {
other: {
curTab: 1, // 展示第二panel
showBlockListArea: false, // blockList展示位textarea
addBlockItem: "", // 用户手动输入的拦截规则
curHosts: [], // 存放已经访问的hosts数据内容
faviconListMap: { }, // favicon的遍历表 -> .AC-faviconTStyle
isBlockChecking: false, // 当前Block功能是否还在执行中,避免多次执行,导致页面卡顿
}
}; // 到时候挂载到other上
const AllData = {
ACConfig: {},
other: otherData.other,
CONST: CONST,
lan: {
use: {},
zh_cn: {
menu_text: "自定义",
curLang: "zh_cn",
fieldset_panel: {
panel_title: "AC-重定向设置 " + GM_info.script.version + (inExtMode? 'Ext':''),
setting_panel: {
redirect_text: "主功能-处理重定向",
redirect_title: "重定向功能的开启与否",
useEn_text: "En-Language",
useEn_title: "Using English language to display",
ads_text: "附加1-去广告功能",
ads_title: "去除部分页面的广告信息,还你一个干净整洁的页面",
autopage_text: "自动翻页",
autopage_title: "自动翻页",
blockenable_text: "附加2-自主拦截域名",
blockenable_title: "点击页面block按钮添加你想要隐藏的地址,脚本将自动隐藏部分结果为小横幅,DIY按钮中点击表格内容可以取消隐藏",
blockDiyBtn_text: "DIY",
blockDiyBtn_title: "自定义BLOCK",
blockAutoRemove_text: "隐藏结果",
blockAutoRemove_title: "自动隐藏已经屏蔽的域名",
blockBtnShow_text: "隐藏'block'按钮",
blockBtnShow_title: "隐藏掉block按钮的显示",
userStyle_text: "附加3-自定义样式",
userStyle_baidu_lable: "展开百度设置>>",
userStyle_baidu_origin: "百度-原始模式",
userStyle_baidu_huyan: "百度-护眼模式",
userStyle_baidu_baiduLite: "百度Lite样式",
userStyle_baidu_1line: "单列",
userStyle_baidu_1line_enter: "单列居中",
userStyle_baidu_2line: "双列",
userStyle_baidu_3line: "三列",
userStyle_baidu_4line: "四列",
userStyle_google_lable: "展开谷歌设置>>",
userStyle_google_origin: "谷歌-原始模式",
userStyle_google_huyan: "谷歌-护眼模式",
userStyle_google_googleLite: "谷歌-伪装百度",
userStyle_google_1line: "单列",
userStyle_google_1line_enter: "单列居中",
userStyle_google_2line: "双列",
userStyle_google_3line: "三列",
userStyle_google_4line: "四列",
userStyle_bing_lable: "展开必应设置>>",
userStyle_bing_origin: "必应-原始模式",
userStyle_bing_huyan: "必应-护眼模式",
userStyle_bing_1line: "单列",
userStyle_bing_1line_enter: "单列居中",
userStyle_bing_2line: "双列",
userStyle_bing_3line: "三列",
userStyle_bing_4line: "四列",
userStyle_sogou_lable: "展开搜狗设置>>",
userStyle_sogou_origin: "搜狗-原始模式",
userStyle_sogou_huyan: "搜狗-护眼模式",
userStyle_sogou_1line: "单列",
userStyle_sogou_1line_enter: "单列居中",
userStyle_sogou_2line: "双列",
userStyle_sogou_3line: "三列",
userStyle_sogou_4line: "四列",
userStyle_duck_lable: "展开鸭鸭搜设置>>",
userStyle_duck_origin: "鸭鸭-原始模式",
userStyle_duck_huyan: "鸭鸭-护眼模式",
userStyle_duck_normal: "鸭鸭-常见配置",
userStyle_duck_1line: "单列",
userStyle_duck_1line_enter: "单列居中",
userStyle_duck_2line: "双列",
userStyle_duck_3line: "三列",
userStyle_duck_4line: "四列",
userStyle_doge_lable: "展开多吉设置>>",
userStyle_doge_origin: "多吉-原始模式",
userStyle_doge_huyan: "多吉-护眼模式",
userStyle_doge_normal: "多吉-常见配置",
userStyle_doge_1line: "单列",
userStyle_doge_1line_enter: "单列居中",
userStyle_doge_2line: "双列",
userStyle_doge_3line: "三列",
userStyle_doge_4line: "四列",
backgroundImage_text: "背景图:",
backgroundImage_text_hint: "图片需要允许跨域,建议使用图床",
backgroundImageAutoFit_text: "自动优化",
backgroundImageAutoFit_text_hint: "有背景图时,自动优化页面效果",
huyanMode_text: "附加4-护眼颜色配置-自定义3中需对应开启",
huyanMode_title: "!需要在自定义样式中启用护眼模式",
huyanColor_text: "默认护眼颜色:",
huyanColor_title: "自定义的护眼颜色:",
huyanColorMore_text: "更多颜色选择",
favicon_text: "附加5-Favicon功能",
favicon_title: "AC-添加Favicon",
favicon_defaultIcon_text: "Favicon默认图标:",
searchOrigin_text: "附加6-移除百度搜索预测(文字自动搜索)",
searchOrigin_title: "AC-移除搜索预测",
showRight_text: "附加7-显示右侧栏",
showCounter_text: "附加8-编号功能",
hintShowCounter_text: "可能会导致图片加载异常",
showALine_text: "附加9-文字下划线",
showUserStyle_text: "附加10-自定义样式 支持Less.js",
contactMe_text: "联系作者,提建议,寻求帮助,自定义样式,脚本定制点我",
contactMe_url: "https://github.com/langren1353/GM_script",
setting_panel_second: {
backBtn_text: "<-返回",
blockLabel_text: " 拦截列表 想要生效的话需要手动保存",
blockEditBtn_text: "编辑列表",
blockEditBtnEnd_text: "结束编辑",
addBlockLabel_text: "全匹配拦截:",
addBtnLabel_text: "添加",
},
cancelBtn_text: "取消",
okBtn_text: "保存",
resetBtn_text: "重置",
}
}
},
en: {
menu_text: "CUSTOM",
curLang: "en",
fieldset_panel: {
panel_title: "AC Redirect Settings " + GM_info.script.version + (inExtMode? 'Ext':''),
setting_panel: {
redirect_text: "Main-Deal Redirect",
redirect_title: "Turn on or off redirect",
useEn_text: "En-Language",
useEn_title: "使用英文显示页面",
ads_text: "Add1-Remove Ads",
ads_title: "Remove the ads on the page, and return you a clean page",
autopage_text: "Auto Pager",
autopage_title: "Auto Pager",
blockenable_text: "Add2-Block host",
blockenable_title: "Click the Block button to add the address which you want to hide. The script will hide it with small banner automatically. DIY button for editting the hiding list",
blockDiyBtn_text: "DIY",
blockDiyBtn_title: "Edit BLOCK",
blockAutoRemove_text: "Auto remove",
blockAutoRemove_title: "remove the block results automatically",
blockBtnShow_text: "Hide 'Block' button",
blockBtnShow_title: "Hide 'Block' button",
userStyle_text: "Add3-CustomStyle",
userStyle_baidu_lable: "Expand Baidu Settings>>",
userStyle_baidu_origin: "Baidu-Origin",
userStyle_baidu_huyan: "Baidu-EyeSave",
userStyle_baidu_baiduLite: "BaiduLiteStyle",
userStyle_baidu_1line: "SingleRow",
userStyle_baidu_1line_enter: "SingleCenter",
userStyle_baidu_2line: "Two",
userStyle_baidu_3line: "Three",
userStyle_baidu_4line: "Four",
userStyle_google_lable: "Expand Google Settings>>",
userStyle_google_origin: "Google-Origin",
userStyle_google_huyan: "Google-EyeSave",
userStyle_google_googleLite: "Fake Baidu",
userStyle_google_1line: "SingleRow",
userStyle_google_1line_enter: "SingleCenter",
userStyle_google_2line: "Two",
userStyle_google_3line: "Three",
userStyle_google_4line: "Four",
userStyle_bing_lable: "Expand Bing Settings>>",
userStyle_bing_origin: "Bing-Origin",
userStyle_bing_huyan: "Bing-EyeSave",
userStyle_bing_1line: "SingleRow",
userStyle_bing_1line_enter: "SingleCenter",
userStyle_bing_2line: "Two",
userStyle_bing_3line: "Three",
userStyle_bing_4line: "Four",
userStyle_sogou_lable: "Expand SoGou Settings>>",
userStyle_sogou_origin: "SoGou-Origin",
userStyle_sogou_huyan: "SoGou-EyeSave",
userStyle_sogou_1line: "SingleRow",
userStyle_sogou_1line_enter: "SingleCenter",
userStyle_sogou_2line: "Two",
userStyle_sogou_3line: "Three",
userStyle_sogou_4line: "Four",
userStyle_duck_lable: "Expand DuckDuckGo Settings>>",
userStyle_duck_origin: "DuckDuck-Origin",
userStyle_duck_huyan: "DuckDuck-EyeSave",
userStyle_duck_normal: "DuckDuck-Normal",
userStyle_duck_1line: "SingleRow",
userStyle_duck_1line_enter: "SingleCenter",
userStyle_duck_2line: "Two",
userStyle_duck_3line: "Three",
userStyle_duck_4line: "Four",
userStyle_doge_lable: "Expand DogeDoge Settings>>",
userStyle_doge_origin: "DogeDoge-Origin",
userStyle_doge_huyan: "DogeDoge-EyeSave",
userStyle_doge_normal: "DogeDoge-Normal",
userStyle_doge_1line: "SingleRow",
userStyle_doge_1line_enter: "SingleCenter",
userStyle_doge_2line: "Two",
userStyle_doge_3line: "Three",
userStyle_doge_4line: "Four",
backgroundImage_text: "background Image:",
backgroundImage_text_hint: "only CORS Image is allowed",
backgroundImageAutoFit_text: "Auto Fit:",
backgroundImageAutoFit_text_hint: "page auto fit when Bg is not null",
huyanMode_text: "Add4-EyeSave Color Setting-Need opened in Add3",
huyanMode_title: "!Open EyeSave Mode in CustomStyle is Must",
huyanColor_text: "Default EyeSave Color:",
huyanColor_title: "The color of EyeSave:",
huyanColorMore_text: "More Color",
favicon_text: "Add5-Favicon.Func",
favicon_title: "AC-AddFavicon",
favicon_defaultIcon_text: "FaviconFailedImg::",
searchOrigin_text: "AC-Remove Baidu AutoPredict in text search",
searchOrigin_title: "Add6-Remove Baidu AutoPredict in text search",
showRight_text: "Add7-Right Side Column",
showCounter_text: "Add8-NumFunc",
hintShowCounter_text: "May Cause image load problem",
showALine_text: "Add9-TextUnderLine",
showUserStyle_text: "Add10-Your own Style support Less.js",
contactMe_text: "For contact the writter, suggests, ask for help then click me",
contactMe_url: "https://github.com/langren1353/GM_script/",
setting_panel_second: {
backBtn_text: "<-Back",
blockLabel_text: " Block List Click Save Button if you want wo save the list",
blockEditBtn_text: "Edit List",
blockEditBtnEnd_text: "End Edit",
addBlockLabel_text: "Add Block item:",
addBtnLabel_text: "Add",