forked from asrdri/yt-metabot-user-js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
yt-metabot.user.js
1163 lines (1123 loc) · 59.7 KB
/
yt-metabot.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 MetaBot for YouTube
// @namespace yt-metabot-user-js
// @description More information about users and videos on YouTube.
// @version 210313
// @homepageURL https://vk.com/public159378864
// @supportURL https://github.com/asrdri/yt-metabot-user-js/issues
// @updateURL https://raw.githubusercontent.com/asrdri/yt-metabot-user-js/master/yt-metabot.meta.js
// @downloadURL https://raw.githubusercontent.com/asrdri/yt-metabot-user-js/master/yt-metabot.user.js
// @icon https://raw.githubusercontent.com/asrdri/yt-metabot-user-js/master/logo.png
// @include https://*youtube.com/*
// @include https://*dislikemeter.com/?v*
// @require https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js
// @require https://raw.githubusercontent.com/sizzlemctwizzle/GM_config/master/gm_config.js
// @grant GM_getValue
// @grant GM_setValue
// @grant GM_xmlhttpRequest
// @grant GM.xmlHttpRequest
// @run-at document-end
// ==/UserScript==
GM_config.init( {
'id': 'ytmetabot_config',
'title': 'MetaBot/YT Settings',
'fields': {
'option1': {
'label': 'Processing mode for comments by known bots',
'type': 'int',
'min': 1,
'max': 2,
'default': 1
},
'option2': {
'label': 'Auto-dislike comments by known bots',
'type': 'checkbox',
'default': false
},
'option3': {
'label': 'Hide long like/dislike/share button text',
'type': 'checkbox',
'default': true
},
'option4': {
'label': 'Use additional lists',
'type': 'checkbox',
'default': true
},
'option5': {
'label': 'Send alert to server',
'type': 'checkbox',
'default': false
},
'listp1': {
'label': 'Bookmarks (personal list)',
'type': 'text',
'default': ''
},
'listc1': {
'label': 'Custom list URL 1',
'type': 'text',
'default': 'https://github.com/asrdri/yt-metabot-user-js/raw/master/list-sample.txt'
},
'listc2': {
'label': 'Custom list URL 2',
'type': 'text',
'default': ''
},
'listc3': {
'label': 'Custom list URL 3',
'type': 'text',
'default': ''
},
'listc4': {
'label': 'Custom list URL 4',
'type': 'text',
'default': ''
},
'listc5': {
'label': 'Custom list URL 5',
'type': 'text',
'default': ''
},
'colorp1': {
'label': 'Personal color',
'type': 'int',
'default': '33023'
},
'colorc1': {
'label': 'Custom color 1',
'type': 'int',
'default': '8388863'
},
'colorc2': {
'label': 'Custom color 2',
'type': 'int',
'default': '16744448'
},
'colorc3': {
'label': 'Custom color 3',
'type': 'int',
'default': '8421504'
},
'colorc4': {
'label': 'Custom color 4',
'type': 'int',
'default': '8453888'
},
'colorc5': {
'label': 'Custom color 5',
'type': 'int',
'default': '51328'
}
},
});
const checkb = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABYAAAAPCAMAAADXs89aAAAA+VBMVEUAAAD///+qqqp/f39mZmZubm5vb29sbGxtbW1tbW1tbW1ubm5ubm5tbW1ubm5tbW1ubm5ubm5ubm5tbW1tbW1ubm5ubm5tbW1ubm5ubm5tbW1ubm5ubm5vb29wcHBxcXFzc3N0dHR1dXV3d3d4eHh6enp7e3t8fHyAgICCgoKFhYWMjIyOjo6Pj4+QkJCSkpKUlJSWlpaZmZmampqdnZ2hoaGqqqqwsLC0tLS1tbW2tra5ubm+vr7ExMTKysrLy8vQ0NDR0dHS0tLU1NTV1dXW1tbe3t7i4uLj4+Pk5OTl5eXn5+fo6Ojq6urs7Ozu7u7w8PD9/f3////SCMufAAAAHHRSTlMAAAMEBSUnKCpbXV9htre6u87Q0dPp6uvs7u/8pkhKVQAAAMdJREFUeNpN0NdWwlAUANEbgvTeQhnQIE1B1ChYQcEC0gL+/8ewzPWwmMf9OMowDKWUP5YqU0pGTaXTHMqdOcM7G7LBIw4Vnc3b89i9BytwYH+uv7oAOqsbyJjCMb4d/urOgYhwqr55wmvdhIRwufXT0zzrgCVM1X2tA5xva1ARLvE4aQCMXoCCcJLaZNpvX71/3QJx4ShUBx+Lz4fp7hrCwmYWL3v5u7XTPmEVtLRfuk7+5OhJIKP9NO2psDIjCatSiId9/7oHY28awgWqV+8AAAAASUVORK5CYII=';
const minf = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA8AAAAPCAMAAAAMCGV4AA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8ggwqtjx6/e3KrYf+CgmbpBI+1ZukyWVxQrDh0+4qIeiPv47tr1G9tkOd+tuPN3Xx/qC27N2nXrN2zcpBVu85Z+1H8AENmxc9cnCf9FOZo0mGgIpIrKKgkQhds7lGjY8G/ff/jB3ePlvlYejCCikSdPnYbizNlz5y9cVL9dGsXL6DFQ+R8/efrsuTv0cuy48RMmEmecNBm13rxNTkmdQnWmToNGyszKzplOgkk3Qw9IvpmzZheF5sylBMZ5882uBbRw0eIlpKgB/8u5fuwF0eAAAAAASUVORK5CYII=';
const imgdma = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAAZCAMAAADzN3VRAAABsFBMVEUAAAD+wQD+wgD/qgD+wQD/vwD+wQD+wgD+wgD+wQD+xwBatlz/vwD+wQBft1n+wQDxtwD1ugD9wADyuAD0uQD/zAD7vwD5vQDxtwDzuADyuQDztwDyuADytwDytwDytwDwuAD+wgD0tgCstyvzuAD1uwD+wgD+wgD+wgD+wAD+wQD+wQD+wgD+wQD+wgD//wD+wQD+wgD+wgD+wAD+wQD+wQD+xACtvC1Ztl3/wgD///97uEnyuAD+wQCBu1CWujp7xX32uwCOeiGrjBiykRabx2qc1J5nvWryugRat108RTn7vwH7vwD+wgD9wADxwAb4vQB/cCaSfCAoOD95tkmGt0CihhteWy+ReyDBmhIwPT1HTDb8wAB6t0n6vgD7wAT2zUn03ZP06cR4wXQ2QTv9wQD2zEf068/18OP03pj20mF5ulhyaCnutwX11nf18uv11nb6wQzbqwr10V318ef2yTvksQjCmxI/Rzj6wAn179310FimiRr8wAH3yDX9wQKV0ZdZWDFARzj0uQD5vQDnswdCSTi4lBVESjeKukCvjxe3lBV1aij0ugD4vQLEnBHgcTooAAAAOXRSTlMA6kwD+gTgbfiyF+gYmd5jh8b5/EkF/vL72FSAoLOM8CT3MVjANee+fin+ty75dgKWgvtB0akaVEpkodaYAAABOUlEQVR4XnXPVXMiURCG4SYES4C4u7uvfSO4S9zd3d3d1/5yOAWEGYq8N33xVFdXUyS9RqfOzM3LSK8kWSkGLcIF/lbXSCBJgVi9+UXKKKQlQ9q0UKyKbMgBeBRKwzcUiM+alc3EAJzsA8HLfwDsHsBj7xYKcoj0WuBPH3A88ATg2QE4XmEVCok0AMbGh//fjQDA6P3L79N+BIQSIh0AvE8sbm4x8dt8PpsfolCmIjUS9SCUU0UMesx8KKfTxPODQ1UkecbsZXGchQ0j1UZBnJySipfqwjAzOze/IJd6BkvLK6tr6xtyaWgEurd3dvdE8HKhJogHh0ciACcnyUXU3HJ2fhFEAqHWq+sbsEwWFsfdsuEOSVs7wsXfIVJ2dCYUVte3r4RUSd8VeJNKKn2m/PHTyMTlcjP49QE0u4VtSVu7kQAAAABJRU5ErkJggg==';
const imgdmd = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACMAAAAZCAMAAACM5megAAAAllBMVEUAAAB/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f3+AgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAx6H3iAAAAMXRSTlMABAgMFBgcICQoLDA8QERITFBUWGBkaGx4fICDj5OXo6evs7e7v8PH09ff4+fr8/f7vr5GKgAAAN1JREFUGBl9wY1agjAABdAbIoSCWiIJLn8yLKNN7vu/XBvQJ87JOegZLfJDaew3U7ilklcfAW5EiTb7JGtRGFtq8hV9BTsntH5orNH3VrNx9mB4kkYdo29xoUPlAwgCtIKaLgJAqkI0BJ0qABEFGme6xQBUCXhhOOUDuycI7jCRHCAlmSDnsEsGrDjgmL6MAYxOfGyGTiwquikPV0s6bdF3oIMao+9Z8d4Gt5KadxJYMt7xYclok7AJar+KRvVFrYTtSC1Ca07tHbZvkhU6KbUlbPOiyCfo+OuiWOHfHxHEYF/PvYVrAAAAAElFTkSuQmCC';
const imgyto = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAC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G85cKWPw5EIIL1fNc7Y5fM3+4OlA8KCIdUfxtjde18fDOktFVA2SEih5OL0s+eDOmWwdxJnmc+pk7Pv3ndq2JE7Rsih/7Tn85cxKhfNk8R3qQmcdhy6SpZmlL8injDV1p6OR9eUpRyun4Qc0tNduwOLC+GviUuMmrl9R1nCEfOCoOGO+w/JEoOEUWJKyW7cOjpKJSBqmNjP/Ha+eTysFYX5A4Q/7P74aUBvIVo8hBx2fzvoCdYCoYSEhxk7stnDUSIAqV2qbdtfdnGlAmiq8Cr2ePkqmiBZctzUGshKC56aKCiFT+wFE7H4r+hESEUIEOuuh1AnQpHs3GfImQxCrJowUCVCq2HVW47VDQiSnVP7S6c2Jxs8lflp/4i0/EoYERrj3WvXrd+wcZM7vlEANQfRAClqAtKfNQAAAABJRU5ErkJggg==';
const regexalt = /\{(.*?)\}/;
const regexdate = /joinedDateText(.*?)ext":"(.*?)ext":"(.*?)"}/;
const regexlang = /"hostLanguage":"(.*?)"/;
const regexannyto = /(.*)(\r\n|\n\r|\n)([\W\w]+)/;
const ERKYurl = 'https://raw.githubusercontent.com/FeignedAccomplice/YOUTUBOTS/master/KB.CSV';
const annYTOurl = 'https://raw.githubusercontent.com/FeignedAccomplice/YOUTUBOTS/master/announcements.TXT';
const minDCTime = 36*61;
const maxDCTime = 71*58;
const reporturl = 'tg://resolve?domain=observers_chat';
var annYTOtxt = [];
var arrayERKY = [];
var arrayListP1 = [];
var arrayListC1 = [];
var arrayListC2 = [];
var arrayListC3 = [];
var orderedClicksArray = [];
var bDTaskSet = 0;
var bDBlur = 0;
var ytmode = 0;
var listqueue = 0;
var descc1 = '';
var descc2 = '';
var descc3 = '';
var descc4 = '';
var descc5 = '';
var iconsdef = ["\uD83D\uDCCC", "\uD83D\uDD32", "\uD83D\uDD34", "\uD83D\uDD3B", "\uD83D\uDD3A", "\uD83D\uDD37"];
const iconstyledef = 'font-family: Segoe UI Symbol; line-height: 1em;';
const iconp1 = '<span style="' + iconstyledef + '">' + iconsdef[0] + '</span> ';
const iconc1 = '<span style="' + iconstyledef + '">' + iconsdef[1] + '</span> ';
const iconc2 = '<span style="' + iconstyledef + '">' + iconsdef[2] + '</span> ';
const iconc3 = '<span style="' + iconstyledef + '">' + iconsdef[3] + '</span> ';
const iconc4 = '<span style="' + iconstyledef + '">' + iconsdef[4] + '</span> ';
const iconc5 = '<span style="' + iconstyledef + '">' + iconsdef[5] + '</span> ';
var txtlistpadd = '\u2003<span id="listpadd" style="cursor: pointer; ' + iconstyledef + '" title="Добавить в закладки">' + iconsdef[0] + '</span>';
console.log("[MetaBot for Youtube] Starting at URL: " + window.location);
if (window.location.hostname == "dislikemeter.com" || window.location.hostname == "www.dislikemeter.com") {
var videoid = getURLParameter('v', location.search);
if (videoid) {
waitForKeyElements('input#form_vid', function dmIDins(jNode) {
var pNode = $(jNode)[0];
pNode.value = videoid;
});
return;
}
} else if (window.location.pathname == '/live_chat_replay' || window.location.pathname == '/live_chat') {
console.log("[MetaBot for Youtube] Live Chat page detected. Skipping.");
} else {
waitforinit();
}
function waitforinit() {
if (document.head === null) {
setTimeout(waitforinit, 100);
} else {
init();
}
}
function init() {
if (document.head.innerHTML.indexOf('window.ShadyDOM') >= 0) {
console.log("[MetaBot for Youtube] YouTube New design detected.");
ytmode = 1;
} else if (document.head.innerHTML.indexOf('name="viewport"') >= 0) {
console.log("[MetaBot for Youtube] YouTube Mobile mode detected.");
ytmode = 3;
} else if (document.head.innerHTML.indexOf('ytcfg.set("LACT"') >= 0) {
console.log("[MetaBot for Youtube] YouTube Classic design detected.");
ytmode = 2;
txtlistpadd = '\u2003<span id="listpadd" style="cursor: pointer; color: #767676;' + iconstyledef + '" title="Добавить в закладки">' + iconsdef[0] + '</span>';
} else {
console.log("[MetaBot for Youtube] Unable to detect YouTube design. Stopping.");
}
if (ytmode !== 3) {
listqueue++;
getlist(filllist, -1, annYTOurl);
}
listqueue++;
getlist(filllist, 0, ERKYurl);
if (GM_config.get('option4') === true) {
arrayListP1 = GM_config.get('listp1').match(/[^\r\n=]+/g);
if (GM_config.get('listc1') !== '') {
listqueue++;
getlist(filllist, 1, GM_config.get('listc1'));
}
if (GM_config.get('listc2') !== '') {
listqueue++;
getlist(filllist, 2, GM_config.get('listc2'));
}
if (GM_config.get('listc3') !== '') {
listqueue++;
getlist(filllist, 3, GM_config.get('listc3'));
}
if (GM_config.get('listc4') !== '') {
listqueue++;
getlist(filllist, 4, GM_config.get('listc4'));
}
if (GM_config.get('listc5') !== '') {
listqueue++;
getlist(filllist, 5, GM_config.get('listc5'));
}
}
waitforlists();
}
function filllist(numArr, response, code, url) {
if (code !== 200) {
console.log("[MetaBot for Youtube] List load error. URL " + url + " Code " + code);
} else {
switch (numArr) {
case -1:
annYTOtxt = regexannyto.exec(response);
var dbname = "YTO announcement";
switch (ytmode) {
case 1:
waitForKeyElements('ytd-comments-header-renderer.ytd-item-section-renderer', insertannNew);
break;
case 2:
}
break;
case 0:
arrayERKY = response.match(/[^\r\n=]+/g);
var dbname = "ERKY-db";
break;
case 1:
arrayListC1 = response.match(/[^\r\n=]+/g);
var dbname = "Custom list #1";
descc1 = '[' + (arrayListC1.length / 2 - 1) + '] ' + Aparse(arrayListC1[0]) + ': ' + Aparse(arrayListC1[1]) + '<br>\u2003';
break;
case 2:
arrayListC2 = response.match(/[^\r\n=]+/g);
var dbname = "Custom list #2";
descc2 = '[' + (arrayListC2.length / 2 - 1) + '] ' + Aparse(arrayListC2[0]) + ': ' + Aparse(arrayListC2[1]) + '<br>\u2003';
break;
case 3:
arrayListC3 = response.match(/[^\r\n=]+/g);
var dbname = "Custom list #3";
descc3 = '[' + (arrayListC3.length / 2 - 1) + '] ' + Aparse(arrayListC3[0]) + ': ' + Aparse(arrayListC3[1]) + '<br>\u2003';
break;
case 4:
arrayListC4 = response.match(/[^\r\n=]+/g);
var dbname = "Custom list #4";
descc4 = '[' + (arrayListC4.length / 2 - 1) + '] ' + Aparse(arrayListC4[0]) + ': ' + Aparse(arrayListC4[1]) + '<br>\u2003';
break;
case 5:
arrayListC5 = response.match(/[^\r\n=]+/g);
var dbname = "Custom list #5";
descc5 = '[' + (arrayListC5.length / 2 - 1) + '] ' + Aparse(arrayListC5[0]) + ': ' + Aparse(arrayListC5[1]) + '<br>\u2003';
}
if (code === 200) {
console.log("[MetaBot for Youtube] " + dbname + " loaded. Code " + code);
} else {
console.log("[MetaBot for Youtube] " + dbname + " load error. Code " + code);
}
}
listqueue--;
}
function waitforlists() {
if (listqueue === 0) {
switch (ytmode) {
case 1:
spinnercheckNew();
waitForKeyElements('div#main.style-scope.ytd-comment-renderer', parseitemNew);
waitForKeyElements('ytd-menu-renderer.style-scope.ytd-video-primary-info-renderer', preparedmNew);
waitForKeyElements('div#channel-header.ytd-c4-tabbed-header-renderer', insertchanNew);
break;
case 2:
console.log("[MetaBot for Youtube] YouTube Classic design not supported.");
break;
case 3:
console.log("[MetaBot for Youtube] YouTube Mobile mode not supported.");
}
return;
} else {
setTimeout(waitforlists, 500);
}
}
function spinnercheckNew() {
waitForKeyElements('paper-spinner-lite.ytd-item-section-renderer[aria-hidden="true"]', function(jNode) {
if (getURLParameter('v', location.search) === null) {
return;
}
console.log("[MetaBot for Youtube] Comment sorting spinner found.");
var mutationObserver = new MutationObserver(function(mutations) {
mutations.forEach(function(mutation) {
if ($(jNode).find("#spinnerContainer").hasClass("cooldown")) {
setTimeout(recheckallNew, 2000);
} else {
$('div#main.style-scope.ytd-comment-renderer').each(function() {
var cNode = $(this).find(".published-time-text")[0];
deleteitemNew(this, $(cNode).find("a")[0].href);
});
}
});
});
mutationObserver.observe($(jNode)[0], {
attributes: true,
attributeFilter: ['active'],
characterData: false,
childList: false,
subtree: true,
attributeOldValue: false,
characterDataOldValue: false
});
}, false);
waitForKeyElements('div#continuations.ytd-item-section-renderer', function(jNode) {
if (getURLParameter('v', location.search) === null) {
return;
}
console.log("[MetaBot for Youtube] Comment loading spinner found.");
var mutationObserver = new MutationObserver(function(mutations) {
mutations.forEach(function(mutation) {
if (!$(jNode).find("#spinnerContainer").hasClass("cooldown")) {
setTimeout(recheckallNew, 2000);
}
});
});
mutationObserver.observe($(jNode)[0], {
attributes: true,
attributeFilter: ['active'],
characterData: false,
childList: false,
subtree: true,
attributeOldValue: false,
characterDataOldValue: false
});
}, false);
waitForKeyElements('paper-spinner#spinner.yt-next-continuation[active]', function(jNode) {
if (getURLParameter('v', location.search) === null) {
return;
}
console.log("[MetaBot for Youtube] Comment replies loading spinner found.");
var mutationObserver = new MutationObserver(function(mutations) {
if (mutations[0].removedNodes) {
mutationObserver.disconnect();
setTimeout(recheckallNew, 2000);
}
});
mutationObserver.observe($(jNode)[0].parentNode, {
attributes: true,
characterData: false,
childList: false,
subtree: false,
attributeOldValue: false,
characterDataOldValue: false
});
}, false);
}
function recheckallNew(){
$('div#main.style-scope.ytd-comment-renderer').each(function() {
recheckNew(this);
});
}
function insertchanNew(jNode) {
this.addEventListener('yt-navigate-finish', function insertchanNewR() {
this.removeEventListener('yt-navigate-finish', insertchanNewR);
setTimeout(insertchanNew, 300, jNode);
});
var chanURL = window.location.protocol + '//' + window.location.hostname + window.location.pathname.replace(/\/featured|\/videos|\/playlists|\/channels|\/discussion|\/about/i, '');
if (chanURL.slice(-1) == '/') {
chanURL = chanURL.slice(0, -1);
}
var reuse = false;
var userID = chanURL.split('/').pop();
if ($(jNode).find('span#subscriber-count.ytd-channel-name')[0]) {
var noticespan = $(jNode).find('span#subscriber-count.ytd-channel-name')[0];
reuse = true;
} else {
var noticespan = document.createElement('span');
noticespan.id = 'subscriber-count';
noticespan.classList.add("ytd-channel-name");
}
var foundID = arrayERKY.indexOf(userID);
var stylecommon = 'border-radius: 5px; padding: 4px 7px 4px 7px; font-weight: 400; line-height: 3rem; text-transform: none; color: var(--yt-lightsource-primary-title-color); margin-left: 7px';
var top30 = '<a href="https://www.t30p.ru/search.aspx?s=' + userID + '" target="_blank" style="color: hsl(206.1, 79.3%, 52.7%); text-decoration:none; font-family: Segoe UI Symbol; color: var(--yt-spec-icon-inactive)">\uD83D\uDD0D<tp-yt-paper-tooltip>Найти комментарии автора с помощью агрегатора ТОП30</tp-yt-paper-tooltip></a> ';
if (foundID > -1) {
noticespan.innerHTML = top30 + '<a href="' + chanURL + '/about" style="text-decoration: none; font-family: Segoe UI Symbol; color: #cc0000">\uD83D\uDD34<tp-yt-paper-tooltip>Пользователь найден в ЕРКЮ</tp-yt-paper-tooltip></a> ' + arrayERKY[foundID + 1];
noticespan.style = 'background: rgba(255,50,50,0.3); ' + stylecommon;
} else {
noticespan.innerHTML = top30 + '<a href="' + chanURL + '/about" style="text-decoration: none; font-family: Segoe UI Symbol; color: var(--yt-spec-icon-inactive)">\u2139<tp-yt-paper-tooltip>Пользователь не найден в ЕРКЮ</tp-yt-paper-tooltip></a>';
noticespan.style = 'background: rgba(100,100,100,0.2); ' + stylecommon;
}
if (!reuse) {
$(jNode).find('ytd-channel-name#channel-name.ytd-c4-tabbed-header-renderer').append(noticespan);
}
}
function preparedmNew(jNode) {
this.addEventListener('yt-navigate-finish', function preparedmNewR() {
this.removeEventListener('yt-navigate-finish', preparedmNewR);
setTimeout(preparedmNew, 300, jNode);
});
var videoid = getURLParameter('v', location.search);
if (!videoid) {
console.log("[MetaBot for Youtube] Dislikemeter: video id not found.");
return;
}
var pNode = $(jNode).parent().parent().parent().find('div#flex')[0];
if (typeof pNode === 'undefined') {
console.log("[MetaBot for Youtube] Dislikemeter: node not found.");
return;
}
pNode.innerHTML = '';
if (GM_config.get('option3')) {
var btnText = $(pNode).parent().find('ytd-button-renderer.ytd-menu-renderer')[0];
if ($(btnText).find('yt-formatted-string#text').length > 0) {
$(btnText).find('yt-formatted-string#text').html('');
}
if (!$(pNode).parent().find('ytd-sentiment-bar-renderer#sentiment').is(":visible")) {
btnText = $(pNode).parent().find('ytd-toggle-button-renderer.ytd-menu-renderer.force-icon-button')[0];
$(btnText).find('yt-formatted-string#text').html('');
btnText = $(pNode).parent().find('ytd-toggle-button-renderer.ytd-menu-renderer.force-icon-button')[1];
$(btnText).find('yt-formatted-string#text').html('');
}
}
console.log("[MetaBot for Youtube] Dislikemeter: requesting data for video id " + videoid);
getlist(insertdmNew, pNode, 'https://dislikemeter.com/iframe/?vid=' + videoid);
}
function insertdmNew(jNode, response, code, url) {
if (response.indexOf('"submit"') >= 0){
console.log("[MetaBot for Youtube] Dislikemeter: video already added.");
var dmurl = url.replace('iframe/?vid=', 'video/');
var dmtxt = 'Открыть статистику видео на анализаторе Дизлайкметр';
var dmclr = 'var(--yt-spec-call-to-action)';
} else {
console.log("[MetaBot for Youtube] Dislikemeter: video not added yet.");
var dmurl = url.replace('iframe/?vid=', '?v=');
var dmtxt = 'Добавить видео на анализатор Дизлайкметр';
var dmclr = 'var(--yt-spec-icon-inactive)';
}
jNode.style.textAlign = "right";
var dmbutton = document.createElement('ytd-button-renderer');
dmbutton.id = 'dmbutton';
dmbutton.setAttribute('button-renderer', '');
dmbutton.setAttribute('is-icon-button', '');
dmbutton.classList.add("style-scope");
dmbutton.classList.add("ytd-menu-renderer");
dmbutton.classList.add("force-icon-button");
dmbutton.classList.add("style-default");
dmbutton.classList.add("size-default");
dmbutton.style.marginTop = "3px";
dmbutton.style.marginRight = "4px";
$(jNode).prepend(dmbutton);
$(jNode).find('ytd-button-renderer#dmbutton').html('<a class="yt-simple-endpoint style-scope ytd-button-renderer"><yt-icon-button id="button" class="style-scope ytd-button-renderer style-default size-default" style="padding:8px;width:36px;height:36px;color:rgb(255,200,0)" onclick="window.open(\'' + dmurl + '\', \'_blank\');"><svg viewBox="0 0 20 20" preserveAspectRatio="xMidYMid meet" focusable="false" class="style-scope yt-icon" style="pointer-events: none; display: block; width: 100%; height: 100%; fill:' + dmclr + '"><g class="style-scope yt-icon"><path d="m0 2c0 5.5 8 5.5 8 0 0-1-2-1-2 0 0 3-4 3-4 0 0-1-2-1-2 0m12 0c0 5.5 8 5.5 8 0 0-1-2-1-2 0 0 3-4 3-4 0 0-1-2-1-2 0m-12 16q2-6.5 10-6.5v2q-6 0-8 4.5c0 0.5-2 0.7-2 0m6 2v-3l4-1v4m1 0v-8h4v8m1 0v-11l4-1v12" class="style-scope yt-icon"></path></g></svg></yt-icon-button><tp-yt-paper-tooltip>' + dmtxt + '</tp-yt-paper-tooltip></a>');
}
function insertannNew(jNode) {
waitForKeyElements('div#icon-label.yt-dropdown-menu', function(jNode) {
$(jNode)[0].innerHTML = '';
$(jNode).parent()[0].setAttribute("style","margin-top:-0.1em;height:1.9em;width:2.9em");
$(jNode).parent().hover(function() {
this.style.backgroundColor = 'hsl(206.1, 79.3%, 52.7%)';
}, function() {
this.style.backgroundColor = '';
});
}, false);
var cfgspan = document.createElement('span');
cfgspan.innerHTML = '<span style="opacity:0.4">[</span><span style="font-family: Segoe UI Symbol; color: #848484">\uD83D\uDD27</span><span style="opacity:0.4">]</span>';
cfgspan.id = 'cfgbtn';
cfgspan.title = 'Настройки MetaBot for YouTube';
cfgspan.style = 'margin:-6px 0 0 0.5em;font-size:3em;height:1.05em;display:inline-flex;align-items:center;cursor:pointer';
cfgspan.classList.add("content");
cfgspan.classList.add("ytd-video-secondary-info-renderer");
$(jNode).find('div#title').append(cfgspan);
var annspan = document.createElement('span');
annspan.innerHTML = '<span style="opacity:0.4">[</span><span style="font-family: Segoe UI Symbol; color: #af1611">\uD83D\uDCE3</span><span style="font-size:0.5em;font-weight:420;margin:0 0.2em 0 0.2em">' + Aparse(annYTOtxt[1]) + '</span><span style="opacity:0.4">]</span>';
annspan.id = 'annbtn';
annspan.title = 'Последняя информация от Наблюдателя YouTube (#ЕРКЮ)';
annspan.style = 'margin:-6px 0 0 0.5em;font-size:3em;height:1.05em;display:inline-flex;align-items:center;cursor:pointer';
annspan.classList.add("content");
annspan.classList.add("ytd-video-secondary-info-renderer");
$(jNode).find('div#title').append(annspan);
var ytoinfosspan = document.createElement('span');
ytoinfosspan.innerHTML = '<span style="float:left;width:40px"><img src="' + imgyto + '" width="40px" height="40px" /></span><span style="float:right;margin: 0 0 0 10px;width:585px"><span id="urlyto" style="font-weight:500;cursor:pointer" data-url="https://www.youtube.com/channel/UCwBID52XA-aajCKYuwsQxWA">Наблюдатель Youtube #ЕРКЮ</span><span class="badge badge-style-type-simple ytd-badge-supported-renderer" style="margin:4px 0 4px 0;text-align:center">' + Aparse(annYTOtxt[1]) + '</span><span id="annholder"></span></span>';
ytoinfosspan.id = 'ytoinfo';
ytoinfosspan.classList.add("description");
ytoinfosspan.classList.add("content");
ytoinfosspan.classList.add("ytd-video-secondary-info-renderer");
ytoinfosspan.style = 'font-size:1.4rem;max-width:640px;margin:-10px auto 1em auto;display:none';
$(jNode).find('div#title').after(ytoinfosspan);
var settingsspan = document.createElement('span');
settingsspan.innerHTML = '<span style="float:left;width:100px"><img src="https://raw.githubusercontent.com/asrdri/yt-metabot-user-js/master/logo.png" width="100px" height="100px" /></span><span style="float:right;margin: 0 0 0 10px;width:525px"><span style="font-weight:500">' + GM_info.script.name + ' v' + GM_info.script.version + '</span>\u2003<span id="urlgithub" style="cursor:pointer" data-url="https://github.com/asrdri/yt-metabot-user-js/">GitHub</span>\u2003<span id="urlissues" style="cursor:pointer" data-url="https://github.com/asrdri/yt-metabot-user-js/issues">Предложения и баги</span>\u2003<span id="urllists" style="cursor:pointer" data-url="https://github.com/asrdri/yt-metabot-user-js/issues/23">Списки</span><span class="badge badge-style-type-simple ytd-badge-supported-renderer" style="margin:4px 0 4px 0;text-align:center">Настройки</span>Комментарии от известных ботов из ЕРКЮ <select id="mbcddm1"><option value="1">помечать</option><option value="2">скрывать</option></select><span id="mbcswg1"><br style="line-height:2em"><label title="Пункт 5.1.H Условий использования YouTube не нарушается - запросы отправляются со значительным интервалом"><input type="checkbox" id="mbcbox1">Автоматически ставить <span style="font-family: Segoe UI Symbol">\uD83D\uDC4E</span> комментариям от ботов из ЕРКЮ</label></span><br style="line-height:2em"><label title="Актуально для русского интерфейса и небольшой ширины окна браузера"><input type="checkbox" id="mbcbox2">Скрывать длинные подписи кнопок Мне (не) понравилось / Поделиться</label><br style="line-height:2em"><label><input type="checkbox" id="mbcbox3">Дополнительные списки</label><span id="mbcswg2"><br style="line-height:2em">' + iconp1 + ' Закладки: <input type="color" id="colorpersonal" style="height: 1.8rem; width: 40px"><br style="line-height:1.8em"><textarea id="listpersonal" rows="3" style="width: 500px"></textarea><br style="line-height:1.2em">Сторонние списки:<br>' + iconc1 + descc1 + '<input type="text" id="listcustom1" style="height: 1.7rem; width: 440px"> <input type="color" id="colorcustom1" style="height: 1.8rem; width: 40px"><br>' + iconc2 + descc2 + '<input type="text" id="listcustom2" style="height: 1.7rem; width: 440px"> <input type="color" id="colorcustom2" style="height: 1.8rem; width: 40px"><br>' + iconc3 + descc3 + '<input type="text" id="listcustom3" style="height: 1.7rem; width: 440px"> <input type="color" id="colorcustom3" style="height: 1.8rem; width: 40px"><br>' + iconc4 + descc4 + '<input type="text" id="listcustom4" style="height: 1.7rem; width: 440px"> <input type="color" id="colorcustom4" style="height: 1.8rem; width: 40px"><br>' + iconc5 + descc5 + '<input type="text" id="listcustom5" style="height: 1.7rem; width: 440px"> <input type="color" id="colorcustom5" style="height: 1.8rem; width: 40px"></span><br style="line-height:2em">Классический дизайн YouTube:' + Aparse("\u2003[Chrome](https://chrome.google.com/webstore/detail/youtube-redux/mdgdgieddpndgjlmeblhjgljejejkikf)\u2003[Firefox](https://addons.mozilla.org/firefox/addon/youtube-redux/)") + '<br><span id="resetbtn" style="cursor:pointer">Сбросить настройки</span><span id="configsaved" class="badge badge-style-type-simple ytd-badge-supported-renderer" style="margin:4px 0 4px 0;text-align:center;display:none;-webkit-transition: background-color 0.3s ease-in-out;-moz-transition: background-color 0.3s ease-in-out;-ms-transition: background-color 0.3s ease-in-out;-o-transition: background-color 0.3s ease-in-out;transition: background-color 0.3s ease-in-out;">Настройки сохранены. Для вступления в силу необходимо <span style="cursor:pointer;text-decoration:underline" onclick="javascript:window.location.reload();"><span style="font-family: Segoe UI Symbol">\uD83D\uDD03</span>обновить страницу</span>.</span></span>';
settingsspan.id = 'config';
settingsspan.classList.add("description");
settingsspan.classList.add("content");
settingsspan.classList.add("ytd-video-secondary-info-renderer");
settingsspan.style = 'font-size:1.4rem;max-width:635px;margin:-10px auto 1em auto;display:none';
$(jNode).find('div#title').after(settingsspan);
var annexspan = document.createElement('span');
annexspan.innerHTML = Aparse(annYTOtxt[3]);
annexspan.classList.add("content");
annexspan.classList.add("ytd-video-secondary-info-renderer");
$(jNode).find('span#annholder').append(annexspan);
$(jNode).find("span#cfgbtn")[0].addEventListener("click", function() {
$(jNode).find("span#config").toggle();
$(jNode).find("span#ytoinfo").hide();
}, false);
$(jNode).find("span#annbtn")[0].addEventListener("click", function() {
$(jNode).find("span#ytoinfo").toggle();
$(jNode).find("span#config").hide();
}, false);
$(jNode).find("span#cfgbtn").hover(function() {
this.style.backgroundColor = 'hsl(206.1, 79.3%, 52.7%)';
}, function() {
this.style.backgroundColor = '';
});
$(jNode).find("span#annbtn").hover(function() {
this.style.backgroundColor = 'hsl(206.1, 79.3%, 52.7%)';
}, function() {
this.style.backgroundColor = '';
});
$(jNode).find("span#resetbtn").hover(function() {
this.style.textDecoration = "underline";
}, function() {
this.style.textDecoration = "";
});
$(jNode).find("span#urlgithub, span#urlissues, span#urllists, span#urlyto").hover(function() {
this.style.textDecoration = "underline";
this.style.color = "hsl(206.1, 79.3%, 52.7%)";
}, function() {
this.style.textDecoration = "";
this.style.color = "";
});
$(jNode).find("span#urlgithub, span#urlissues, span#urllists, span#urlyto").click(function() {
window.open($(this).attr('data-url'));
});
$(jNode).find("span#resetbtn").click(function() {
resetconfigNew(jNode);
saveconfigNew(jNode);
});
$(jNode).find("select#mbcddm1").val(GM_config.get('option1'));
$(jNode).find("input#mbcbox1").prop('checked', GM_config.get('option2'));
$(jNode).find("input#mbcbox2").prop('checked', GM_config.get('option3'));
$(jNode).find("input#mbcbox3").prop('checked', GM_config.get('option4'));
$(jNode).find("textarea#listpersonal").text(GM_config.get('listp1'));
$(jNode).find("input#listcustom1").val(GM_config.get('listc1'));
$(jNode).find("input#listcustom2").val(GM_config.get('listc2'));
$(jNode).find("input#listcustom3").val(GM_config.get('listc3'));
$(jNode).find("input#listcustom4").val(GM_config.get('listc4'));
$(jNode).find("input#listcustom5").val(GM_config.get('listc5'));
$(jNode).find("input#colorpersonal").val(parseColor(GM_config.get('colorp1'), false));
$(jNode).find("input#colorcustom1").val(parseColor(GM_config.get('colorc1'), false));
$(jNode).find("input#colorcustom2").val(parseColor(GM_config.get('colorc2'), false));
$(jNode).find("input#colorcustom3").val(parseColor(GM_config.get('colorc3'), false));
$(jNode).find("input#colorcustom4").val(parseColor(GM_config.get('colorc4'), false));
$(jNode).find("input#colorcustom5").val(parseColor(GM_config.get('colorc5'), false));
if ($(jNode).find("select#mbcddm1").val() == 2) {
$(jNode).find("span#mbcswg1").hide();
}
if ($(jNode).find("input#mbcbox3").prop('checked') == false) {
$(jNode).find("span#mbcswg2").hide();
}
$(jNode).find("input#mbcbox1, input#mbcbox2, input#mbcbox3, select#mbcddm1, textarea#listpersonal, input#listcustom1, input#listcustom2, input#listcustom3, input#listcustom4, input#listcustom5, input#colorpersonal, input#colorcustom1, input#colorcustom2, input#colorcustom3, input#colorcustom4, input#colorcustom5").change(function() {
if ($(jNode).find("select#mbcddm1").val() == 2) {
$(jNode).find("span#mbcswg1").hide();
} else {
$(jNode).find("span#mbcswg1").show();
}
if ($(jNode).find("input#mbcbox3").prop('checked') == false) {
$(jNode).find("span#mbcswg2").hide();
} else {
$(jNode).find("span#mbcswg2").show();
}
saveconfigNew(jNode);
});
}
function saveconfigNew(jNode) {
GM_config.set('option1', $(jNode).find("select#mbcddm1").val());
GM_config.set('option2', $(jNode).find("input#mbcbox1").is(":checked"));
GM_config.set('option3', $(jNode).find("input#mbcbox2").is(":checked"));
GM_config.set('option4', $(jNode).find("input#mbcbox3").is(":checked"));
GM_config.set('listp1', $(jNode).find("textarea#listpersonal").val());
GM_config.set('listc1', $(jNode).find("input#listcustom1").val());
GM_config.set('listc2', $(jNode).find("input#listcustom2").val());
GM_config.set('listc3', $(jNode).find("input#listcustom3").val());
GM_config.set('listc4', $(jNode).find("input#listcustom4").val());
GM_config.set('listc5', $(jNode).find("input#listcustom5").val());
GM_config.set('colorp1', parseColor($(jNode).find("input#colorpersonal").val(), true));
GM_config.set('colorc1', parseColor($(jNode).find("input#colorcustom1").val(), true));
GM_config.set('colorc2', parseColor($(jNode).find("input#colorcustom2").val(), true));
GM_config.set('colorc3', parseColor($(jNode).find("input#colorcustom3").val(), true));
GM_config.set('colorc4', parseColor($(jNode).find("input#colorcustom4").val(), true));
GM_config.set('colorc5', parseColor($(jNode).find("input#colorcustom5").val(), true));
arrayListP1 = GM_config.get('listp1').match(/[^\r\n=]+/g);
GM_config.save();
$(jNode).find("span#configsaved").show();
$(jNode).find("span#configsaved")[0].style.backgroundColor = 'rgba(40,150,230,1)';
setTimeout(function(){$(jNode).find("span#configsaved")[0].style.backgroundColor = 'rgba(40,150,230,0)';}, 400);
}
function resetconfigNew(jNode) {
$(jNode).find("span#mbcswg1").show();
$(jNode).find("span#mbcswg2").show();
$(jNode).find("select#mbcddm1").val(1);
$(jNode).find("input#mbcbox1").prop('checked', false);
$(jNode).find("input#mbcbox2").prop('checked', true);
$(jNode).find("input#mbcbox3").prop('checked', true);
$(jNode).find("input#listcustom1").val('https://github.com/asrdri/yt-metabot-user-js/raw/master/list-sample.txt');
$(jNode).find("input#listcustom2").val('');
$(jNode).find("input#listcustom3").val('');
$(jNode).find("input#listcustom4").val('');
$(jNode).find("input#listcustom5").val('');
$(jNode).find("input#colorpersonal").val(parseColor(33023, false));
$(jNode).find("input#colorcustom1").val(parseColor(8388863, false));
$(jNode).find("input#colorcustom2").val(parseColor(16744448, false));
$(jNode).find("input#colorcustom3").val(parseColor(8421504, false));
$(jNode).find("input#colorcustom4").val(parseColor(8453888, false));
$(jNode).find("input#colorcustom5").val(parseColor(51328, false));
}
function parseitemNew(jNode) {
if (GM_config.get('option4') === true) {
var spanlistpadd = txtlistpadd;
} else {
var spanlistpadd = '';
}
var pNode = $(jNode).find("#header-author.ytd-comment-renderer")[0];
$(jNode).hover(function blockShow() {
$(pNode).find("#t30sp").show();
}, function blockHide() {
$(pNode).find("#t30sp").hide();
});
var userID = $(jNode).find("a")[0].href.split('/').pop();
var foundID = arrayERKY.indexOf(userID);
var foundIDp1 = -1;
var foundIDc1 = -1;
var foundIDc2 = -1;
var foundIDc3 = -1;
var foundIDc4 = -1;
var foundIDc5 = -1;
if (GM_config.get('option4') === true) {
if (arrayListP1 !== null) {
foundIDp1 = arrayListP1.indexOf(userID);
}
if (typeof arrayListC1 !== 'undefined' && arrayListC1.length > 1) {
foundIDc1 = arrayListC1.indexOf(userID);
}
if (typeof arrayListC2 !== 'undefined' && arrayListC2.length > 1) {
foundIDc2 = arrayListC2.indexOf(userID);
}
if (typeof arrayListC3 !== 'undefined' && arrayListC3.length > 1) {
foundIDc3 = arrayListC3.indexOf(userID);
}
if (typeof arrayListC4 !== 'undefined' && arrayListC4.length > 1) {
foundIDc4 = arrayListC4.indexOf(userID);
}
if (typeof arrayListC5 !== 'undefined' && arrayListC5.length > 1) {
foundIDc5 = arrayListC5.indexOf(userID);
}
}
var comURL = $(jNode).find(".published-time-text")[0];
var t30span = document.createElement('span');
t30span.innerHTML = '\u2003<span id="about" style="cursor: pointer; ' + iconstyledef + '" title="Открыть страницу с датой регистрации">\u2753</span>\u2003<span id="top30" style="cursor: pointer" title="Найти другие комментарии автора с помощью агрегатора ТОП30"><font color="#7777fa">top</font><font color="#fa7777">30</font></span>' + spanlistpadd;
t30span.id = 't30sp';
t30span.style = "display:none";
var newspan = document.createElement('span');
newspan.id = 'checksp';
if (foundID > -1) {
console.log("[MetaBot for Youtube] user found in ERKY-db: " + userID);
if (GM_config.get('option1') == 2) {
foundIDp1 = -1;
foundIDc1 = -1;
foundIDc2 = -1;
foundIDc3 = -1;
foundIDc4 = -1;
foundIDc5 = -1;
var hidspan = document.createElement('span');
hidspan.innerHTML = 'Комментарий скрыт: пользователь найден в ЕРКЮ';
hidspan.classList.add('badge');
hidspan.classList.add('badge-style-type-simple');
hidspan.classList.add('ytd-badge-supported-renderer');
hidspan.style = 'margin: 0 0 10px 0;text-align:center';
$(jNode).parent().parent().after(hidspan);
$(jNode).parent().parent().hide();
} else {
markbotNew($(pNode).parent(), arrayERKY[foundID + 1]);
}
$(comURL).append(t30span);
$(newspan).attr('data-chan', $(jNode).find("a#author-text")[0].href);
pNode.insertBefore(newspan, pNode.firstChild);
} else {
newspan.innerHTML = '<img id="checkbtn" src="' + checkb + '" title="Проверить дату регистрации" style="cursor: help" />';
$(newspan).attr('data-chan', $(jNode).find("a#author-text")[0].href);
pNode.insertBefore(newspan, pNode.firstChild);
t30span.innerHTML += '\u2003<span id="sendlink" style="cursor: pointer" title="Помогите пополнить список известных ботов - отправьте нам данные о подозрительном комментарии">\u27A4</span>';
$(comURL).append(t30span);
$(jNode).find("#checkbtn")[0].addEventListener("click", function checkcommentNew() {
checkdateNew($(pNode).parent());
}, false);
$(jNode).find("#sendlink")[0].addEventListener("click", function displayinfoNew() {
sendinfo();
}, false);
}
if (GM_config.get('option4') === true) {
if (foundIDc1 > -1) {
markcustomNew($(pNode).parent(), arrayListC1[foundIDc1 + 1], 1);
}
if (foundIDc2 > -1) {
markcustomNew($(pNode).parent(), arrayListC2[foundIDc2 + 1], 2);
}
if (foundIDc3 > -1) {
markcustomNew($(pNode).parent(), arrayListC3[foundIDc3 + 1], 3);
}
if (foundIDc4 > -1) {
markcustomNew($(pNode).parent(), arrayListC4[foundIDc4 + 1], 4);
}
if (foundIDc5 > -1) {
markcustomNew($(pNode).parent(), arrayListC5[foundIDc5 + 1], 5);
}
if (foundIDp1 > -1) {
if ($(jNode).find("#checkbtn").length > 0) {
$(jNode).find("#checkbtn")[0].remove();
}
markpersonalNew($(pNode).parent(), arrayListP1[foundIDp1 + 1]);
}
$(jNode).find("#listpadd")[0].addEventListener("click", function addtolistNew() {
if ($(pNode).find("span#bookmark").length > 0) {
listpdelNew(pNode);
$(jNode).find("#listpadd").html(iconsdef[0]);
$(jNode).find("#listpadd")[0].title = 'Добавить в закладки';
} else {
if ($(jNode).find("#checkbtn").length > 0) {
$(jNode).find("#checkbtn")[0].remove();
}
$(jNode).find("#listpadd").html('\u23F3');
getpage(listpaddNew, pNode, $(jNode).find("a")[0].href + '/about')
}
}, false);
}
$(jNode).find("#about")[0].addEventListener("click", function openaboutNew() {
window.open($(jNode).find("a")[0].href + '/about');
}, false);
$(jNode).find("#top30")[0].addEventListener("click", function opent30New() {
window.open('https://www.t30p.ru/search.aspx?s=' + $(jNode).find("a")[0].href.split('/').pop());
}, false);
this.addEventListener('yt-navigate-start', function wipeitemNewS() {
this.removeEventListener('yt-navigate-start', wipeitemNewS);
deleteitemNew(jNode, $(comURL).find("a")[0].href);
});
this.addEventListener('yt-navigate-finish', function wipeitemNewF() {
this.removeEventListener('yt-navigate-finish', wipeitemNewF);
deleteitemNew(jNode, $(comURL).find("a")[0].href);
});
}
function recheckNew(jNode) {
var checkre = $(jNode).find("#checksp")[0];
if (typeof checkre !== 'undefined') {
if ($(checkre).attr('data-chan') !== $(jNode).find("a#author-text")[0].href) {
$(jNode).find("#checksp").remove();
$(jNode).find("#t30sp").remove();
$(jNode).find("#botmark").remove();
var cNode = $(jNode).parent().parent().find("#content-text");
$(cNode).parent().removeAttr('style');
$(cNode).removeAttr('style');
$(jNode).find("ytd-toggle-button-renderer.ytd-comment-action-buttons-renderer:eq(1)").removeAttr('style');
parseitemNew(jNode);
}
}
}
function deleteitemNew(jNode, url) {
if (url.length > 74) {
$(jNode).parent().parent().remove();
} else {
$(jNode).parent().parent().parent().remove();
}
}
function sendinfo() {
var answer = confirm('Будет запущен Telegram.' +
'\n\nПрисоединитесь к группе, отправьте ссылку на подозрительный' +
'\nкомментарий (можно скопировать из даты публикации) и обоснуйте подозрения.\n\nПерейти к группе?');
if (answer) {
window.open(reporturl);
}
}
function listpaddNew(jNode, response, url) {
var matches = regexdate.exec(response);
var day = Dparse(matches[3]);
$('textarea#listpersonal')[0].value += url.substring(0, url.length - 6).split('/').pop() + '=' + day + '\n';
var tempArray = $('textarea#listpersonal')[0].value.split('\n');
var uniqArray = tempArray.reduce(function(a,b){
if (a.indexOf(b) < 0) a.push(b);
return a;
},[]);
$('textarea#listpersonal')[0].value = uniqArray.join('\n');
GM_config.set('listp1', uniqArray.join('\n'));
GM_config.save();
arrayListP1 = GM_config.get('listp1').match(/[^\r\n=]+/g);
$(jNode).find("#listpadd").html('\u274C');
$(jNode).find("#listpadd")[0].title = 'Удалить из закладок';
markpersonalNew($(jNode).parent(), day);
console.log("[MetaBot for Youtube] Bookmarks (personal list) updated.");
}
function listpdelNew(jNode) {
$(jNode).find("span#bookmark").remove();
var tempArray = $('textarea#listpersonal')[0].value.split('\n');
var itemDel = arrayListP1.indexOf($(jNode).find("a")[0].href.split('/').pop());
tempArray.splice(itemDel / 2,1);
$('textarea#listpersonal')[0].value = tempArray.join('\n');
GM_config.set('listp1', tempArray.join('\n'));
GM_config.save();
arrayListP1 = GM_config.get('listp1').match(/[^\r\n=]+/g);
$(jNode).parent().parent().find("#content-text").parent().css({
"background-image": "none",
"border-right": "",
"padding-right": ""
});
console.log("[MetaBot for Youtube] Bookmarks (personal list) updated.");
}
function checkdateNew(jNode) {
if (['en', 'en-US', 'en-GB', 'ru', 'uk', 'be', 'bg'].indexOf(currentlangNew()) < 0) {
alert('Функция поддерживается только на языках:\n \u2714 English\n \u2714 Русский\n \u2714 Українська\n \u2714 Беларуская \u2714 Български\nВы можете сменить язык интерфейса в меню настроек YouTube.');
return;
}
$(jNode).find("#checkbtn")[0].remove();
var userID = $(jNode).find("a")[0].href.split('/').pop();
var foundID = arrayERKY.indexOf(userID);
if (foundID > -1) {
console.log("[MetaBot for Youtube] user found in ERKY-db: " + userID);
markbotNew(jNode, arrayERKY[foundID + 1]);
} else {
getpage(procdateNew, jNode, $(jNode).find("a")[0].href + '/about');
}
}
function procdateNew(jNode, response, url) {
var matches = regexdate.exec(response);
var testday = Dparse(matches[3]);
var aNode = $(jNode).find("#author-text")[0];
var cNode = $(jNode).parent().find("#content-text")[0];
var newspan = document.createElement('span');
newspan.id = 'botmark';
var checkBadge = $(aNode).parent().find('span#author-comment-badge')[0];
newspan.innerHTML = '<img src="' + minf + '" title="Дата регистрации:" /> ' + testday;
$(aNode).append(newspan);
if ($(checkBadge).length > 0) {
$(checkBadge).attr('hidden', '');
$(aNode).removeAttr('hidden');
}
$(cNode).parent().css({
"background": "rgba(170,170,170,0.3)",
"border-left": "3px solid rgba(170,170,170,0.3)",
"padding-left": "3px"
});
aNode = $(jNode).find("#checksp");
aNode.attr('data-chan', $(jNode).find("a#author-text")[0].href);
aNode.hide();
}
function markbotNew(jNode, txt) {
var aNode = $(jNode).find("#author-text")[0];
var cNode = $(jNode).parent().find("#content-text")[0];
var newspan = document.createElement('span');
newspan.id = 'botmark';
newspan.innerHTML = '<img src="' + mred + '" title="- найден в #ЕРКЮ, дата регистрации -" /> ' + txt;
$(aNode).append(newspan);
var checkBadge = $(aNode).parent().find('span#author-comment-badge')[0];
if ($(checkBadge).length > 0) {
$(checkBadge).attr('hidden', '');
$(aNode).removeAttr('hidden');
}
if (regexalt.exec(txt) === null) {
$(cNode).parent().css({
"background": "rgba(255,50,50,0.3)",
"border-left": "3px solid rgba(255,50,50,0.3)",
"padding-left": "3px"
});
} else {
$(cNode).parent().css({
"background": "rgba(255,0,150,0.3)",
"border-left": "3px solid rgba(255,0,150,0.3)",
"padding-left": "3px"
});
$(cNode).parent().parent().css({
"background": "repeating-linear-gradient(135deg, rgba(140,140,140,0.1), rgba(140,140,140,0.1) 10px, rgba(0,0,0,0) 10px, rgba(0,0,0,0) 20px)"
});
}
if (GM_config.get('option2') === true) {
requestDislike(jNode, true);
}
}
function markcustomNew(jNode, txt, list) {
switch (list) {
case 1:
var listname = Aparse(arrayListC1[0]);
break
case 2:
var listname = Aparse(arrayListC2[0]);
break
case 3:
var listname = Aparse(arrayListC3[0]);
break
case 4:
var listname = Aparse(arrayListC4[0]);
break
case 5:
var listname = Aparse(arrayListC5[0]);
}
var aNode = $(jNode).find("#author-text")[0];
var cNode = $(jNode).parent().find("#content-text")[0];
var checkBadge = $(aNode).parent().find('span#author-comment-badge')[0];
var botmark = $(cNode).parent().parent().parent().find("#botmark");
var rgbCustom = gmColor('colorc' + list, 1) + "," + gmColor('colorc' + list, 2) + "," + gmColor('colorc' + list, 3);
var marktxt = '<span style="' + iconstyledef + ' color: rgb(' + rgbCustom + '); font-size: 1.3em;" title="Найден в списке ' + listname + '">' + iconsdef[list] + '</span> ';
if (botmark.length > 0) {
$(botmark).prepend(marktxt);
} else {
$(jNode).find("#checkbtn")[0].remove();
var newspan = document.createElement('span');
newspan.id = 'botmark';
newspan.innerHTML = marktxt + txt;
$(aNode).append(newspan);
if ($(checkBadge).length > 0) {
$(checkBadge).attr('hidden', '');
$(aNode).removeAttr('hidden');
}
$(cNode).parent().css({
"background": "rgba(" + rgbCustom + ",.3)",
"border-left": "3px solid rgba(" + rgbCustom + ",0.3)",
"padding-left": "3px"
});
}
}
function markpersonalNew(jNode, txt) {
$(jNode).find("#listpadd").html('\u274C');
$(jNode).find("#listpadd")[0].title = 'Удалить из закладок';
var aNode = $(jNode).find("#author-text")[0];
var cNode = $(jNode).parent().find("#content-text")[0];
var checkBadge = $(aNode).parent().find('span#author-comment-badge')[0];
var botmark = $(cNode).parent().parent().parent().find("#botmark");
var rgbCustom = gmColor('colorp1', 1) + "," + gmColor('colorp1', 2) + "," + gmColor('colorp1', 3);
var marktxt = '<span id="bookmark" style="' + iconstyledef + ' color: rgb(' + rgbCustom + '); font-size: 1.3em;" title="Добавлен в закладки">' + iconsdef[0] + '</span> ';
if (botmark.length > 0) {
$(botmark).prepend(marktxt);
$(cNode).parent().css({
"background-image": "linear-gradient(230deg, rgba(" + rgbCustom + ",.4) 20%, rgba(0,0,0,0) 30%)"
});
} else {
var newspan = document.createElement('span');
newspan.id = 'botmark';
newspan.innerHTML = marktxt + txt;
$(aNode).append(newspan);
if ($(checkBadge).length > 0) {
$(checkBadge).attr('hidden', '');
$(aNode).removeAttr('hidden');
}
$(cNode).parent().css({
"background": "linear-gradient(230deg, rgba(" + rgbCustom + ",.4) 20%, rgba(0,0,0,0) 30%)"
});
}
$(cNode).parent().css({
"background-origin": "border-box",
"border-right": "3px solid rgba(" + rgbCustom + ",.3)",
"padding-right": "3px"
});
}
function gmColor(gmVar, colpos) {
return parseInt(parseColor(GM_config.get(gmVar), false).slice(colpos*2-1, colpos*2+1), 16)
}
function requestDislike(jNode) {
var element;
element = $(jNode).parent().find("ytd-toggle-button-renderer.ytd-comment-action-buttons-renderer:not(.style-default-active)")[1];
if (element) orderedClicksArray.push(element);