-
Notifications
You must be signed in to change notification settings - Fork 43
/
Copy pathyoutube_script.js
2000 lines (1833 loc) · 72.1 KB
/
youtube_script.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 Youtube Tools All in one local download mp3 mp4 HIGT QUALITY return dislikes and more
// @name:zh-TW Youtube 工具 多合一本地下載 MP4、MP3
// @name:zh-HK Youtube 工具 多合一本地下載 MP4、MP3
// @name:zh-CN Youtube 工具 多合一本地下載 MP4、MP3
// @name:ja Youtube ツール オールインワンのローカル ダウンロード MP4、MP3
// @name:kr Youtube 도구 올인원 로컬 다운로드 외부 서비스 없이 MP4, MP3
// @name:ar Youtube Tools All in one local download mp3 mp4 HIGT QUALITY return dislikes and more
// @name:bg Youtube-Tools Alles in einem lokalen Download von MP4, MP3.
// @name:cs Nástroje YouTube Vše v jednom místní Stahujte MP4, MP3
// @name:da Youtube-værktøjer Alt i én lokal Download MP4, MP3
// @name:de Youtube-Tools Alles in einem lokalen Download von MP4, MP3
// @name:tel Youtube టూల్స్ అన్నీ ఒకే లోకల్ డౌన్లోడ్ MP4, Mp3
// @name:es Youtube Custom Todo en uno Descarga local MP4, MP3.
// @name:en Youtube Tools All in one local download mp3 mp4.
// @name:fr Outils Youtube Tout-en-un local Téléchargez MP4, MP3.
// @name:fr-CA Outils Youtube Tout-en-un local Téléchargez MP4, MP3.
// @name:he כלים של YouTube הכל במקום אחד מקומי הורדה MP4, MP3 באיכות גבוהה ללא שירות חיצוני ועוד.
// @name:hu Youtube Eszközök Minden egy helyen Letöltés MP4, MP3.
// @name:id Alat Youtube Semua dalam satu lokal Unduh MP4, MP3.
// @name:it Strumenti Youtube Tutto in uno Scarica locale MP4, MP3.
// @name:ko Youtube 도구 올인원 로컬 외부 서비스 없이 MP4, MP3
// @name:nb Youtube-verktøy Alt i ett lokalt Last ned MP4, MP3
// @name:nl Youtube Tools Alles in één lokaal Download MP4, MP3
// @name:pl Narzędzia YouTube Wszystko w jednym lokalnym. Pobierz MP4, MP3
// @name:pt-BR Ferramentas do Youtube Tudo em um local Baixe MP4, MP3 DE ALTA QUALIDAD.
// @name:ro YInstrumente Youtube Toate într-un singur local Descărcați MP4, MP3.
// @name:ru Инструменты Youtube Все в одном локальном формате. Загрузите MP4, MP3.
// @name:sk Nástroje YouTube Všetko v jednom miestne Stiahnite si MP4, MP3
// @name:sr Иоутубе алати Све у једном локалном Преузми МП4, МП3
// @name:sv Youtube-verktyg Allt i ett lokalt Ladda ner MP4, MP3
// @name:th เครื่องมือ Youtube ทั้งหมดในที่เดียว ดาวน์โหลด MP4, MP3
// @name:tr Youtube Araçları Hepsi bir arada yerel Harici hizmet olmadan MP4, MP3
// @name:uk Інструменти Youtube Все в одному локальному завантаженні MP4, MP3
// @name:ug Youtube قوراللىرى ھەممىسى بىر يەرلىك چۈشۈرۈش MP4,mp3
// @name:vi Công cụ Youtube Tất cả trong một cục bộ Tải xuống MP4, MP3
// @description:zh-TW Youtube 工具 多合一本地下載 mp4、MP3
// @description:zh-HK Youtube 工具 多合一本地下載 mp4、MP3
// @description:zh-CN Youtube 工具 多合一本地下載 mp4、MP3
// @description:ja Youtube ツール オールインワン ローカル ダウンロード mp4、MP3 、
// @description:kr Youtube 도구 올인원 로컬 다운로드 mp4, MP3
// @description:ar Herramientas de YouTube Todo en uno Descarga local mp4, MP3
// @description:bg Инструменти за Youtube Всичко в едно локално изтегляне mp4,
// @description:cs Nástroje YouTube Vše v jednom místní Stahování mp4, MP3
// @description:da Youtube-værktøjer Alt i ét lokalt Download mp4, MP3
// @description:de YouTube-Tools Alles in einem lokalen Laden Sie MP4, MP3
// @description:tel Youtube Tools All in one local Download mp4, MP3 HIGT QUALITY,
// @description:es Youtube tools todo en uno personlizada youtube a tu estilo y descarga MP4 y MP3
// @description:fr Outils Youtube Tout-en-un local Téléchargez des mp4, des MP3
// @description:fr-CA Outils Youtube Tout-en-un local Téléchargez des mp4, des MP3
// @description:he כלים של YouTube הכל במקום אחד מקומי הורד mp4, MP3
// @description:hu Youtube Eszközök Minden egyben helyi Letöltés mp4, MP3
// @description:id Alat Youtube Semua dalam satu lokal Unduh mp4, MP3
// @description:it Strumenti Youtube Tutto in uno locale Scarica mp4, MP3
// @description:ko Youtube 도구 올인원 로컬 다운로드 mp4, MP3
// @description:nb YoYoutube-verktøy Alt i ett lokalt Last ned mp4, MP3
// @description:nl YouTube-tools Alles in één lokaal Download mp4, MP3
// @description:pl Narzędzia Youtube Wszystko w jednym miejscu Pobierz mp4, MP3
// @description:pt-BR Ferramentas do YouTube Tudo em um só local Baixe mp4, MP3
// @description:ro Instrumente Youtube Toate într-un singur local Descărcați mp4, MP3
// @description:ru Инструменты Youtube Все в одном, локально. Загрузите mp4, MP3
// @description:sk Nástroje YouTube Všetko v jednom miestnom Sťahujte mp4, MP3
// @description:sr Иоутубе алати Све у једном локалном Преузми мп4, МП3
// @description:sv Youtube-verktyg Allt i ett lokalt Ladda ner mp4, MP3
// @description:th เครื่องมือ Youtube ทั้งหมดในที่เดียว ดาวน์โหลด mp4, MP3
// @description:tr Youtube Araçları Hepsi bir arada yerel Harici hizmet olmadan mp4, MP3
// @description:uk Інструменти Youtube Все в одному локальному завантаженні mp4, MP3
// @description:ug Youtube قورالىنىڭ ھەممىسى بىر يەرلىك چۈشۈرۈشتە mp4, MP3 HIGH QUAقنى قا
// @description:vi Công cụ Youtube Tất cả trong một cục bộ Tải xuống mp4, MP3
// @description:en Youtube Tools All in one local Download mp4, MP3 HIGT QUALITY
// @description Youtube Tools All in one local Download mp4, MP3 HIGT QUALITY
// @homepage https://github.com/DeveloperMDCM/
// @version 2.2.50
// @author MDCM
// @match https://*.youtube.com/*
// @exclude *://music.youtube.com/*
// @exclude *://*.music.youtube.com/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=youtube.com
// @grant GM_info
// @grant GM_setValue
// @grant GM_getValue
// @grant unsafeWindow
// @run-at document-end
// @compatible chrome
// @compatible firefox
// @compatible opera
// @compatible safari
// @compatible edge
// @compatible brave
// @license MIT
// @namespace https://github.com/DeveloperMDCM/
// ==/UserScript==
// update 10/08/2024 🟢 FIXED
// I am updating the script for PC and mobile, new update very soon
(function () {
// Youtube tools by: DeveloperMDCM
// https://github.com/DeveloperMDCM/Youtube-tools-extension
'use strict';
function paramsVideoURL() {
const parametrosURL = new URLSearchParams(window.location.search); // Url parametros
return parametrosURL.get('v');
}
function cargarScript() {
console.log('Scrip en ejecución by: DeveloperMDCM MDCM');
const HEADER_STYLE =
'color: #F00; font-size: 24px; font-family: sans-serif;';
const MESSAGE_STYLE =
'color: #00aaff; font-size: 16px; font-family: sans-serif;';
const CODE_STYLE = 'font-size: 14px; font-family: monospace;';
console.log(
'%cYoutube Tools Extension\n' +
'%cRun %c(v2.2.50)\n' +
'By: DeveloperMDCM.',
HEADER_STYLE,
CODE_STYLE,
MESSAGE_STYLE
);
let ad = true;
const stylesCss = `
<style>
/* For Chrome or Safari */
progress::-webkit-progress-bar {
background-color: #ff0000;
;
}
.content_collapsible_colors {
display: none;
overflow: hidden;
background-color: #3f3f3f;
}
progress::-webkit-progress-value {
background-color: #06d406;
}
.clasic-mode-short svg{
background-color: #272727;
padding: 13px;
border-radius: 50%;
margin-bottom: 10px;
color: #fff;
cursor: pointer;
}
.clasic-mode-short svg:hover{
background-color: #252525
}
/* For Firefox */
progress {
background-color: #ff0000;
border: none;
}
progress::-moz-progress-bar {
background-color: #06d406;
}
.barralikes {
display: flex;
justify-content: center;
align-items: center;
}
</style>
<meta http-equiv="Expires" content="0">
<meta http-equiv="Last-Modified" content="0">
<meta http-equiv="Cache-Control" content="no-cache, mustrevalidate">
<meta http-equiv="Pragma" content="no-cache">
<style>
.mdcm:hover {
cursor: pointer;
background-color: #6b6b6b;
}
.hidden {
display: none;
}
.mdcm {
font-size: 10px;
background-color: #595959;
border: none;
color: #fbf4f4 !important;
padding: 3px 0;
margin-left: 10px;
width: 70px;
border-radius: 10px;
}
.btn_download {
font-size: 1.2rem;
padding: 3px;
color: #fff;
border-radius: 5px;
background-color: #ec3203;
}
#subscribe-button>ytd-subscribe-button-renderer>yt-button-shape>button:hover {
zoom: 0.9;
}
.containerButtons {
position: relative;
display: flex;
justify-content: center;
flex-wrap: wrap;
align-items: center;
user-select: none;
border-radius: 20px;
margin: 0 auto;
padding: 4px;
}
.containerButtons button,
input {
display: flex;
flex-direction: column-reverse;
margin: 0 5px;
align-items: center;
cursor: pointer;
border-radius: 10px;
}
.containerButtons h1,
h2 {
user-select: none;
}
#MDCM {
animation: mdcm 10s infinite alternate;
position: relative;
transition: 4s;
}
.containerButtons button .containerButtons button svg {
width: 50px;
height: 40px;
}
.content_collapsible_colors {
position: relative;
width: 300px;
margin: auto;
padding: 10px;
border-radius: 20px;
}
.content_collapsible_colors h2 {
color: #fff !important;
}
.content_collapsible_colors div{
display: flex;
justify-content: space-between;
align-items: center;
}
.colors_buttons_collpases {
opacity: 0;
position: absolute;
height: 24px;
bottom: 0;
top: 0;
left: 10%;
margin-left: 2px;
width: 40px;
}
#eyes {
opacity: 0;
position: absolute;
height: 24px;
bottom: 0;
top: 0;
width: 24px;
}
/* width */
::-webkit-scrollbar {
width: 4px;
height: 10px;
}
/* Track */
::-webkit-scrollbar-track {
background: ##d5d5d5;
}
/* Handle */
::-webkit-scrollbar-thumb {
background: #000;
}
.containerall {
width: 100%;
display: flex;
align-items: center;
justify-content: center;
}
.container .botoncalidades {
margin: 3px 2px;
width: 24.6%;
}
.botoncalidades:first-child {
background-color: #0af;
}
.botoncalidades:last-child {
background-color: red;
width: 100px;
}
.selectcalidades,
.botoncalidades,
.selectcalidadesaudio {
width: 50%;
height: 27.8px;
background-color: #fff;
color: #000;
font-size: 25px;
text-align: center;
border: none;
font-size: 20px;
margin: 2px 2px;
}
.botoncalidades {
width: 70px;
height: 30px;
background-color: rgb(4, 156, 22);
border: 0px solid #000;
color: #fff;
font-size: 20px;
border-radius: 10px;
margin: 2px 2px;
}
.botoncalidades:hover,
.bntcontainer:hover {
cursor: pointer;
}
.ocultarframe,
.ocultarframeaudio {
display: none;
}
.progress-button:hover {
background-color: #000;
}
.progress-button {
display: inline-block;
font-size: 1em;
color: #fff;
text-decoration: none;
line-height: 1;
overflow: hidden;
position: relative;
text-align: center;
width: 100%;
height: 100%;
box-shadow: 0 1px 1px #ccc;
border-radius: 2px;
cursor: pointer;
background-color: #000;
}
#downloadButton:hover .progress-button {
filter: brightness(95%);
}
.progress-button.in-progress,
.progress-button.finished {
color: red;
}
.progress-button.in-progress:after,
.progress-button.finished:after {
position: absolute;
z-index: 2;
width: 100%;
height: 100%;
text-align: center;
top: 0;
padding-top: inherit;
color: #fff;
left: 0;
}
.progress-button.in-progress:after {
content: attr(data-loading);
}
.progress-button.finished:after {
content: attr(data-finished);
}
.progress-button .tz-bar {
background-color: #f00;
height: 3px;
bottom: 0;
left: 0;
width: 0;
position: absolute;
z-index: 1;
border-radius: 0 0 2px 2px;
-webkit-transition: width 0.5s, height 0.5s;
-moz-transition: width 0.5s, height 0.5s;
transition: width 0.5s, height 0.5s;
}
.progress-button .tz-bar.background-horizontal {
height: 100%;
border-radius: 2px;
}
.progress-button .tz-bar.background-vertical {
height: 0;
top: 0;
width: 100%;
border-radius: 2px;
}
.buttonTitle {
font-size: 0.5em;
margin-top: 4px;
}
#containerbutton {
height: 100px;
text-align: center;
}
#containerbutton:before {
content: '';
display: inline-block;
vertical-align: middle;
height: 100%;
}
#percentageText {
width: 95%;
display: inline-block;
position: relative;
vertical-align: middle;
z-index: 3;
}
.headerbutton {
position: fixed;
top: 0;
z-index: 1;
width: 100%;
background-color: #f1f1f1;
}
.progress-containerbutton {
width: 99%;
height: 20px;
background: #3e3e3c;
}
.progress-bar {
height: 20px;
background: #f00;
width: 0%;
}
.grecaptcha-badge {
visibility: hidden;
}
button {
margin: 0;
padding: 0;
}
button:hover {
color: #ec3203;
}
.botones_div {
background-color: transparent;
border: none;
color: #999999;
}
#close_menu_colors {
color: white;
background-color: red;
padding: 5px 4px;
border-radius: 10px;
display: flex;
justify-content: center;
margin: 10px 0;
width: 30px;
}
</style>
`;
const button_colors_collapsible = `
<button type="button" title="settings colors" class="collapsible botones_div collapsible_colors">
<svg width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M19 3h-4a2 2 0 0 0 -2 2v12a4 4 0 0 0 8 0v-12a2 2 0 0 0 -2 -2" /><path d="M13 7.35l-2 -2a2 2 0 0 0 -2.828 0l-2.828 2.828a2 2 0 0 0 0 2.828l9 9" /><path d="M7.3 13h-2.3a2 2 0 0 0 -2 2v4a2 2 0 0 0 2 2h12" /><path d="M17 17l0 .01" /></svg>
</button>
`;
const thumbnailVideo = `
<button title="Image video" class="botones_div" type="button" id="imagen">
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-photo-down" width="24"
height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none"
stroke-linecap="round" stroke-linejoin="round">
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
<path d="M15 8h.01"></path>
<path d="M12.5 21h-6.5a3 3 0 0 1 -3 -3v-12a3 3 0 0 1 3 -3h12a3 3 0 0 1 3 3v6.5"></path>
<path d="M3 16l5 -5c.928 -.893 2.072 -.893 3 0l4 4"></path>
<path d="M14 14l1 -1c.653 -.629 1.413 -.815 2.13 -.559"></path>
<path d="M19 16v6"></path>
<path d="M22 19l-3 3l-3 -3"></path>
</svg>
</button>
`;
const modeReverse = `
<button title="Reverse" class="botones_div" type="button" id="invertir">
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-arrows-diff" width="24"
height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none"
stroke-linecap="round" stroke-linejoin="round">
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
<path d="M11 16h10"></path>
<path d="M11 16l4 4"></path>
<path d="M11 16l4 -4"></path>
<path d="M13 8h-10"></path>
<path d="M13 8l-4 4"></path>
<path d="M13 8l-4 -4"></path>
</svg>
</button>
`;
const filterEyes = `
<div style="position:relative; display:inline-block ">
<button title="Filter eyes" class="botones_div" type="button">
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-brightness-half"
width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor"
fill="none" stroke-linecap="round" stroke-linejoin="round">
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
<path d="M12 9a3 3 0 0 0 0 6v-6z"></path>
<path
d="M6 6h3.5l2.5 -2.5l2.5 2.5h3.5v3.5l2.5 2.5l-2.5 2.5v3.5h-3.5l-2.5 2.5l-2.5 -2.5h-3.5v-3.5l-2.5 -2.5l2.5 -2.5z">
</path>
</svg>
<input id="eyes" list="presetColors" type="color" value="#ffffff"></button>
<datalist id="presetColors">
<option value="#000000" />
<option value="#fbff00" />
<option value="#ff0000" />
<option value="#00ff00" />
<option value="#0000ff" />
</datalist>
</div>
<div id="ojosprotect"
style="position: fixed; pointer-events: none; width: 100%; height: 100%; left: 0px; top: 0px; opacity: 0.2; z-index: 10; display: block;">
</div>
`;
const resetButton = `
<button title="reset" class="botones_div" type="button" id="reset_button">
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-power" width="24"
height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none"
stroke-linecap="round" stroke-linejoin="round">
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
<path d="M7 6a7.75 7.75 0 1 0 10 0"></path>
<path d="M12 4l0 8"></path>
</svg>
</button>
`;
const repeatVideo = `
<button title="Repeat video" class="botones_div" type="button" id="repeatvideo">
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-repeat" width="24"
height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none"
stroke-linecap="round" stroke-linejoin="round">
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
<path d="M4 12v-3a3 3 0 0 1 3 -3h13m-3 -3l3 3l-3 3"></path>
<path d="M20 12v3a3 3 0 0 1 -3 3h-13m3 3l-3 -3l3 -3"></path>
</svg>
</button>
`;
const downloadMp4Mp3 = `
<button title="MP4" type="button" class="btn1 botones_div">
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-file-download"
width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none"
stroke-linecap="round" stroke-linejoin="round">
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
<path d="M14 3v4a1 1 0 0 0 1 1h4"></path>
<path d="M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z"></path>
<path d="M12 17v-6"></path>
<path d="M9.5 14.5l2.5 2.5l2.5 -2.5"></path>
</svg>
</button>
<button title="MP3" type="button" class="btn2 botones_div">
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-file-music" width="24"
height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none"
stroke-linecap="round" stroke-linejoin="round">
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
<path d="M14 3v4a1 1 0 0 0 1 1h4"></path>
<path d="M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z"></path>
<path d="M11 16m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"></path>
<path d="M12 16l0 -5l2 1"></path>
</svg>
</button>
<button title="Close" type="button" class="btn3 botones_div">
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-circle-x" width="24"
height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none"
stroke-linecap="round" stroke-linejoin="round">
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
<path d="M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0"></path>
<path d="M10 10l4 4m0 -4l-4 4"></path>
</svg>
</button>
`;
const donwloadExternal = `
<button title="External Download" type="button" class="external_link botones_div">
<svg class="icon icon-tabler icon-tabler-external-link" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
<path d="M12 6h-6a2 2 0 0 0 -2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2 -2v-6"></path>
<path d="M11 13l9 -9"></path>
<path d="M15 4h5v5"></path>
</svg>
</button>
`;
const viewExternalVideo = `
<button title="view External no cookie" type="button" class="view_external_link botones_div">
<svg width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M3 16m0 1a1 1 0 0 1 1 -1h3a1 1 0 0 1 1 1v3a1 1 0 0 1 -1 1h-3a1 1 0 0 1 -1 -1z" /><path d="M4 12v-6a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-6" /><path d="M12 8h4v4" /><path d="M16 8l-5 5" /></svg>
</button>
`;
const pictureToPicture = `
<button title="Picture to picture" type="button" class="video_picture_to_picture botones_div">
<svg width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M11 19h-6a2 2 0 0 1 -2 -2v-10a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v4" /><path d="M14 14m0 1a1 1 0 0 1 1 -1h5a1 1 0 0 1 1 1v3a1 1 0 0 1 -1 1h-5a1 1 0 0 1 -1 -1z" /></svg>
</button>
`;
const screenShot = `
<button title="Screenshot video" type="button" class="screenshot_video botones_div">
<svg width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M15 8h.01" /><path d="M6 13l2.644 -2.644a1.21 1.21 0 0 1 1.712 0l3.644 3.644" /><path d="M13 13l1.644 -1.644a1.21 1.21 0 0 1 1.712 0l1.644 1.644" /><path d="M4 8v-2a2 2 0 0 1 2 -2h2" /><path d="M4 16v2a2 2 0 0 0 2 2h2" /><path d="M16 4h2a2 2 0 0 1 2 2v2" /><path d="M16 20h2a2 2 0 0 0 2 -2v-2" /></svg>
</button>
`;
const checkUpdates = `
<button title="Check new updates" type="button" class="checked_updates botones_div">
<svg width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M20 11a8.1 8.1 0 0 0 -15.5 -2m-.5 -4v4h4" /><path d="M4 13a8.1 8.1 0 0 0 15.5 2m.5 4v-4h-4" /></svg>
</button>
`;
// Menu Buttons
const menuBotones = `
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
${stylesCss}
<body>
<div class="container">
<form>
<div class="containerButtons">
</div>
<div>
</div>
</form>
</div>
<div class="content_collapsible_colors" style="margin-top: 10px">
<div>
<h1 style="color: red;">Menu options</h1><button id="close_menu_colors" title="close" type="button">X</button>
</div>
<div style="display: flex; justify-content: between">
<label style=" margin-left: 2px;" for="background_image">
<h2>Background image:</h2>
</label>
<input style="width: 132px; margin: 5px 0;" class="colors_buttons_collpase" type="file" id="background_image" name="avatar" accept="image/png, image/jpeg" />
</div>
<div style="display: flex;">
<h2 style=" margin-left: 2px;">Background Color:</h2>
<button title="Text color" class="botones_div" type="button">
<input class="colors_buttons_collpase" id="color_bg" type="color" value="#000000"></button>
</div>
<div style="display: flex;">
<h2 style=" margin-left: 2px;">Primary Color:</h2>
<button title="Text color" class="botones_div" type="button">
<input class="colors_buttons_collpase" id="color_primary" type="color" value="#ffffff"></button>
</div>
<div style="display: flex; margin-top: 5px;">
<h2>Progress bar Color:</h2>
<button title="Text color" class="botones_div" type="button">
<input class="colors_buttons_collpase" id="color_progress_bar" type="color" value="#ffffff"></button>
</div>
<div style="display: flex; margin-top: 5px;">
<h2>Header color:</h2>
<button title="Text color" class="botones_div" type="button">
<input class="colors_buttons_collpase" id="color_header_background" type="color" value="#ffffff"></button>
</div>
<div style="display: flex; margin-top: 5px;">
<h2>Secondary Color:</h2>
<button title="Text color" class="botones_div" type="button">
<input class="colors_buttons_collpase" id="color_secondary" type="color" value="#ffffff"></button>
</div>
<div style="display: flex; margin-top: 5px;">
<h2>Icons color:</h2>
<button title="Text color" class="botones_div" type="button">
<input class="colors_buttons_collpase" id="color_icons_color" type="color" value="#ffffff"></button>
</div>
<div style="display: flex; margin-top: 5px;">
<h2>Menu Color:</h2>
<button title="Text color" class="botones_div" type="button">
<input class="colors_buttons_collpase" id="color_menu" type="color" value="#ffffff"></button>
</div>
<div style="display: flex; margin-top: 5px;">
<h2>Line color preview:</h2>
<button title="Text color" class="botones_div" type="button">
<input class="colors_buttons_collpase" id="color_line_preview" type="color" value="#ffffff"></button>
</div>
<div style="display: flex; margin-top: 5px;">
<h2>Time color preview:</h2>
<button title="Text color" class="botones_div" type="button">
<input class="colors_buttons_collpase" id="color_time_preview" type="color" value="#ffffff"></button>
</div>
</div>
<form class="formulariodescarga" action="">
<div class="containerall">
<select class="selectcalidades ocultarframe" required>
<option selected disabled>Calidad del video / Quality video</option>
<option value="360">360p Mp4</option>
<option value="480">480p Mp4</option>
<option value="720">720p HD Mp4 Default</option>
<option value="1080">1080p FULL HD Mp4</option>
<option value="4k">2160p 4K WEBM</option>
<option value="8k">4320p 8K WEBM</option>
</select>
<iframe id="descargando" style="z-index: 99; border: none; height: 27.4px; width: 50%;" class="containerall ocultarframe" src="" frameborder="0"></iframe>
</div>
</form>
<form class="formulariodescargaaudio" action="">
<div class="containerall">
<select class="selectcalidadesaudio ocultarframeaudio" required>
<option selected disabled>Calidad del Audio / Quality Audio</option>
<option value="flac">Audio FLAC UHQ</option>
<option value="wav">Audio WAV UHQ</option>
<option value="mp3">Audio MP3 Default</option>
<option value="m4a">Audio M4A</option>
<option value="aac">Audio AAC</option>
<option value="opus">Audio OPUS</option>
<option value="ogg">Audio OGG</option>
</select>
<iframe id="descargandomp3" style="z-index: 99; border: none; height: 27.4px; width: 50%;" class="containerall ocultarframeaudio" src="" frameborder="0"></iframe>
</iframe>
</div>
</form>
</body>
</html>
`;
let validoBotones = true;
const policy = window.trustedTypes?.createPolicy('default', {
createHTML: (input) => input,
});
function insertHTML(targetElement, htmlContent) {
if (policy) {
const trustedHTML = policy.createHTML(htmlContent);
targetElement.insertAdjacentHTML('beforebegin', trustedHTML);
} else {
targetElement.insertAdjacentHTML('beforebegin', htmlContent);
}
}
function inicializarColores() {
let coloresGuardados = localStorage.getItem('colores');
if (coloresGuardados) {
return JSON.parse(coloresGuardados);
} else {
return {
color_progress_bar: '#ff0000',
};
}
}
function obtenerColorPorId(colorId) {
let colores = inicializarColores();
return colores[colorId];
}
function guardarColores(colores) {
localStorage.setItem('colores', JSON.stringify(colores));
}
function applyStyles(isActive, color, styleProperty) {
const estilosGenerales = generarEstilosGenerales();
aplicarEstilos('estilos-combinados', estilosGenerales);
if (isActive) {
document.body.style.setProperty(styleProperty, color);
} else {
document.body.style.removeProperty(styleProperty);
}
}
// Función para verificar si una propiedad específica existe en el objeto colores almacenado en localStorage
function propiedadExiste(propiedad) {
// Obtener el objeto almacenado en localStorage
var colores = localStorage.getItem('colores');
if (colores !== null) {
var coloresObj = JSON.parse(colores);
return coloresObj.hasOwnProperty(propiedad);
} else {
return false;
}
}
let styles_colors = '';
function generarEstilosGenerales() {
styles_colors = `
:root {
--icons-color: ${obtenerColorPorId('color_icons_color')};
--progress-bar-video: ${obtenerColorPorId('color_progress_bar')};
--header-background-color: ${obtenerColorPorId('color_header_background')};
--time-duraction-color: ${obtenerColorPorId('color_time_preview')};
}
.yt-spec-button-shape-next--mono.yt-spec-button-shape-next--tonal {
color: var(--icons-color);
background-color: #7070718d;
}`;
// Styles conditionals
if (propiedadExiste('color_icons_color')) {
styles_colors += `
#logo-icon {
color: var(--icons-color);
}
.yt-spec-button-shape-next--overlay.yt-spec-button-shape-next--text {
color: var(--icons-color);
}
.ytd-topbar-menu-button-renderer #button.ytd-topbar-menu-button-renderer {
color: var(--icons-color);
}
.yt-spec-icon-badge-shape--style-overlay .yt-spec-icon-badge-shape__icon {
color: var(--icons-color);
}
.ytp-svg-fill {
fill: var(--icons-color);
}
#ytp-id-30,#ytp-id-17,#ytp-id-19,#ytp-id-20{
fill: var(--icons-color);
}
`;
}
if (propiedadExiste('color_progress_bar')) {
styles_colors += `
.ytp-swatch-background-color {
background-color: var(--progress-bar-video);
}
`;
}
if (propiedadExiste('color_header_background')) {
styles_colors += `
#background.ytd-masthead {
background-color: var(--header-background-color);
}
`;
}
if (propiedadExiste('color_time_preview')) {
styles_colors += `
.badge-shape-wiz--default.badge-shape-wiz--overlay {
color: var(--time-duraction-color);
}
`;
}
return styles_colors;
}
function aplicarEstilos(clase, estilos) {
let estiloExistente =
document.getElementById(clase) || document.createElement('style');
estiloExistente.id = clase;
estiloExistente.innerHTML = estilos;
if (!document.getElementById(clase)) {
document.head.appendChild(estiloExistente);
}
}
function actualizarColor(event) {
const estilosGenerales = generarEstilosGenerales();
aplicarEstilos('estilos-combinados', estilosGenerales);
var colores = inicializarColores();
var inputId = event.target.id;
var nuevoColor = event.target.value;
// Actualizar el color correspondiente en el objeto de colores
colores[inputId] = nuevoColor;
// color_bg
applyStyles(
propiedadExiste('color_bg'),
`${obtenerColorPorId('color_bg')}`,
'--yt-spec-base-background'
);
// primary color
applyStyles(
propiedadExiste('color_primary'),
`${obtenerColorPorId('color_primary')}`,
'--yt-spec-text-primary'
);
// Secondary color
applyStyles(
propiedadExiste('color_secondary'),
`${obtenerColorPorId('color_secondary')}`,
'--yt-spec-text-secondary'
);
// Icons color
applyStyles(
propiedadExiste('color_icons_color'),
`${obtenerColorPorId('color_icons_color')}`,
'--yt-spec-wordmark-text'
);
applyStyles(
propiedadExiste('color_icons_color'),
`${obtenerColorPorId('color_icons_color')}`,
'--yt-spec-brand-icon-inactive'
);
// Menu settings color
applyStyles(
propiedadExiste('color_menu'),
`${obtenerColorPorId('color_menu')}`,
'--yt-spec-menu-background'
);
// Line color previw
applyStyles(
propiedadExiste('color_line_preview'),
`${obtenerColorPorId('color_line_preview')}`,
'--yt-spec-static-brand-red'
);
// Time color previw
applyStyles(
propiedadExiste('color_time_preview'),
`${obtenerColorPorId('color_time_preview')}`,
'--yt-spec-static-brand-white'
);
applyStyles(
propiedadExiste('color_progress_bar'),
`${obtenerColorPorId('color_progress_bar')}`,
'--progress-bar-video'
);
applyStyles(
propiedadExiste('color_header_background'),
`${obtenerColorPorId('color_header_background')}`,
'--header-background-color'
);
// Guardar el objeto de colores actualizado en localStorage
guardarColores(colores);