-
Notifications
You must be signed in to change notification settings - Fork 4
/
Ciulin's YouTube.user.js
3880 lines (3803 loc) · 201 KB
/
Ciulin's YouTube.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 Ciulin's YouTube
// @namespace https://www.youtube.com/*
// @version 0.5.35
// @description Broadcast Yourself
// @author CiulinUwU
// @updateURL https://github.com/ciulinuwu/ciulin-s-youtube/raw/main/Ciulin's%20YouTube.user.js
// @downloadURL https://github.com/ciulinuwu/ciulin-s-youtube/raw/main/Ciulin's%20YouTube.user.js
// @match https://www.youtube.com/*
// @exclude https://www.youtube.com/tv
// @exclude https://www.youtube.com/signin_prompt*
// @icon https://www.google.com/s2/favicons?domain=youtube.com
// @require https://github.com/ciulinuwu/ciulin-s-youtube/raw/main/modules/yabai_component.js
// @require https://github.com/ciulinuwu/ciulin-s-youtube/raw/main/modules/open_uix_components.js
// @require https://github.com/ciulinuwu/ciulin-s-youtube/raw/main/modules/translations.js?v=1
// @require https://github.com/ciulinuwu/ciulin-s-youtube/raw/main/translations/english.js?v=1
// @require https://github.com/ciulinuwu/ciulin-s-youtube/raw/main/translations/dansk.js?v=1
// @require https://github.com/ciulinuwu/ciulin-s-youtube/raw/main/translations/polski.js?v=1
// @require https://github.com/aubymori/ciulin-s-youtube/raw/main/translations/enchantingTable.js?v=1
// @grant unsafeWindow
// @grant GM_addStyle
// @grant GM.getValue
// @grant GM.setValue
// @grant GM_xmlhttpRequest
// @grant GM_registerMenuCommand
// @grant GM_deleteValue
// @grant GM_listValues
// @grant GM_getResourceText
// @grant GM_getResourceURL
// @grant GM_log
// @grant GM_openInTab
// @grant GM_setClipboard
// @grant GM_info
// @run-at document-load
// ==/UserScript==
/* jshint esversion: 10 */
(async () => {
'use strict';
function debug(a) {
return console.debug(`[Ciulin's YouTube] ${a}`);
}
function error(a) {
return console.error(`[Ciulin's YouTube] ${a}`);
}
var BOOL_LOGIN;
var BOOL_SUBSCRIBE;
var commCount = 1;
document.ciulinYT = {data: {}, func: {}, load: {}};
const translations = Ciulinations.listTranslations();
const localizeString = (varr) => {
if(!varr) return "";
let lang = "mc";//document.documentElement.getAttribute("lang");
if(!lang || lang.length !== 2) return "";
varr = varr.split(".");
if(!translations[lang] || !translations[lang].json[varr[0]] || !translations[lang].json[varr[0]][varr[1]]) return translations.en.json[varr[0]][varr[1]];
return translations[lang].json[varr[0]][varr[1]];
};
document.ciulinYT.data = {
version: 1,
loggedin: false,
playerSettingsSheet: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAANCAIAAADntZOlAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAlSURBVBhXY/j//z/Tv39/gfgfnP7/H8GGif8H0r9//WT69uUTAPDNJqPDjzoaAAAAAElFTkSuQmCC",
playbarScrub: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAYAAABWdVznAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAD5SURBVChTjZHNjkRQEIUP4p+dVe/EC9iJhQgvLlYsvQC2JFaIIOH21G09s5CZnpNclZz66kdKwKVt21hd1xiG4XJechwHnudBVVXO8s88zyzPcxzHAUH47sHFGIMkSYjjGJZlCQJ1LooC+75D0zSs63qLJEVREIYhxKZpeGcyoiiCLMu3+LUOzvMEsWLXdTAMg5u/iXLE9H0PkXYk468Cmk6Ppoj0Q58K3nli+Ur/LSBW1HWdj/pUQAyxYpqmqKqKm+M44vF43CLliCGWX6ltW0ZGEAQwTZN3fWtZFpRlCd/34bruz1np2lmWYZqmy3nJtm0kScKvDABP3bl3Ot4gE8wAAAAASUVORK5CYII=",
playbarSheet: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAZCAIAAAB/8tMoAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAhSURBVBhXY7h69SoTCDAzMxNNMzAwgNmMjIyEMMP///8BIN0GJrVyhfoAAAAASUVORK5CYII=",
playerSheetB: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAADLCAYAAACYqDZvAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAABaOSURBVHhe7Z0J1FVT+8D3vYq8bxpJ6C3RKM2Tpq9oklqEUn2t8CeLaDCUhcoyfFmL9PmoKGItlimfEhJJ6JMopAlFkwyZEmVKOP/9ezr7du7tvufec4fX7d79W+tZ7xn23ue9+zl7fPZ+jurXr58zbtw4p2fPno7KEJdcconz+OOPO0OGDMlYmoVCaOLEic7evXtV5cqV1ZdffqkWLVqk1q9fH3Lvp8SSJUucww47TCHvvPOOmjp1qlq7dm1aaRYK4V27dqlffvlFbd++XVWsWFFdeOGFqnv37mm92Ycccoj6448/1M8//6yaNWumZsyYoQYPHmxLSxKE//rrL+U4jshPP/0kitEKUVdccYVTv379lDKRNI38/vvv6s8//1Rjx45FMU6TJk2sYnwIG2UYIfOoukxp6datW+AMjE0TobQ0bdpUzZw5U5133nlWKaUQdv8eABn49ddfK93YS2k58cQTk87EeApBaKtQuO5EqHvvvddp3LixVUwMB5QQr5jSUlxcrC666CLVtWtXp1atWgkz0VtlxQpp7t69W0rLfffdpwYMGOCUlJRYxbj4KsSIaVt69OihDj/8cDdq6cRLI1ZoW1AQbUu1atXcmJakFILwZm/ZskV6ZImIFz+eoBAUTU/Pso+kFfL555+rp59+WtqBRMSLH0/ef/99NWLEiKSUXCiU2qgb9uzZo95880310ksvqUMPPVSFQonHd942I578+OOPavr06Wr8+PFS8pJJs1AIXXrppaU2qF988QWjbslE3etKOte08kpNc/Xq1equu+6SdkmL1UQMcaus3377TUrFwoULVfny5QMpA+KlSTvBiH3ChAlS7VllxOcAhVAq5s6dKw24zrjQ999/HzjjYquoVatWqVGjRsk8GWnu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/ieFeud+jQIannvfXWW5HnmdLRr1+/nGoHn7v/fqd5797umaxJUBvXr1d7dIZ7Obx8eVWvUSMxYpkXefXChftXnZgqJ5lqx5BKHFOS2GxjJFm8cZItkWVN7KoT1qvVb9xYHVm1qirWbQnCMcqgYY+36iTer0r2rUslblk/r0wpk1UnluRJd9WJnTrJML/v3Rs6TitkxGWXyUIGb/UVTwhDWOIQ15aQLGBXneQgdtVJDhJ81YlS/w/H7AjFAOLO5QAAAABJRU5ErkJggg==",
playbarShadow: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAZCAIAAACZ2xhsAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAA6SURBVChTY1y2bJm4uLiAgAA3NzcTAxgwggGIA2UBwWCRgQAMZXCA0AMECBkEB8gCkthkIIB0AxgZAbxaA1A95vt3AAAAAElFTkSuQmCC",
playbarSeeker: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAaCAYAAAB2BDbRAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAABQSURBVBhXbYqxDYAwEANP7kkmyDBZiDYTsUK2oosUpTK8oEK4OFu22UsxB1gJ0HaDs3eHQ2vNqrWinDNKKU6htZZlmy9ifNIYA8053+4fcAGeySL/5lJgnAAAAABJRU5ErkJggg==",
playbarSeek: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAECAIAAADAusJtAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAZSURBVBhXYzhy5AiToKAgw5s3bxi+f/8OADiwCCtHhAKiAAAAAElFTkSuQmCC",
loginUrl: "https://accounts.google.com/ServiceLogin?service=youtube&uilel=3&passive=true&continue=https%3A%2F%2Fwww.youtube.com%2Fsignin%3Faction_handle_signin%3Dtrue%26app%3Ddesktop%26hl%3Den%26next%3Dhttps%253A%252F%252Fwww.youtube.com%252F&hl=en&ec=65620",
lang: {
"af": "Afrikaans",
"ar": "",
"az": "Azərbaycan",
"bs": "Bosanski",
"ca": "Català",
"cs": "Čeština",
"da": "Dansk",
"de": "Čeština",
"en": "English",
"en-GB": "English (UK)",
"en-IN": "English (India)",
"es": "Español (España)",
"es-419": "Español (España)",
"es-US": "Español (US)",
"et": "Eesti",
"eu": "Euskara",
"fa": "",
"fi": "Suomi",
"fil": "Filipino",
"fr": "Français",
"fr-CA": "Français (Canada)",
"gl": "Galego",
"hr": "Hrvatski",
"hu": "Magyar",
"pl": "Polski",
"mc": "Enchantment Table"
}
};
document.ciulinYT.load = {
recent_feed: async () => {
var test = new Promise(async resolve => {
var xhr = new XMLHttpRequest();
xhr.open("GET", `https://www.youtube.com${window.location.pathname}/community`);
xhr.onload = async () => {
let a = JSON.parse(xhr.response.split("var ytInitialData = ")[1].split(";</script>")[0]).contents.twoColumnBrowseResultsRenderer.tabs.find(b => b.tabRenderer ? b.tabRenderer.endpoint.commandMetadata.webCommandMetadata.url.split("/")[3] === 'community' : {});
if(!a.tabRenderer) return resolve({});
let sortImages = async (img) => {
let stor = "";
for (let i = 0; i < img.images.length; i++) {
stor += `<img src="${img.images[i].backstageImageRenderer.image.thumbnails[0].url}"/>`;
}
return stor;
};
let video = async (vid) => {
let {id, title, time} = await document.ciulinYT.func.organizeVideoData(vid);
return `<div class="playnav-item playnav-video">
<div style="display:none" class="encryptedVideoId">${id}</div>
<div class="selector"></div>
<div class="content">
<div class="playnav-video-thumb">
<a href="https://www.youtube.com/watch?v=${id}" onclick="document.ciulinYT.func.loadPlaynavVideo('${id}');return false;" class="ux-thumb-wrap">
<span class="video-thumb ux-thumb-96 ">
<span class="clip">
<img src="//i1.ytimg.com/vi/${id}/default.jpg" alt="Thumbnail" class="" onclick="document.ciulinYT.func.loadPlaynavVideo('${id}');return false;" title="${title}">
</span>
</span>
<span class="video-time">${time}</span>
</a>
</div>
<div class="playnav-video-info">
<a href="https://www.youtube.com/watch?v=${id}" class="playnav-item-title ellipsis" onclick="document.ciulinYT.func.loadPlaynavVideo('${id}');return false;">
<span dir="ltr">${title}</span>
</a>
<div style="display:none" id="playnav-video-play-uploads-12">${id}</div>
</div>
</div>
</div>`;
};
let filter = async (j) => {
let img = j.backstageAttachment;
if(!img) return '';
let stor = "";
for (const obj in img) {
switch (obj) {
case 'postMultiImageRenderer':
stor = await sortImages(img.postMultiImageRenderer);
break;
case 'backstageImageRenderer':
stor = '<img src="' + img.backstageImageRenderer.image.thumbnails[0].url + '">';
break;
case 'videoRenderer':
stor = await video(img.videoRenderer);
break;
}
}
return stor;
};
let b = a.tabRenderer.content.sectionListRenderer.contents[0].itemSectionRenderer.contents;
let j;
let data = [];
for (j = 0; j < b.length; j++) {
if(!b[j].continuationItemRenderer && !b[j].messageRenderer) {
data[j] = {};
let post = b[j].backstagePostThreadRenderer.post.sharedPostRenderer ? b[j].backstagePostThreadRenderer.post.sharedPostRenderer.originalPost.backstagePostRenderer : b[j].backstagePostThreadRenderer.post.backstagePostRenderer;
data[j].text = post.contentText.runs ? post.contentText.runs[0].text : "";
data[j].images = await filter(post);
data[j].author = post.authorText.runs[0].text;
data[j].timestamp = post.publishedTimeText.runs[0].text;
}
}
resolve(data);
};
xhr.onerror = () => {
console.error("** An error occurred during the XMLHttpRequest");
};
xhr.send();
});
let a = await test;
return a;
},
channel_videos: async () => {
var test = new Promise(async resolve => {
var xhr = new XMLHttpRequest();
xhr.open("GET", `https://www.youtube.com${window.location.pathname}/videos`);
xhr.onload = async () => {
let a = JSON.parse(xhr.response.split("var ytInitialData = ")[1].split(";</script>")[0]).contents.twoColumnBrowseResultsRenderer.tabs.find(b => b.tabRenderer.endpoint.commandMetadata.webCommandMetadata.url.split("/")[3] === 'videos');
if(!a.tabRenderer.content.sectionListRenderer.contents[0].itemSectionRenderer.contents[0].gridRenderer) return resolve([]);
let b = a.tabRenderer.content.sectionListRenderer.contents[0].itemSectionRenderer.contents[0].gridRenderer.items;
let data = [];
for (let j = 0; j < b.length; j++) {
if(!b[j].continuationItemRenderer) {
let videoData = await document.ciulinYT.func.organizeVideoData(b[j].gridVideoRenderer);
data[j] = videoData;
}
}
resolve(data);
};
xhr.onerror = () => {
console.error("** An error occurred during the XMLHttpRequest");
};
xhr.send();
});
let a = await test;
return a;
},
channel_subscriptions: async () => {
var test = new Promise(async resolve => {
var xhr = new XMLHttpRequest();
xhr.open("GET", `https://www.youtube.com${window.location.pathname}/channels?view=56&shelf_id=0`);
xhr.onload = async () => {
let a = JSON.parse(xhr.response.split("var ytInitialData = ")[1].split(";</script>")[0]).contents.twoColumnBrowseResultsRenderer.tabs.find(b => b.tabRenderer.endpoint.commandMetadata.webCommandMetadata.url.split("/")[3] === 'channels');
let master = {array: [], length: 0};
if(!a.tabRenderer || !a.tabRenderer.content.sectionListRenderer.contents[0].itemSectionRenderer.contents[0].gridRenderer) return resolve(master);
let list = a.tabRenderer.content.sectionListRenderer.contents[0].itemSectionRenderer.contents[0].gridRenderer.items;
let fetch = async (url) => {
let a = await document.ciulinYT.func.getApi("/youtubei/v1/browse", `continuation: "${url}"`);
await loop(a.onResponseReceivedActions[0].appendContinuationItemsAction.continuationItems);
return a;
};
let loop = async (obj) => {
for (let i = 0; i < obj.length; i++) {
if(obj[i].continuationItemRenderer) {
let te = obj[i].continuationItemRenderer.continuationEndpoint.continuationCommand.token;
await fetch(te);
}
if(obj[i].gridChannelRenderer) {
master.array.push(obj[i].gridChannelRenderer);
master.length += 1;
}
}
};
await loop(list);
resolve(master);
};
xhr.onerror = () => {
console.error("** An error occurred during the XMLHttpRequest");
};
xhr.send();
});
let a = await test;
return a;
},
channel_info: async () => {
let test = new Promise(async resolve => {
var xhr = new XMLHttpRequest();
xhr.open("GET", `https://www.youtube.com${window.location.pathname}/about`);
xhr.onload = async () => {
let a = JSON.parse(xhr.response.split("var ytInitialData = ")[1].split(";</script>")[0]).contents.twoColumnBrowseResultsRenderer.tabs.find(b => b.tabRenderer ? b.tabRenderer.endpoint.commandMetadata.webCommandMetadata.url.split("/")[3] === 'about' : {});
if(!a.tabRenderer) return resolve({});
let b = a.tabRenderer.content.sectionListRenderer.contents[0].itemSectionRenderer.contents[0].channelAboutFullMetadataRenderer;
let collection = {name: {}, string: {}};
collection.string.BIO = b.artistBio ? "<br/><br/>" + b.artistBio.simpleText.replace(/(?:\r\n|\r|\n)/g, "<br/>") : "";
collection.name.COUNTRY = b.countryLabel ? b.countryLabel.runs[0].text.replace(/(?:\r\n|\r|\n)|( )|:/g, "") : undefined;
collection.string.COUNTRY = b.country ? b.country.simpleText : undefined;
collection.name.JOIN = b.joinedDateText ? b.joinedDateText.runs[0].text.split(" ")[0] : undefined;
collection.string.JOIN = b.joinedDateText ? b.joinedDateText.runs[1].text : undefined;
collection.name.VIEWS = b.viewCountText ? b.viewCountText.simpleText.split(" ")[1].charAt(0).toUpperCase() + b.viewCountText.simpleText.split(" ")[1].slice(1) : undefined;
collection.string.VIEWS = b.viewCountText ? b.viewCountText.simpleText.split(" ")[0] : undefined;
resolve(collection);
};
xhr.onerror = () => {
console.error("** An error occurred during the XMLHttpRequest");
};
xhr.send();
});
let a = await test;
return a;
},
home_category: async(category) => {
if(!category || window.location.pathname !== "/") {
window.location.href = "/?c=subscriptions";
return;
}
var guide = document.querySelector(".guide");
if(guide.getAttribute("data-last-clicked-item") == category.getAttribute("data-feed-name")) return;
guide.setAttribute("data-last-clicked-item", category.getAttribute("data-feed-name"));
document.querySelector(".selected-child").classList.remove("selected-child");
document.querySelector(".selected").classList.remove("selected");
category.parentNode.classList.add("selected-child");
category.classList.add("selected");
document.querySelector("#feed-loading-template").classList.remove("hid");
document.querySelector("#feed-main-youtube").classList.add("hid");
document.querySelector("#feed-error").classList.add("hid");
var url = category.getAttribute("data-feed-url");
var xhr = new XMLHttpRequest();
xhr.open("GET", `https://www.youtube.com${url}`);
xhr.timeout = 4000;
xhr.ontimeout = () => {
console.error("** An error occurred during the XMLHttpRequest");
document.querySelector("#feed-loading-template").classList.add("hid");
document.querySelector("#feed-error").classList.remove("hid");
};
xhr.onload = async (e) => {
document.querySelector(".feed-header-info").innerText = category.querySelector(".display-name").innerText;
let json = JSON.parse(xhr.response.split("var ytInitialData = ")[1].split(";</script>")[0]);
let template = async(a) => {
let {owner, time, views, title, id, url, description, upload, icon} = await document.ciulinYT.func.organizeVideoData(a);
let string_uploadedorlive;
if(views[1].length > 1) {
string_uploadedorlive = localizeString("watch.uploadedavideo");
} else {
string_uploadedorlive = localizeString("watch.islive");
};
let o = `<li>
<div class="feed-item-container first" data-channel-key="UCBE-FO9JUOghSysV9gjTeHw">
<div class="feed-author-bubble-container">
<a href="${url}" class="feed-author-bubble">
<span class="feed-item-author">
<span class="video-thumb ux-thumb yt-thumb-square-28">
<span class="yt-thumb-clip">
<span class="yt-thumb-clip-inner">
<img src="${icon}" alt="${owner.text}" data-thumb="${icon}" width="28">
<span class="vertical-align"></span>
</span>
</span>
</span>
</span>
</a>
</div>
<div class="feed-item-main">
<div class="feed-item-header">
<span class="feed-item-actions-line">
<span class="feed-item-owner">
<a href="${url}" class="yt-uix-sessionlink yt-user-name" dir="ltr">${owner.text}</a>
</span> ${string_uploadedorlive} <span class="feed-item-time">${views[1]}</span>
</span>
</div>
<div class="feed-item-content-wrapper clearfix context-data-item" data-context-item-actionverb="uploaded" data-context-item-title="Steam for Linux a Bad Idea? - This Week in Linux Gaming" data-context-item-type="video" data-context-item-time="5:21" data-context-item-user="nixiedoeslinux" data-context-item-id="7LVtbTurdCk" data-context-item-views="25,816 views" data-context-item-actionuser="nixiedoeslinux">
<div class="feed-item-thumb">
<a class="ux-thumb-wrap contains-addto yt-uix-contextlink yt-uix-sessionlink" href="/watch?v=${id}">
<span class="video-thumb ux-thumb yt-thumb-default-185">
<span class="yt-thumb-clip"><span class="yt-thumb-clip-inner">
<img src="//i2.ytimg.com/vi/${id}/hqdefault.jpg" alt="Thumbnail" width="185">
<span class="vertical-align"></span>
</span>
</span>
</span>
<span class="video-time">${time}</span>
<button onclick=";return false;" title="Watch Later" type="button" class="addto-button video-actions addto-watch-later-button yt-uix-button yt-uix-button-default yt-uix-button-short yt-uix-tooltip" data-video-ids="7LVtbTurdCk" role="button">
<span class="yt-uix-button-content">
<img src="//s.ytimg.com/yts/img/pixel-vfl3z5WfW.gif" alt="Watch Later">
</span>
</button>
</a>
</div>
<div class="feed-item-content">
<h4>
<a class="feed-video-title title yt-uix-contextlink yt-uix-sessionlink" href="/watch?v=${id}">${title}</a>
</h4>
<div class="metadata">
<span class="view-count">${views[0]}</span>
<div class="description">
<p>${description}</p>
</div>
</div>
</div>
</div>
</div>
<span class="feed-item-action-menu subscribed" data-external-id="PqyfOmT8QmomqIwGPT4hxRGvXqh6izrXz8s1TlSF8fg0h_MQ8Qjx10A==">
<button type="button" class="flip yt-uix-button yt-uix-button-feed-item-action-menu yt-uix-button-empty" onclick=";return false;" data-button-has-sibling-menu="True" role="button" aria-pressed="false" aria-expanded="false" aria-haspopup="true" aria-activedescendant=""><span class="yt-uix-button-icon-wrapper"><img class="yt-uix-button-icon yt-uix-button-icon-feed-item-action-menu" src="//s.ytimg.com/yts/img/pixel-vfl3z5WfW.gif" alt=""><span class="yt-valign-trick"></span></span><img class="yt-uix-button-arrow" src="//s.ytimg.com/yts/img/pixel-vfl3z5WfW.gif" alt=""><ul class=" yt-uix-button-menu yt-uix-button-menu-feed-item-action-menu" role="menu" aria-haspopup="true" style="display: none;"><li role="menuitem" id="aria-id-69285446284"><span data-action="hide" class="dismiss-menu-choice yt-uix-button-menu-item" onclick=";return false;">Hide this activity</span></li><li role="menuitem" id="aria-id-71783894232"><span data-subscription-id="s-g9bXtaCSKRwzCmeFkvD912YfxX4CmZ5I-IkGd8HUI" data-action="uploads" class="dismiss-menu-choice uploads yt-uix-button-menu-item" onclick=";return false;">Only show uploads from nixiedoeslinux
</span></li><li role="menuitem" id="aria-id-62584392243"><span data-action="subscribe" class="dismiss-menu-choice subscribe yt-uix-button-menu-item" onclick=";return false;">Subscribe to nixiedoeslinux
</span></li><li role="menuitem" id="aria-id-68105254288"><span data-channel-key="UCBE-FO9JUOghSysV9gjTeHw" onclick=";return false;" data-action="unsubscribe" data-subscription-id="s-g9bXtaCSKRwzCmeFkvD912YfxX4CmZ5I-IkGd8HUI" class="dismiss-menu-choice unsubscribe yt-uix-button-menu-item">Unsubscribe from nixiedoeslinux
</span></li></ul></button>
</span>
</div>
<div class="feed-item-dismissal-notices"><div class="feed-item-dismissal feed-item-dismissal-hide hid">This item has been hidden</div><div class="feed-item-dismissal feed-item-dismissal-uploads hid">In the future you will only see uploads from <span class="feed-item-owner"><a href="/user/nixiedoeslinux?feature=g-u-u" class="yt-uix-sessionlink yt-user-name " data-sessionlink="feature=g-u-u" dir="ltr">nixiedoeslinux</a></span>
</div><div class="feed-item-dismissal feed-item-dismissal-all-activity hid">In the future you will see all activity from <span class="feed-item-owner"><a href="/user/nixiedoeslinux?feature=g-u-u" class="yt-uix-sessionlink yt-user-name " data-sessionlink="feature=g-u-u" dir="ltr">nixiedoeslinux</a></span>
</div><div class="feed-item-dismissal feed-item-dismissal-unsubscribe hid">You have been unsubscribed from <span class="feed-item-owner"><a href="/user/nixiedoeslinux?feature=g-u-u" class="yt-uix-sessionlink yt-user-name " data-sessionlink="feature=g-u-u" dir="ltr">nixiedoeslinux</a></span>
</div></div>
</li>`;
return o;
};
let fetch = await document.ciulinYT.func.handleCategory(json, "0", "22", template, [[], []]);
document.querySelector(".feed-header-thumb .feed-header-icon").classList.remove(document.querySelector(".feed-header-thumb .feed-header-icon").classList[1]);
document.querySelector(".feed-header-thumb .feed-header-icon").classList.add(document.querySelector(".selected .system-icon").classList[2]);
document.querySelector(".context-data-container").innerHTML = fetch;
document.querySelector("#feed-loading-template").classList.add("hid");
document.querySelector("#feed-main-youtube").classList.remove("hid");
};
xhr.send();
},
settings_tab: async(dataName) => {
if (!dataName) return;
let DOM = document.querySelector("video-settings");
let CON = DOM.querySelector(".playmenu-content");
CON.innerHTML = "";
document.querySelector(".playmenu-button.selected").classList.remove("selected");
document.querySelector(`[data-name="${dataName}"]`).classList.add("selected");
let loadSubtitles = async () => {
let HTML = [];
let subtitlesSTORAGE = await document.ciulinYT.func.getFromStorage("subtitles");
let jSON = [{disabled: "", languageCode: "", name: {simpleText: "No subtitles"}}];
let posiShort = (ytInitialPlayerResponse) ? (ytInitialPlayerResponse.captions) ? ytInitialPlayerResponse.captions.playerCaptionsTracklistRenderer.captionTracks : jSON : jSON;
let posiSubtitles = ``;
let value = subtitlesSTORAGE.value;
for (let i = 0; i < posiShort.length; i++) {
let _value = (posiShort[i].languageCode == subtitlesSTORAGE.value) ? 'selected=""' : "";
posiSubtitles += `<option value="${posiShort[i].languageCode}" ${_value}>${posiShort[i].name.simpleText}</option>`;
}
let chck_toggle = (posiShort[0].disabled == "") ? 'disabled=""' : '';
let _toggle = `<span class="playmenu-text">Subtitles</span><div class="settings-toggle"><input type="checkbox" class="settings-toggle" id="settings-subtitles" ${chck_toggle}><label for="settings-subtitles" class="playmenu-text">Enable Subtitles</label></div><div class="settings-selecter"><select class="settings-selecter" id="settings-subtitles" disabled="">${posiSubtitles}</select></div>`;
HTML.push(_toggle);
for (let i = 0; i < HTML.length; i++) {
CON.innerHTML += HTML[i];
}
document.querySelector(".settings-toggle#settings-subtitles").addEventListener("click", e => {
if(e.srcElement.checked == true) {
document.querySelector(".settings-selecter#settings-subtitles").removeAttribute("disabled");
} else {
document.querySelector(".settings-selecter#settings-subtitles").setAttribute("disabled", "");
}
document.ciulinYT.player.toggleSubtitles();
});
document.querySelector(".settings-selecter#settings-subtitles").addEventListener("change", e => {
document.ciulinYT.func.addToStorage("subtitles", "value", e.srcElement.value);
document.ciulinYT.player.setOption("captions", "track", {"languageCode": e.srcElement.value});
});
};
let loadQuality = async () => {
let HTML = [];
let qualitySTORAGE = await document.ciulinYT.func.getFromStorage("quality");
let qualShort = document.ciulinYT.player.getAvailableQualityLevels();
let qualShorter = document.ciulinYT.player.getPlaybackQuality();
let qualQuality = ``;
let value = qualitySTORAGE.value;
for (let i = 0; i < qualShort.length; i++) {
let _value = (qualShort[i] == qualShorter) ? 'selected=""' : (qualShort[i] == qualitySTORAGE.value) ? 'selected=""' : "";
qualQuality += `<option value="${qualShort[i]}" ${_value}>${qualShort[i]}</option>`;
}
let _select = `<span class="playmenu-text">Video Quality</span><div class="settings-selecter"><select class="settings-selecter" id="settings-quality">${qualQuality}</select><span class="playmenu-text">Technically doesn't do anything since YouTube deprecated <a href="https://developers.google.com/youtube/iframe_api_reference#october-24,-2019" target="_blank">setPlaybackQuality</a></span></div>`;
HTML.push(_select);
for (let i = 0; i < HTML.length; i++) {
CON.innerHTML += HTML[i];
}
};
let loadPlayback = async () => {
let HTML = [];
let playbackSTORAGE = await document.ciulinYT.func.getFromStorage("playback");
let playShort = document.ciulinYT.player.getAvailablePlaybackRates();
let playShorter = document.ciulinYT.player.getPlaybackRate();
let playRate = ``;
let value = playbackSTORAGE.value;
for (let i = 0; i < playShort.length; i++) {
let _value = (playShort[i] == playShorter) ? 'selected=""' : (playShort[i] == playbackSTORAGE.value) ? 'selected=""' : "";
playRate += `<option value="${playShort[i]}" ${_value}>${playShort[i]}</option>`;
}
let _select = `<span class="playmenu-text">Playback Rate</span><div class="settings-selecter"><select class="settings-selecter" id="settings-play">${playRate}</select></div>`;
HTML.push(_select);
for (let i = 0; i < HTML.length; i++) {
CON.innerHTML += HTML[i];
}
document.querySelector(".settings-selecter#settings-play").addEventListener("change", e => {
document.ciulinYT.func.addToStorage("playback", "value", Number(e.srcElement.value));
document.ciulinYT.player.setPlaybackRate(Number(e.srcElement.value));
});
};
let loadLoop = async () => {
let _select = `<span class="playmenu-text">Loop Video</span><div class="settings-toggle"><input type="checkbox" class="settings-toggle" id="settings-loop"><label for="settings-loop" class="playmenu-text">Enable Loop</label></div>`;
CON.innerHTML += _select;
document.querySelector(".settings-toggle#settings-loop").addEventListener("click", e => {
let id = document.ciulinYT.player.getVideoUrl().split("v=")[1];
let l = document.ciulinYT.player.getCurrentTime();
if(e.srcElement.checked == true) {
document.ciulinYT.player.loadPlaylist(id, 0, l);
document.ciulinYT.player.setLoop(true);
} else {
document.ciulinYT.player.loadVideoById(id, l);
}
});
};
switch (dataName) {
case "subtitles":
loadSubtitles();
break;
case "quality":
loadQuality();
break;
case "playback":
loadPlayback();
break;
case "loop":
loadLoop();
break;
}
},
browse_category: async (category) => {
if(!category) return;
let obj = {class: category};
let string = "";
let template = async(current) => {
let {owner, time, views, title, id, url} = await document.ciulinYT.func.organizeVideoData(current);
let a = `<div class="browse-item yt-tile-default">
<a href="https://www.youtube.com/watch?v=${id}" class="ux-thumb-wrap">
<span class="video-thumb ux-thumb ux-thumb-184">
<span class="clip">
<span class="clip-inner"><img alt="Thumbnail" src="//i2.ytimg.com/vi/${id}/hqdefault.jpg" data-group-key="thumb-group-0"><span class="vertical-align"></span></span>
</span>
</span>
<span class="video-time">${time}</span>
</a>
<div class="browse-item-content">
<h3 dir="ltr">
<a href="https://www.youtube.com/watch?v=${id}" title="${title}">${title}</a>
</h3>
<div class="browse-item-info">
<div class="metadata-line">
<span class="viewcount">${views[0]}</span>
<span class="metadata-separator">|</span>
<span class="video-date-added">${views[1]}</span>
</div>
<a class="yt-user-name" dir="ltr" href="https://www.youtube.com${url}">${owner.text}</a>
</div>
</div>
</div>`;
return a;
};
switch (category) {
case "most-viewed":
obj.name = localizeString("browse.mostviewed");
obj.html = await document.ciulinYT.func.handleCategory(ytInitialData, 4, 8, template, ['<div class="browse-item-row ytg-box">', '</div>']);
return obj;
case "recommended":
string = "/";
obj.name = localizeString("browse.recommended");
break;
case "music":
obj.name = localizeString("guide.music");
string = "/channel/UC-9-kyTW8ZkZNDHQJ6FgpwQ";
break;
case "film":
obj.name = "Film";
string = "/feed/storefront";
break;
case "live":
obj.name = localizeString("guide.live");
string = "/channel/UC4R8DWoMoI7CAwX8_LjQHig";
break;
case "gaming":
obj.name = localizeString("guide.gaming");
string = "/gaming";
break;
case "news":
obj.name = localizeString("guide.news");;
string = "/channel/UCYfdidRxbB8Qhf0Nx7ioOYw";
break;
case "sports":
obj.name = localizeString("guide.sports");
string = "/channel/UCEgdi0XIXXZ-qJOFPf4JSKw";
break;
case "edu":
obj.name = localizeString("guide.education");;
string = "/channel/UCtFRv9O2AHqOZjjynzrv-xg";
break;
case "howto":
obj.name = localizeString("guide.howto");
string = "/channel/UCrpQ4p1Ql_hG8rKXIKM1MOQ";
break;
}
var test = new Promise(async resolve => {
var xhr = new XMLHttpRequest();
xhr.open("GET", `https://www.youtube.com${string}`);
xhr.onload = async () => {
let json = JSON.parse(xhr.response.split("var ytInitialData = ")[1].split(";</script>")[0]);
let CONTENTS = await document.ciulinYT.func.handleCategory(json, 4, 8, template, ['<div class="browse-item-row ytg-box">', '</div>']);
resolve(CONTENTS);
};
xhr.onerror = () => {
console.error("** An error occurred during the XMLHttpRequest");
};
xhr.send();
});
obj.html = await test;
return obj;
},
homepage_list: async (category) => {
if(!category) return;
let obj = {class: category};
let string = "";
switch (category) {
case "trending":
obj.name = localizeString("guide.trending");
string = "/feed/trending";
break;
case "popular":
obj.name = localizeString("guide.popular");
string = "/channel/UCF0pVplsI8R5kcAqgtoRqoA";
break;
case "music":
obj.name = localizeString("guide.music");
string = "/channel/UC-9-kyTW8ZkZNDHQJ6FgpwQ";
break;
case "live":
obj.name = localizeString("guide.live");
string = "/channel/UC4R8DWoMoI7CAwX8_LjQHig";
break;
case "gadgets":
obj.name = localizeString("guide.gaming");
string = "/gaming";
break;
case "news":
obj.name = localizeString("guide.news");
string = "/channel/UCYfdidRxbB8Qhf0Nx7ioOYw";
break;
case "sports":
obj.name = localizeString("guide.sports");
string = "/channel/UCEgdi0XIXXZ-qJOFPf4JSKw";
break;
case "education":
obj.name = localizeString("guide.education");
string = "/channel/UCtFRv9O2AHqOZjjynzrv-xg";
break;
case "howto":
obj.name = localizeString("guide.howto");
string = "/channel/UCrpQ4p1Ql_hG8rKXIKM1MOQ";
break;
case "technoblade":
obj.name = "Technoblade";
string = "/c/technoblade";
break;
}
obj.url = string;
return obj;
},
subscriptions: async () => {
let test = new Promise(async resolve => {
let subs = await document.ciulinYT.func.getApi("/youtubei/v1/guide");
let org = await document.ciulinYT.func.organizeSubscriptionsData(subs);
resolve(org);
});
let a = await test;
return a;
},
picker: async (pickie) => {
if(!pickie) return;
document.querySelector("#picker-loading").removeAttribute("style");
let api = await document.ciulinYT.func.getApi("/youtubei/v1/account/account_menu");
console.debug(api);
let sum = api.actions[0].openPopupAction.popup.multiPageMenuRenderer.sections[2].multiPageMenuSectionRenderer.items;
let ij, ik, ia, io, iu, pp;
let fixArr = [];
for (let i = 0; i < sum.length; i++) {
if(sum[i].compactLinkRenderer) {
fixArr.push(sum[i].compactLinkRenderer);
}
}
switch (pickie) {
case "LANGUAGE":
sum = fixArr.find(a => a.icon.iconType == "TRANSLATE");
ij = "selectLanguageCommand";
ik = "hl";
pp = "lang";
ia = "language-picker";
io = "Choose your language";
iu = "Choose the language in which you want to view YouTube. This will only change the interface, not any text entered by other users.";
break;
case "COUNTRY":
sum = fixArr.find(a => a.icon.iconType == "LANGUAGE");
ij = "selectCountryCommand";
ik = "gl";
pp = "country";
ia = "region-picker";
io = "Choose your content location";
iu = "Choose which country or region's content (videos and channels) you would like to view. This will not change the language of the site.";
break;
}
let test = sum.serviceEndpoint.signalServiceEndpoint.actions[0].getMultiPageMenuAction.menu.multiPageMenuRenderer.sections[0].multiPageMenuSectionRenderer.items;
let result = "";
let outArray = [ [], [], [], [], [], [], [], [], [] ];
let bh = (ik == "gl") ? ['<div class="flag-list">', "</div>"] : ["", ""];
let bi = (ik == "gl") ? `<div class="flag-list first"><div class="flag-div"><img id="flag_en_US" src="//s.ytimg.com/yt/img/pixel-vfl3z5WfW.gif" class="flag_en_US" alt="" width="17" height="11"> <span class="selected">Worldwide (All)</span></div></div>` : ``;
for (let i = 0; i < test.length; i++) {
outArray[Math.floor(i/12)].push({name: test[i].compactLinkRenderer.title.simpleText, lang: test[i].compactLinkRenderer.serviceEndpoint.signalServiceEndpoint.actions[0][ij][ik]});
}
for (let i = 0; i < outArray.length; i++) {
let aaa = ``;
for (let I = 0; I < outArray[i].length; I++) {
console.debug(outArray[i][I].name + " " + outArray[i][I].lang);
let im = (ik == "gl") ? `<a href="#" onclick="(async() => {await document.ciulinYT.func.addToStorage('${pp}', 'value', '${outArray[i][I].lang}');})(); window.location.reload(); return false;"><img id="flag_${outArray[i][I].lang.toLowerCase()}_${outArray[i][I].lang}" src="//s.ytimg.com/yt/img/pixel-vfl3z5WfW.gif" class="flag_${outArray[i][I].lang.toLowerCase()}_${outArray[i][I].lang}" alt="" width="17" height="11"> </a>` : ``;
aaa += `<div class="flag-div">${im}
<a href="#" onclick="(async() => {await document.ciulinYT.func.addToStorage('${pp}', 'value', '${outArray[i][I].lang}');})(); window.location.reload(); return false;">${outArray[i][I].name}</a>
</div>`;
}
result += `<div class="flag-bucket">${aaa}</div>`;
}
let html = `<div id="${ia}" style="" class="yt-tile-static">
<div class="picker-top">
<div class="box-close-link">
<img onclick="_hidediv('${ia}');" src="//s.ytimg.com/yt/img/pixel-vfl3z5WfW.gif" alt="Close">
</div>
<h2>${io}</h2>
<p>${iu}</p>
<div class="clearR"></div>
</div>
<div>${bi}${bh[0]}${result}${bh[1]}<div class="spacer"> </div></div>
</div>`;
document.querySelector("#picker-container").innerHTML = html;
document.querySelector("#picker-loading").classList.add("hid");
},
comments: async (continuation, number) => {
let dd = ".all";
let stopLoad = () => {
document.querySelector(".comment-list" + dd).classList.remove("hid");
document.querySelector("#comments-loading").classList.add("hid");
};
if(!continuation) {
return stopLoad();
}
document.querySelector("#comments-loading").classList.remove("hid");
let api = await document.ciulinYT.func.getApi("/youtubei/v1/next", `continuation: "${continuation}"`);
let collection = api.onResponseReceivedEndpoints[1] ? api.onResponseReceivedEndpoints[1].reloadContinuationItemsCommand.continuationItems ? api.onResponseReceivedEndpoints[1].reloadContinuationItemsCommand.continuationItems : false : api.onResponseReceivedEndpoints[0].appendContinuationItemsAction.continuationItems ? api.onResponseReceivedEndpoints[0].appendContinuationItemsAction.continuationItems : [];
if(api.responseContext.mainAppWebResponseContext.loggedOut == false && document.querySelector("#session").getAttribute("data-yes") !== "yes") {
document.querySelector("#session").setAttribute("data-yes", "yes");
document.querySelector("#session").value = api.onResponseReceivedEndpoints[0].reloadContinuationItemsCommand.continuationItems[0].commentsHeaderRenderer.createRenderer.commentSimpleboxRenderer.submitButton.buttonRenderer.serviceEndpoint.createCommentEndpoint.createCommentParams;
}
if(number == 0) {
dd = ".top";
let tt = api.onResponseReceivedEndpoints[0].reloadContinuationItemsCommand.continuationItems[0].commentsHeaderRenderer.sortMenu.sortFilterSubMenuRenderer.subMenuItems[1].serviceEndpoint.continuationCommand.token;
document.ciulinYT.load.comments(tt, 1);
collection = collection.splice(0, 2);
}
if(collection.length == 0 || collection == false) return stopLoad();
let result = {result: "", con: ""};
let ana = () => {
document.querySelector(".yt-uix-button-toggled").classList.remove("yt-uix-button-toggled");
document.querySelector(`[data-page='${number}']`).classList.add("yt-uix-button-toggled");
};
if (document.querySelector(`.yt-pp[data-page='${number}']`)) {
commCount = number;
ana();
} else {
let abc = document.querySelector(".yt-uix-pager");
let bcd = document.querySelector(".yt-uix-button-toggled");
let def = document.createElement("a");
let ded = document.querySelector("#next-btn");
def.setAttribute("class", "yt-uix-button yt-uix-sessionlink yt-uix-pager-button yt-uix-button-toggled yt-uix-button-default yt-pp");
def.setAttribute("data-page", commCount);
def.setAttribute("onclick", "document.ciulinYT.load.comments(this.getAttribute('data-token'), this.getAttribute('data-page'))");
def.setAttribute("aria-label", `Go to page ${commCount}`);
def.setAttribute("data-token", continuation);
def.innerHTML = `<span class="yt-uix-button-content">${commCount}</span>`;
ded.setAttribute("data-page", commCount);
if (bcd) {
bcd.classList.remove("yt-uix-button-toggled");
}
abc.insertBefore(def, document.querySelector("#next-btn"));
}
for (let i = 0; i < collection.length; i++) {
if (collection[i].commentThreadRenderer) {
if (number == 0 || collection[i].commentThreadRenderer.renderingPriority !== "RENDERING_PRIORITY_PINNED_COMMENT"){
let ap = await document.ciulinYT.func.organizeCommentData(collection[i].commentThreadRenderer.comment.commentRenderer);
result.result += ap;
}
}
if (collection[i].continuationItemRenderer) {
commCount++;
document.querySelector("#next-btn").setAttribute("data-page", commCount);
document.querySelector("#next-btn").classList.remove("hid");
document.querySelector("#next-btn").setAttribute("data-token", collection[i].continuationItemRenderer.continuationEndpoint.continuationCommand.token);
result.con += `${collection[i].continuationItemRenderer.continuationEndpoint.continuationCommand.token}`;
}
}
document.querySelector(".comment-list" + dd).innerHTML = result.result;
stopLoad();
}
};
document.ciulinYT.func = {
buildPlayer: (videoId, time) => {
var ELEMENT = document.querySelector("#video-player");
var TEMP = document.createElement("div");
TEMP.setAttribute("class", "player");
ELEMENT.setAttribute("tabindex", 0);
ELEMENT.append(TEMP);
var DOM = ELEMENT.querySelector(".player");
(() => {
var DOM_menu = document.createElement("video-settings");
DOM_menu.setAttribute("class", "hid");
DOM_menu.setAttribute("data-state", "0");
DOM_menu.innerHTML = `<div class="playmenu-container"><a class="playmenu-text">YouTube Player Settings</a><div class="playmenu-content"></div><ul class="playmenu-buttons"><li class="playmenu-button selected" data-name="subtitles"></li><li class="playmenu-button" data-name="quality"></li><li class="playmenu-button" data-name="playback"></li><li class="playmenu-button" data-name="loop"></li><div class="playmenu-button_exit"><span>Close</span></div></ul></div>`;
DOM.appendChild(DOM_menu);
document.ciulinYT.load.settings_tab("subtitles");
})();
(() => {
var DOM_topBar = document.createElement("div");
DOM_topBar.setAttribute("class", "video-topbar");
DOM_topBar.innerHTML = `<div class="video-topbar-container"><div class="video-title"><span id="video-title-text">Hi</span></div></div>`;
DOM.appendChild(DOM_topBar);
})();
(() => {
var DOM_embedVideo = document.createElement("div");
DOM_embedVideo.setAttribute("class", "video-container");
DOM_embedVideo.innerHTML = `<div id="video-main-content"></div><div class="video-blank"></div>`;
DOM.appendChild(DOM_embedVideo);
})();
(() => {
var DOM_scrubBar = document.createElement("div");
DOM_scrubBar.setAttribute("class", "video-scrubbar");
DOM_scrubBar.setAttribute("role", "progressbar");
DOM_scrubBar.innerHTML = `<div class="seek-tooltip hid" id="seek-tooltip"></div><span class="scrubbar_track_played"></span><span class="scrubbar_track_handle"></span>`;
DOM.appendChild(DOM_scrubBar);
})();
(() => {
var DOM_playBar = document.createElement("div");
DOM_playBar.setAttribute("class", "video-playbar");
DOM_playBar.innerHTML = `<ul class="playbar-controls left">
<li class="playbar-controls_icon playbar-controls_play" data-state="0">
<i class="playbar-icon playbar-icon_play"></i>
</li><div class="playbar-volume_container" data-name="volume" data-type="tooltip" data-tooltip="${localizeString("player.mute")}">
<li class="playbar-controls_icon playbar-controls_volume" data-state="3">
<i class="playbar-icon playbar-icon_volume"></i>
</li>
<div class="playbar-volume-container volume-movable">
<div class="playbar-volume-slider volume-movable" role="progressbar" aria-valuemin="0" aria-valuemax="100">
<span class="playbar-volume playbar-volume-played volume-movable"></span>
<span class="playbar-volume playbar-volume-notplayed volume-movable"></span>
<span class="playbar-volume-handle volume-movable"></span>
</div>
</div>
</div>
</ul>
<div class="playbar-timestamp_container">
<span class="playbar-timestamp">
<a id="timestamp_current">0:00</a> / <a id="timestamp_total">9:99</a>
</span>
</div>
<ul class="playbar-controls right">
<li class="playbar-controls_icon playbar-controls_cc">
<i class="playbar-icon playbar-icon_cc"></i>
</li><li class="playbar-controls_icon playbar-controls_settings" data-name="settings" data-type="tooltip" data-tooltip="${localizeString("player.quality")}">
<i class="playbar-icon playbar-icon_settings"></i>
</li><li class="playbar-controls_icon playbar-controls_watchlater" data-name="watchlater" data-type="tooltip" data-tooltip="${localizeString("personal.watchlater")}">
<i class="playbar-icon playbar-icon_watchlater"></i>
</li><li class="playbar-controls_icon playbar-controls_fullscreen" data-name="fullscreen" data-state="0" data-type="tooltip" data-tooltip="${localizeString("player.fullscreen")}">
<i class="playbar-icon playbar-icon_fullscreen"></i>
</li>
</ul>`;
DOM.appendChild(DOM_playBar);
})();
(() => {
var a = document.createElement("style");
a.setAttribute("class", "player-style");
let script = `body {margin:0}
* {
--lld: linear-gradient(0deg, rgba(10,10,10,1) 0%, rgba(39,39,39,1) 100%);
--lll: linear-gradient(0deg, rgba(29,29,29,1) 0%, rgba(49,49,49,1) 100%);
--llr: linear-gradient(0deg, rgba(9,9,9,1) 0%, rgba(29,29,29,1) 100%);
--llRED: linear-gradient(0deg, rgba(195,0,0,1) 0%, rgba(108,0,0,1) 100%);
--texture-playbar: url(${document.ciulinYT.data.playerSheetB}) no-repeat;
}
.playmenu-container {
display: none;
}
#video-player {
display: block;
width: 640px;
height: 390px;
background-color: black;
}
#video-player .player {
width: inherit;
height: inherit;
}
#video-player .video-topbar {
width: inherit;
overflow: hidden;
position: absolute;
z-index: 1;
height: 28px;
user-select: none;
}
#video-player:hover .video-topbar-container {
top: 0px;
transition: top 0s ease-in;
}
#video-player .video-topbar-container {
background: linear-gradient(0deg, rgba(31,31,31,0) 0%, rgba(31,31,31,1) 100%);
width: inherit;
top: -28px;
transition: top 1s ease-out;
position: absolute;
}
#video-player .video-title {
float: left;
padding: 8px 13px;
color: white;
}
#video-player .video-topbar-buttons {
display: flex;
height: 25px;
line-height: 25px;
overflow: hidden;
position: relative;
user-select: none;
border-top: 1px solid #484646;
border-bottom: 1px solid #0b0b0b;
background: var(--lld);
z-index: 3;
}
#video-player .video-container {
height: 359px;
width: inherit;
position: relative;
z-index: 0;
}
#video-player:fullscreen .video-container {
height: 97%;
}
#video-player:fullscreen #video-main-content {
height: 100%;
}
#video-player #video-main-content {
position: relative;
z-index: -1;
width: inherit;
}
#video-player .video-blank {
width: 100%;
height: 100%;
background-color: black;
position: absolute;
top: 0;
z-index: -1;
}
#video-player .video-scrubbar {
z-index: 4;
background-color: #222;
position: relative;
cursor: pointer;
height: 3px;
user-select: none;
border-bottom: 1px solid black;
border-top: 1px solid #323232;
}
#video-player:hover .video-scrubbar {
height: 7px;
margin-top: -4px;
position: relative;
transition: 0.1s;
}
#video-player:hover .video-scrubbar .scrubbar_track_played {
max-height: 7px;
transition: max-height 0s;
}
#video-player:hover .video-scrubbar .scrubbar_track_handle {
transform: scale(1);
opacity: 1;
transition: transform 0s, opacity 0s;
}
#video-player .scrubbar_track_played {
max-height: 3px;
background: var(--llRED);
position: absolute;
top: 0;
left: 0;
bottom: 0;