@oxymoron.13/tizentube-s95b 0.2.2 → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/README.md +49 -42
  2. package/S95B-CHANGES.txt +10 -4
  3. package/UPSTREAM-README.md +42 -0
  4. package/dist/userScript.js +2 -2
  5. package/mods/config.js +117 -0
  6. package/mods/domrect-polyfill.js +104 -0
  7. package/mods/features/adblock.js +584 -0
  8. package/mods/features/autoFrameRate.js +42 -0
  9. package/mods/features/enableFeatures.js +19 -0
  10. package/mods/features/moreSubtitles.js +378 -0
  11. package/mods/features/pictureInPicture.js +198 -0
  12. package/mods/features/preferredVideoQuality.js +101 -0
  13. package/mods/features/s95bCodec.js +45 -0
  14. package/mods/features/s95bI18n.js +28 -0
  15. package/mods/features/s95bMenu.js +142 -0
  16. package/mods/features/sponsorblock.js +437 -0
  17. package/mods/features/standaloneUserscript.js +107 -0
  18. package/mods/features/updater.js +119 -0
  19. package/mods/features/userAgentSpoofing.js +73 -0
  20. package/mods/features/videoQueuing.js +64 -0
  21. package/mods/package-lock.json +2321 -0
  22. package/mods/package.json +33 -0
  23. package/mods/resolveCommand.js +376 -0
  24. package/mods/rollup.config.js +41 -0
  25. package/mods/spatial-navigation-polyfill.js +1756 -0
  26. package/mods/tiny-sha256.js +99 -0
  27. package/mods/translations/i18nResources.js +11 -0
  28. package/mods/translations/index.js +18 -0
  29. package/mods/translations/language-names.js +981 -0
  30. package/mods/translations/resources/ar.json +308 -0
  31. package/mods/translations/resources/az.json +308 -0
  32. package/mods/translations/resources/bs.json +308 -0
  33. package/mods/translations/resources/cs.json +308 -0
  34. package/mods/translations/resources/de.json +308 -0
  35. package/mods/translations/resources/dk.json +308 -0
  36. package/mods/translations/resources/el.json +308 -0
  37. package/mods/translations/resources/en.json +308 -0
  38. package/mods/translations/resources/es-419.json +308 -0
  39. package/mods/translations/resources/es.json +308 -0
  40. package/mods/translations/resources/fi-FI.json +308 -0
  41. package/mods/translations/resources/fr.json +311 -0
  42. package/mods/translations/resources/hr.json +308 -0
  43. package/mods/translations/resources/hu.json +308 -0
  44. package/mods/translations/resources/id.json +308 -0
  45. package/mods/translations/resources/it.json +308 -0
  46. package/mods/translations/resources/ja.json +308 -0
  47. package/mods/translations/resources/lt.json +308 -0
  48. package/mods/translations/resources/lv.json +308 -0
  49. package/mods/translations/resources/pl.json +308 -0
  50. package/mods/translations/resources/pt-BR.json +308 -0
  51. package/mods/translations/resources/pt-PT.json +308 -0
  52. package/mods/translations/resources/ro.json +310 -0
  53. package/mods/translations/resources/ru.json +308 -0
  54. package/mods/translations/resources/sr-Cyrl.json +308 -0
  55. package/mods/translations/resources/sr-Latn.json +308 -0
  56. package/mods/translations/resources/tlh.json +308 -0
  57. package/mods/translations/resources/tr.json +308 -0
  58. package/mods/translations/resources/uk.json +308 -0
  59. package/mods/translations/resources/vi.json +309 -0
  60. package/mods/translations/resources/zh-CN.json +308 -0
  61. package/mods/translations/resources/zh-TW.json +308 -0
  62. package/mods/translations/update-translations.js +55 -0
  63. package/mods/ui/chapters.js +137 -0
  64. package/mods/ui/clock.js +71 -0
  65. package/mods/ui/customCommandExecution.js +49 -0
  66. package/mods/ui/customGuideAction.js +119 -0
  67. package/mods/ui/customUI.js +192 -0
  68. package/mods/ui/customYTSettings.js +29 -0
  69. package/mods/ui/disableWhosWatching.js +48 -0
  70. package/mods/ui/settings.js +1024 -0
  71. package/mods/ui/sidebarModification.js +179 -0
  72. package/mods/ui/speedUI.js +119 -0
  73. package/mods/ui/theme.js +26 -0
  74. package/mods/ui/ui.css +157 -0
  75. package/mods/ui/ui.js +261 -0
  76. package/mods/ui/ytUI.js +510 -0
  77. package/mods/userScript.js +28 -0
  78. package/mods/utils/ASTParser.js +67 -0
  79. package/mods/utils/innerTubeCalls.js +138 -0
  80. package/package.json +11 -5
  81. package/service/package-lock.json +4193 -0
  82. package/service/package.json +29 -0
  83. package/service/rollup.config.js +47 -0
  84. package/service/service.js +118 -0
@@ -0,0 +1,1024 @@
1
+ import { configRead } from '../config.js';
2
+ import { showModal, buttonItem, overlayPanelItemListRenderer, scrollPaneRenderer, overlayMessageRenderer, QrCodeRenderer } from './ytUI.js';
3
+ import qrcode from 'qrcode-npm';
4
+ import { t } from 'i18next';
5
+ import resolveCommand from '../resolveCommand.js';
6
+
7
+ const qrcodes = {};
8
+
9
+ export default function modernUI(update, parameters) {
10
+ const settings = [
11
+ {
12
+ name: t('settings.supportTT.title'),
13
+ icon: 'MONEY_HEART',
14
+ value: null,
15
+ options: {
16
+ title: t('settings.supportTT.title'),
17
+ subtitle: t('settings.supportTT.subtitle'),
18
+ content: scrollPaneRenderer([
19
+ overlayMessageRenderer(t('settings.supportTT.content.1')),
20
+ overlayMessageRenderer(t('settings.supportTT.content.2')),
21
+ overlayMessageRenderer(t('settings.supportTT.content.3')),
22
+ overlayMessageRenderer(t('settings.supportTT.content.4')),
23
+ overlayMessageRenderer(t('settings.supportTT.content.5')),
24
+ overlayMessageRenderer(t('settings.supportTT.content.6'))
25
+ ])
26
+ }
27
+ },
28
+ {
29
+ name: t('settings.options.socialMedia.title'),
30
+ icon: 'PRIVACY_UNLISTED',
31
+ value: null,
32
+ options: [
33
+ {
34
+ name: 'GitHub',
35
+ link: 'https://github.com/reisxd/TizenTube',
36
+ },
37
+ {
38
+ name: 'YouTube',
39
+ link: 'https://www.youtube.com/@tizenbrew',
40
+ },
41
+ {
42
+ name: 'Discord',
43
+ link: 'https://discord.gg/m2P7v8Y2qR',
44
+ },
45
+ {
46
+ name: `Telegram (${t('settings.options.socialMedia.announcements')})`,
47
+ link: 'https://t.me/tizentubecobaltofficial',
48
+ },
49
+ {
50
+ name: `Telegram (${t('settings.options.socialMedia.group')})`,
51
+ link: 'https://t.me/tizentubeofficial',
52
+ },
53
+ {
54
+ name: t('settings.options.socialMedia.website'),
55
+ link: 'https://tizentube.6513006.xyz',
56
+ },
57
+ {
58
+ name: 'Buy Me A Coffee',
59
+ link: 'https://www.buymeacoffee.com/reisxd',
60
+ },
61
+ {
62
+ name: t('settings.options.socialMedia.githubSponsors'),
63
+ link: 'https://github.com/sponsors/reisxd',
64
+ }
65
+ ].map((option) => {
66
+ if (!qrcodes[option.name]) {
67
+ const qr = qrcode.qrcode(6, 'H');
68
+ qr.addData(option.link);
69
+ qr.make();
70
+
71
+ const qrDataImgTag = qr.createImgTag(8, 8);
72
+ const qrDataUrl = qrDataImgTag.match(/src="([^"]+)"/)[1];
73
+ qrcodes[option.name] = qrDataUrl;
74
+ }
75
+ return {
76
+ name: option.name,
77
+ icon: 'OPEN_IN_NEW',
78
+ value: null,
79
+ options: {
80
+ title: option.name,
81
+ subtitle: option.link,
82
+ content: overlayPanelItemListRenderer([
83
+ overlayMessageRenderer(t('settings.options.socialMedia.qrCodeScanMessage', { name: option.name })),
84
+ QrCodeRenderer(qrcodes[option.name])
85
+ ])
86
+ }
87
+ }
88
+ })
89
+ },
90
+ {
91
+ name: t('settings.options.adBlock'),
92
+ icon: 'DOLLAR_SIGN',
93
+ value: 'enableAdBlock'
94
+ },
95
+ {
96
+ name: t('settings.options.sponsorblock.title'),
97
+ icon: 'MONEY_HAND',
98
+ value: null,
99
+ menuId: 'tt-sponsorblock-settings',
100
+ menuHeader: {
101
+ title: t('settings.options.sponsorblock.title'),
102
+ subtitle: 'https://sponsor.ajay.app/'
103
+ },
104
+ options: [
105
+ {
106
+ name: t('settings.options.sponsorblock.options.enableSB'),
107
+ icon: 'MONEY_HAND',
108
+ value: 'enableSponsorBlock'
109
+ },
110
+ {
111
+ name: t('settings.options.sponsorblock.options.manualSkip'),
112
+ icon: 'DOLLAR_SIGN',
113
+ value: null,
114
+ arrayToEdit: 'sponsorBlockManualSkips',
115
+ menuId: 'tt-sponsorblock-manual-segment-skip',
116
+ options: [
117
+ {
118
+ name: t('settings.options.sponsorblock.options.categories.sponsor'),
119
+ icon: 'MONEY_HEART',
120
+ value: 'sponsor'
121
+ },
122
+ {
123
+ name: t('settings.options.sponsorblock.options.categories.intro'),
124
+ icon: 'PLAY_CIRCLE',
125
+ value: 'intro'
126
+ },
127
+ {
128
+ name: t('settings.options.sponsorblock.options.categories.outro'),
129
+ value: 'outro'
130
+ },
131
+ {
132
+ name: t('settings.options.sponsorblock.options.categories.interaction'),
133
+ value: 'interaction'
134
+ },
135
+ {
136
+ name: t('settings.options.sponsorblock.options.categories.selfpromo'),
137
+ value: 'selfpromo'
138
+ },
139
+ {
140
+ name: t('settings.options.sponsorblock.options.categories.preview'),
141
+ value: 'preview'
142
+ },
143
+ {
144
+ name: t('settings.options.sponsorblock.options.categories.filler'),
145
+ value: 'filler'
146
+ },
147
+ {
148
+ name: t('settings.options.sponsorblock.options.categories.music_offtopic'),
149
+ value: 'music_offtopic'
150
+ }
151
+ ]
152
+ },
153
+ {
154
+ name: t('settings.options.sponsorblock.options.segments'),
155
+ icon: 'SETTINGS',
156
+ value: null,
157
+ menuId: 'tt-sponsorblock-segments',
158
+ options: [
159
+ {
160
+ name: t('settings.options.sponsorblock.options.categories.sponsor'),
161
+ icon: 'MONEY_HEART',
162
+ value: 'enableSponsorBlockSponsor'
163
+ },
164
+ {
165
+ name: t('settings.options.sponsorblock.options.categories.intro'),
166
+ icon: 'PLAY_CIRCLE',
167
+ value: 'enableSponsorBlockIntro'
168
+ },
169
+ {
170
+ name: t('settings.options.sponsorblock.options.categories.outro'),
171
+ value: 'enableSponsorBlockOutro'
172
+ },
173
+ {
174
+ name: t('settings.options.sponsorblock.options.categories.interaction'),
175
+ value: 'enableSponsorBlockInteraction'
176
+ },
177
+ {
178
+ name: t('settings.options.sponsorblock.options.categories.selfpromo'),
179
+ value: 'enableSponsorBlockSelfPromo'
180
+ },
181
+ {
182
+ name: t('settings.options.sponsorblock.options.categories.preview'),
183
+ value: 'enableSponsorBlockPreview'
184
+ },
185
+ {
186
+ name: t('settings.options.sponsorblock.options.categories.filler'),
187
+ value: 'enableSponsorBlockFiller'
188
+ },
189
+ {
190
+ name: t('settings.options.sponsorblock.options.categories.music_offtopic'),
191
+ value: 'enableSponsorBlockMusicOfftopic'
192
+ },
193
+ {
194
+ name: t('settings.options.sponsorblock.options.categories.highlights'),
195
+ icon: 'LOCATION_POINT',
196
+ value: 'enableSponsorBlockHighlight'
197
+ }
198
+ ]
199
+ },
200
+ {
201
+ name: t('settings.options.sponsorblock.options.showSBToasts'),
202
+ value: 'enableSponsorBlockToasts'
203
+ }
204
+ ]
205
+ },
206
+ {
207
+ name: t('settings.options.dearrow.title'),
208
+ icon: 'VISIBILITY_OFF',
209
+ value: null,
210
+ menuHeader: {
211
+ title: t('settings.options.dearrow.title'),
212
+ subtitle: 'https://dearrow.ajay.app/'
213
+ },
214
+ options: [
215
+ {
216
+ name: t('settings.options.dearrow.options.enableDA'),
217
+
218
+ icon: 'VISIBILITY_OFF',
219
+ value: 'enableDeArrow'
220
+ },
221
+ {
222
+ name: t('settings.options.dearrow.options.enableDAThumbnails'),
223
+ icon: 'TV',
224
+ value: 'enableDeArrowThumbnails'
225
+ }
226
+ ]
227
+ },
228
+ {
229
+ name: t('settings.options.misc.title'),
230
+ icon: 'SETTINGS',
231
+ value: null,
232
+ options: [
233
+ {
234
+ name: t('settings.options.misc.options.endScreenCards'),
235
+
236
+ icon: 'VISIBILITY_OFF',
237
+ value: 'enableHideEndScreenCards'
238
+ },
239
+ {
240
+ name: t('settings.options.misc.options.youThereRenderer'),
241
+ icon: 'HELP',
242
+ value: 'enableYouThereRenderer'
243
+ },
244
+ {
245
+ name: t('settings.options.misc.options.paidPromoOverlay'),
246
+ icon: 'MONEY_HAND',
247
+ value: 'enablePaidPromotionOverlay'
248
+ },
249
+ {
250
+ name: t('settings.options.misc.options.whosWatching.title'),
251
+ icon: 'ACCOUNT_CIRCLE',
252
+ menuId: 'tt-whos-watching-menu-settings',
253
+ value: null,
254
+ options: [
255
+ {
256
+ name: t('settings.options.misc.options.whosWatching.options.enableWW'),
257
+ value: 'enableWhoIsWatchingMenu'
258
+ },
259
+ {
260
+ name: t('settings.options.misc.options.whosWatching.options.permaEnableWW'),
261
+ value: 'permanentlyEnableWhoIsWatchingMenu'
262
+ },
263
+ {
264
+ name: t('settings.options.misc.options.whosWatching.options.enableWWOnExit'),
265
+ value: 'enableWhosWatchingMenuOnAppExit'
266
+ }
267
+ ]
268
+ },
269
+ {
270
+ name: t('settings.options.misc.options.fixUI'),
271
+ icon: 'STAR',
272
+ value: 'enableFixedUI'
273
+ },
274
+ {
275
+ name: t('settings.options.misc.options.hqThumbnails'),
276
+ icon: 'VIDEO_QUALITY',
277
+ value: 'enableHqThumbnails'
278
+ },
279
+ /*{
280
+ name: 'Chapters',
281
+ icon: 'BOOKMARK_BORDER',
282
+ value: 'enableChapters'
283
+ },*/
284
+ {
285
+ name: t('settings.options.misc.options.longPress'),
286
+ value: 'enableLongPress'
287
+ },
288
+ {
289
+ name: t('settings.options.misc.options.shorts'),
290
+ icon: 'YOUTUBE_SHORTS_FILL_24',
291
+ value: 'enableShorts'
292
+ },
293
+ {
294
+ name: t('settings.options.misc.options.videoPreviews'),
295
+ value: 'enablePreviews'
296
+ },
297
+ {
298
+ name: t('settings.options.misc.options.ttWelcomeMsg'),
299
+ value: 'showWelcomeToast',
300
+ },
301
+ {
302
+ name: t('settings.options.misc.options.guestSignInReminder'),
303
+ value: 'enableSigninReminder'
304
+ },
305
+ {
306
+ name: t('settings.options.misc.options.reloadHomeOnStartup'),
307
+ value: 'reloadHomeOnStartup'
308
+ }
309
+ ]
310
+ },
311
+ {
312
+ name: t('settings.options.subtitles.title'),
313
+ icon: 'TRANSLATE',
314
+ value: null,
315
+ options: [
316
+ {
317
+ name: t('settings.options.subtitles.options.showLocalSubtitle'),
318
+ value: 'enableShowUserLanguage'
319
+ },
320
+ {
321
+ name: t('settings.options.subtitles.options.showHiddenSubtitles'),
322
+ value: 'enableShowOtherLanguages'
323
+ }
324
+ ]
325
+ },
326
+ {
327
+ name: t('settings.options.videoPlayer.title'),
328
+ icon: 'VIDEO_YOUTUBE',
329
+ value: null,
330
+ menuHeader: {
331
+ title: t('settings.options.videoPlayer.title'),
332
+ subtitle: t('settings.options.videoPlayer.subtitle')
333
+ },
334
+ options: [
335
+ {
336
+ name: t('settings.options.videoPlayer.options.patching.title'),
337
+ icon: 'SETTINGS',
338
+ value: null,
339
+ menuId: 'tt-video-player-ui-patching',
340
+ options: [
341
+ {
342
+ name: t('settings.options.videoPlayer.options.patching.options.enableVPUIPatching'),
343
+ icon: 'SETTINGS',
344
+ value: 'enablePatchingVideoPlayer'
345
+ },
346
+ {
347
+ name: t('settings.options.videoPlayer.options.patching.options.previousNextBtns'),
348
+ icon: 'SKIP_NEXT',
349
+ value: 'enablePreviousNextButtons'
350
+ },
351
+ {
352
+ name: t('settings.options.videoPlayer.options.patching.options.showSuperThxBtn'),
353
+ icon: 'MONEY_HEART',
354
+ value: 'enableSuperThanksButton'
355
+ },
356
+ {
357
+ name: t('settings.options.videoPlayer.options.patching.options.showAIAskBtn'),
358
+ icon: 'SPARK',
359
+ value: 'enableAIAskButton'
360
+ },
361
+ {
362
+ name: t('settings.options.videoPlayer.options.patching.options.showSpeedCtrlBtn'),
363
+ icon: 'SLOW_MOTION_VIDEO',
364
+ value: 'enableSpeedControlsButton'
365
+ },
366
+ {
367
+ name: t('settings.options.videoPlayer.options.patching.options.addMPBtn'),
368
+ icon: 'CLEAR_COOKIES',
369
+ value: 'enableMPButton'
370
+ },
371
+ {
372
+ name: t('settings.options.videoPlayer.options.patching.options.swapMPWithPIP'),
373
+ icon: 'CLEAR_COOKIES',
374
+ value: 'enableSwapMPWithPIP'
375
+ }
376
+ ]
377
+ },
378
+ {
379
+ name: t('settings.options.videoPlayer.options.preferredVideoQuality.title'),
380
+ icon: 'VIDEO_QUALITY',
381
+ value: null,
382
+ menuId: 'tt-preferred-video-quality',
383
+ menuHeader: {
384
+ title: t('settings.options.videoPlayer.options.preferredVideoQuality.title'),
385
+ subtitle: t('settings.options.videoPlayer.options.preferredVideoQuality.subtitle')
386
+ },
387
+ options:
388
+ ['Auto', '2160p', '1440p', '1080p', '720p', '480p', '360p', '240p', '144p'].map((quality) => {
389
+ return {
390
+ name: quality === 'Auto' ? t('settings.options.videoPlayer.options.qualityAuto') : quality,
391
+ key: 'preferredVideoQuality',
392
+ value: quality.toLowerCase()
393
+ }
394
+ })
395
+
396
+ },
397
+ {
398
+ name: t('settings.options.videoPlayer.options.speedSettings.title'),
399
+ icon: 'SLOW_MOTION_VIDEO',
400
+ value: null,
401
+ menuId: 'tt-speed-settings-increments',
402
+ menuHeader: {
403
+ title: t('settings.options.videoPlayer.options.speedSettings.title'),
404
+ subtitle: t('settings.options.videoPlayer.options.speedSettings.subtitle')
405
+ },
406
+ options: [0.05, 0.1, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4, 0.45, 0.5].map((increment) => {
407
+ return {
408
+ name: `${increment}x`,
409
+ key: 'speedSettingsIncrement',
410
+ value: increment
411
+ }
412
+ })
413
+ },
414
+ {
415
+ name: t('settings.options.videoPlayer.options.hideRelatedVideosPlayer'),
416
+ icon: 'VISIBILITY_OFF',
417
+ value: 'hideRelatedVideosPlayer'
418
+ },
419
+ {
420
+ name: t('settings.options.videoPlayer.options.preferredVideoCodec.title'),
421
+ icon: 'VIDEO_QUALITY',
422
+ value: null,
423
+ menuId: 'tt-preferred-video-codec',
424
+ menuHeader: {
425
+ title: t('settings.options.videoPlayer.options.preferredVideoCodec.title'),
426
+ subtitle: t('settings.options.videoPlayer.options.preferredVideoCodec.subtitle'),
427
+ },
428
+ options: ['any', 'vp9', 'av01', 'avc1'].map((codec) => {
429
+ return {
430
+ name: codec === 'any' ? t('settings.options.videoPlayer.options.codecAny') : codec.toUpperCase(),
431
+ key: 'preferredVideoCodec',
432
+ value: codec
433
+ }
434
+ })
435
+ },
436
+ window.h5vcc && window.h5vcc.tizentube && window.h5vcc.tizentube.SetFrameRate ? {
437
+ name: t('settings.options.videoPlayer.options.afr'),
438
+ icon: 'SLOW_MOTION_VIDEO',
439
+ value: 'autoFrameRate'
440
+ } : null,
441
+ window.h5vcc && window.h5vcc.tizentube && window.h5vcc.tizentube.SetFrameRate ? {
442
+ name: t('settings.options.videoPlayer.options.afrPauseDuration.title'),
443
+ icon: 'TIMER',
444
+ value: null,
445
+ menuId: 'tt-auto-frame-rate-pause-duration',
446
+ menuHeader: {
447
+ title: t('settings.options.videoPlayer.options.afrPauseDuration.title'),
448
+ subtitle: t('settings.options.videoPlayer.options.afrPauseDuration.subtitle')
449
+ },
450
+ options: [0, 0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5].map((seconds) => {
451
+ return {
452
+ name: t(seconds === 1 ? 'settings.options.time.second' : 'settings.options.time.seconds', { count: seconds }),
453
+ key: 'autoFrameRatePauseVideoFor',
454
+ value: seconds * 1000
455
+ }
456
+ })
457
+ } : null
458
+ ]
459
+ },
460
+ {
461
+ name: t('settings.options.uiSettings.title'),
462
+ icon: 'SETTINGS',
463
+ value: null,
464
+ menuHeader: {
465
+ title: t('settings.options.uiSettings.title'),
466
+ subtitle: t('settings.options.uiSettings.subtitle')
467
+ },
468
+ options: [
469
+ {
470
+ name: t('settings.options.uiSettings.options.hideWatchedVideos.title'),
471
+ icon: 'VISIBILITY_OFF',
472
+ value: null,
473
+ menuId: 'tt-hide-watched-videos-settings',
474
+ options: [
475
+ {
476
+ name: t('settings.options.uiSettings.options.hideWatchedVideos.options.enableHideWatchedVideos'),
477
+ icon: 'VISIBILITY_OFF',
478
+ value: 'enableHideWatchedVideos'
479
+ },
480
+ {
481
+ name: t('settings.options.uiSettings.options.hideWatchedVideos.options.watchedVideosThreshold.title'),
482
+ value: null,
483
+ menuId: 'tt-hide-watched-videos-threshold',
484
+ menuHeader: {
485
+ title: t('settings.options.uiSettings.options.hideWatchedVideos.options.watchedVideosThreshold.title'),
486
+ subtitle: t('settings.options.uiSettings.options.hideWatchedVideos.options.watchedVideosThreshold.subtitle')
487
+ },
488
+ options: [0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100].map((percent) => {
489
+ return {
490
+ name: `${percent}%`,
491
+ key: 'hideWatchedVideosThreshold',
492
+ value: percent
493
+ }
494
+ })
495
+ },
496
+ {
497
+ name: t('settings.options.uiSettings.options.hideWatchedVideos.options.setPagesToHideWatchedVideos'),
498
+ value: null,
499
+ arrayToEdit: 'hideWatchedVideosPages',
500
+ menuId: 'tt-hide-watched-videos-pages',
501
+ options: [
502
+ {
503
+ name: t('settings.options.uiSettings.options.categories.searchResults'),
504
+ value: 'search'
505
+ },
506
+ {
507
+ name: t('settings.options.uiSettings.options.categories.home'),
508
+ value: 'home'
509
+ },
510
+ {
511
+ name: t('settings.options.uiSettings.options.categories.music'),
512
+ value: 'music'
513
+ },
514
+ {
515
+ name: t('settings.options.uiSettings.options.categories.gaming'),
516
+ value: 'gaming'
517
+ },
518
+ {
519
+ name: t('settings.options.uiSettings.options.categories.subscriptions'),
520
+ value: 'subscriptions'
521
+ },
522
+ {
523
+ name: t('settings.options.uiSettings.options.categories.library'),
524
+ value: 'library'
525
+ },
526
+ {
527
+ name: t('settings.options.uiSettings.options.categories.more'),
528
+ value: 'more'
529
+ }
530
+ ]
531
+ }
532
+ ]
533
+ },
534
+ {
535
+ name: t('settings.options.uiSettings.options.screenDimming.title'),
536
+ icon: 'EYE_OFF',
537
+ value: null,
538
+ menuId: 'tt-screen-dimming-settings',
539
+ options: [
540
+ {
541
+ name: t('settings.options.uiSettings.options.screenDimming.options.enableScreenDimming'),
542
+ icon: 'EYE_OFF',
543
+ value: 'enableScreenDimming'
544
+ },
545
+ {
546
+ name: t('settings.options.uiSettings.options.screenDimming.options.dimmingTimeout.title'),
547
+ icon: 'TIMER',
548
+ value: null,
549
+ menuId: 'tt-dimming-timeout',
550
+ menuHeader: {
551
+ title: t('settings.options.uiSettings.options.screenDimming.options.dimmingTimeout.title'),
552
+ subtitle: t('settings.options.uiSettings.options.screenDimming.options.dimmingTimeout.subtitle')
553
+ },
554
+ options: [10, 20, 30, 60, 120, 180, 240, 300].map((seconds) => {
555
+ const title = seconds >= 60 ? t(`settings.options.time.minute${seconds / 60 > 1 ? 's' : ''}`, { count: seconds / 60 }) : t('settings.options.time.seconds', { count: seconds });
556
+ return {
557
+ name: title,
558
+ key: 'dimmingTimeout',
559
+ value: seconds
560
+ }
561
+ })
562
+ },
563
+ {
564
+ name: t('settings.options.uiSettings.options.screenDimming.options.dimmingOpacity.title'),
565
+ icon: 'LENS_BLUE',
566
+ value: null,
567
+ menuId: 'tt-dimming-opacity',
568
+ menuHeader: {
569
+ title: t('settings.options.uiSettings.options.screenDimming.options.dimmingOpacity.title'),
570
+ subtitle: t('settings.options.uiSettings.options.screenDimming.options.dimmingOpacity.subtitle')
571
+ },
572
+ options: [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0].map((opacity) => {
573
+ return {
574
+ name: `${Math.round(opacity * 100)}%`,
575
+ key: 'dimmingOpacity',
576
+ value: opacity
577
+ }
578
+ })
579
+ }
580
+ ]
581
+ },
582
+ {
583
+ name: t('settings.options.uiSettings.options.disableSidebarContents.title'),
584
+ icon: 'MENU',
585
+ value: null,
586
+ action: {
587
+ customAction: {
588
+ action: 'SHOW_GUIDE_SETTINGS',
589
+ parameters: 'disabledSidebarContents'
590
+ }
591
+ }
592
+ },
593
+ {
594
+ name: t('settings.options.uiSettings.options.sortSidebarContents.title'),
595
+ icon: 'MENU',
596
+ value: null,
597
+ action: {
598
+ customAction: {
599
+ action: 'SHOW_GUIDE_SETTINGS',
600
+ parameters: 'sortSidebarContents'
601
+ }
602
+ }
603
+ },
604
+ {
605
+ name: t('settings.options.uiSettings.options.launchToOnStartup.title'),
606
+ icon: 'TV',
607
+ value: null,
608
+ menuId: 'tt-launch-to-on-startup',
609
+ menuHeader: {
610
+ title: t('settings.options.uiSettings.options.launchToOnStartup.title'),
611
+ subtitle: t('settings.options.uiSettings.options.launchToOnStartup.subtitle')
612
+ },
613
+ options: [
614
+ {
615
+ name: t('settings.options.uiSettings.options.categories.search'),
616
+ icon: 'SEARCH',
617
+ key: 'launchToOnStartup',
618
+ value: JSON.stringify({
619
+ searchEndpoint: { query: '' }
620
+ })
621
+ },
622
+ {
623
+ name: t('settings.options.uiSettings.options.categories.home'),
624
+ icon: 'WHAT_TO_WATCH',
625
+ key: 'launchToOnStartup',
626
+ value: JSON.stringify({
627
+ browseEndpoint: { browseId: 'FEtopics' }
628
+ })
629
+ },
630
+ {
631
+ name: t('settings.options.uiSettings.options.categories.sports'),
632
+ icon: 'TROPHY',
633
+ key: 'launchToOnStartup',
634
+ value: JSON.stringify({
635
+ browseEndpoint: { browseId: 'FEtopics_sports' }
636
+ })
637
+ },
638
+ {
639
+ name: t('settings.options.uiSettings.options.categories.news'),
640
+ icon: 'NEWS',
641
+ key: 'launchToOnStartup',
642
+ value: JSON.stringify({
643
+ browseEndpoint: { browseId: 'FEtopics_news' }
644
+ })
645
+ },
646
+ {
647
+ name: t('settings.options.uiSettings.options.categories.music'),
648
+ icon: 'YOUTUBE_MUSIC',
649
+ key: 'launchToOnStartup',
650
+ value: JSON.stringify({
651
+ browseEndpoint: { browseId: 'FEtopics_music' }
652
+ })
653
+ },
654
+ {
655
+ name: t('settings.options.uiSettings.options.categories.podcasts'),
656
+ icon: 'BROADCAST',
657
+ key: 'launchToOnStartup',
658
+ value: JSON.stringify({
659
+ browseEndpoint: { browseId: 'FEtopics_podcasts' }
660
+ })
661
+ },
662
+ {
663
+ name: t('settings.options.uiSettings.options.categories.moviesAndTv'),
664
+ icon: 'CLAPPERBOARD',
665
+ key: 'launchToOnStartup',
666
+ value: JSON.stringify({
667
+ browseEndpoint: { browseId: 'FEtopics_movies' }
668
+ })
669
+ },
670
+ {
671
+ name: t('settings.options.uiSettings.options.categories.gaming'),
672
+ icon: 'GAMING',
673
+ key: 'launchToOnStartup',
674
+ value: JSON.stringify({
675
+ browseEndpoint: { browseId: 'FEtopics_gaming' }
676
+ })
677
+ },
678
+ {
679
+ name: t('settings.options.uiSettings.options.categories.live'),
680
+ icon: 'LIVE',
681
+ key: 'launchToOnStartup',
682
+ value: JSON.stringify({
683
+ browseEndpoint: { browseId: 'FEtopics_live' }
684
+ })
685
+ },
686
+ {
687
+ name: t('settings.options.uiSettings.options.categories.subscriptions'),
688
+ icon: 'SUBSCRIPTIONS',
689
+ key: 'launchToOnStartup',
690
+ value: JSON.stringify({
691
+ browseEndpoint: { browseId: 'FEsubscriptions' }
692
+ })
693
+ },
694
+ {
695
+ name: t('settings.options.uiSettings.options.categories.library'),
696
+ icon: 'TAB_LIBRARY',
697
+ key: 'launchToOnStartup',
698
+ value: JSON.stringify({
699
+ browseEndpoint: { browseId: 'FElibrary' }
700
+ })
701
+ },
702
+ {
703
+ name: t('settings.options.uiSettings.options.categories.more'),
704
+ icon: 'TAB_MORE',
705
+ key: 'launchToOnStartup',
706
+ value: JSON.stringify({
707
+ browseEndpoint: { browseId: 'FEtopics_more' }
708
+ })
709
+ }
710
+ ]
711
+ },
712
+ {
713
+ name: t('settings.options.uiSettings.options.sortSubscriptionsByAlphabet'),
714
+ icon: 'SUBSCRIPTIONS',
715
+ value: 'sortSubscriptionsByAlphabet'
716
+ },
717
+ {
718
+ name: t('settings.options.uiSettings.options.disableChannelsOnSidebar'),
719
+ value: 'disableChannelsOnSidebar'
720
+ },
721
+ {
722
+ name: t('settings.options.uiSettings.options.clock.title'),
723
+ value: null,
724
+ icon: 'TIMER',
725
+ menuId: 'tt-clock-settings',
726
+ menuHeader: {
727
+ title: t('settings.options.uiSettings.options.clock.title'),
728
+ subtitle: t('settings.options.uiSettings.options.clock.subtitle')
729
+ },
730
+ options: [
731
+ {
732
+ name: t('settings.options.uiSettings.options.clock.options.enableClock'),
733
+ icon: 'TIMER',
734
+ value: 'enableClock'
735
+ },
736
+ {
737
+ name: t('settings.options.uiSettings.options.clock.options.isClock12HourFormat'),
738
+ icon: 'TIMER',
739
+ value: 'isClock12HourFormat'
740
+ },
741
+ {
742
+ name: t('settings.options.uiSettings.options.clock.options.clockShowSeconds'),
743
+ icon: 'TIMER',
744
+ value: 'clockShowSeconds'
745
+ },
746
+ {
747
+ name: t('settings.options.uiSettings.options.clock.options.clockHideWhenVideoPlaying'),
748
+ icon: 'EYE_OFF',
749
+ value: 'clockHideWhenVideoPlaying'
750
+ }
751
+ ]
752
+ },
753
+ {
754
+ name: t('settings.options.uiSettings.options.disableEnlargingThumbnails'),
755
+ value: 'disableEnlargingThumbnails',
756
+ icon: null,
757
+ },
758
+ {
759
+ name: t('settings.options.uiSettings.options.enableShrinkingThumbnails'),
760
+ value: 'enableShrinkingThumbnails',
761
+ icon: null,
762
+ }
763
+ ]
764
+ },
765
+ window.h5vcc && window.h5vcc.tizentube ?
766
+ {
767
+ name: t('settings.options.updater.title'),
768
+ icon: 'SYSTEM_UPDATE',
769
+ value: null,
770
+ menuHeader: {
771
+ title: t('settings.options.updater.title'),
772
+ subtitle: t('settings.options.updater.menuSubtitle')
773
+ },
774
+ subtitle: t('settings.options.updater.versionSubtitle', { version: window.h5vcc.tizentube.GetVersion() }),
775
+ options: [
776
+ buttonItem(
777
+ { title: t('settings.options.updater.options.checkForUpdates') },
778
+ { icon: 'SYSTEM_UPDATE' },
779
+ [
780
+ {
781
+ customAction: {
782
+ action: 'CHECK_FOR_UPDATES',
783
+ }
784
+ }
785
+ ]
786
+ ),
787
+ {
788
+ name: t('settings.options.updater.options.checkForUpdatesOnStartup'),
789
+ icon: 'SYSTEM_UPDATE',
790
+ value: 'enableUpdater'
791
+ }
792
+ ]
793
+ } : null
794
+ ];
795
+
796
+ const buttons = [];
797
+
798
+ let index = 0;
799
+ for (const setting of settings) {
800
+ if (!setting) continue;
801
+ const currentVal = setting.value ? configRead(setting.value) : null;
802
+ buttons.push(
803
+ buttonItem(
804
+ { title: setting.name, subtitle: setting.subtitle },
805
+ {
806
+ icon: setting.icon ? setting.icon : 'CHEVRON_DOWN',
807
+ secondaryIcon:
808
+ currentVal === null ? 'CHEVRON_RIGHT' : currentVal ? 'CHECK_BOX' : 'CHECK_BOX_OUTLINE_BLANK'
809
+ },
810
+ currentVal !== null
811
+ ? [
812
+ {
813
+ setClientSettingEndpoint: {
814
+ settingDatas: [
815
+ {
816
+ clientSettingEnum: {
817
+ item: setting.value
818
+ },
819
+ boolValue: !configRead(setting.value)
820
+ }
821
+ ]
822
+ }
823
+ },
824
+ {
825
+ customAction: {
826
+ action: 'SETTINGS_UPDATE',
827
+ parameters: [index]
828
+ }
829
+ }
830
+ ]
831
+ : [
832
+ {
833
+ customAction: {
834
+ action: 'OPTIONS_SHOW',
835
+ parameters: {
836
+ options: setting.options,
837
+ selectedIndex: 0,
838
+ update: setting.options?.title ? 'customUI' : false,
839
+ menuId: setting.menuId,
840
+ arrayToEdit: setting.arrayToEdit,
841
+ menuHeader: setting.menuHeader,
842
+ action: setting.action
843
+ }
844
+ }
845
+ }
846
+ ]
847
+ )
848
+ );
849
+ index++;
850
+ }
851
+
852
+ showModal(
853
+ {
854
+ title: t('settings.ttSettings.title'),
855
+ subtitle: t('settings.ttSettings.madeByText')
856
+ },
857
+ overlayPanelItemListRenderer(buttons, parameters && parameters.length > 0 ? parameters[0] : 0),
858
+ 'tt-settings',
859
+ update
860
+ );
861
+ }
862
+
863
+ export function optionShow(parameters, update) {
864
+ if (update === 'customUI') {
865
+ const option = parameters.options;
866
+ showModal(
867
+ {
868
+ title: option.title,
869
+ subtitle: option.subtitle
870
+ },
871
+ option.content,
872
+ 'tt-settings-support',
873
+ false
874
+ );
875
+ return;
876
+ }
877
+ const buttons = [];
878
+
879
+ // Check if this is the legacy sponsorBlockManualSkips (array-based) or new boolean-based options
880
+ const isArrayBasedOptions = parameters.arrayToEdit !== undefined;
881
+
882
+ if (parameters.action) {
883
+ return resolveCommand(parameters.action);
884
+ }
885
+
886
+ if (isArrayBasedOptions) {
887
+ // Legacy handling for sponsorBlockManualSkips
888
+ const value = configRead(parameters.arrayToEdit);
889
+ for (const option of parameters.options) {
890
+ buttons.push(
891
+ buttonItem(
892
+ { title: option.name, subtitle: option.subtitle },
893
+ {
894
+ icon: option.icon ? option.icon : 'CHEVRON_DOWN',
895
+ secondaryIcon: value.includes(option.value) ? 'CHECK_BOX' : 'CHECK_BOX_OUTLINE_BLANK'
896
+ },
897
+ [
898
+ {
899
+ setClientSettingEndpoint: {
900
+ settingDatas: [
901
+ {
902
+ clientSettingEnum: {
903
+ item: parameters.arrayToEdit
904
+ },
905
+ arrayValue: option.value
906
+ }
907
+ ]
908
+ }
909
+ },
910
+ {
911
+ customAction: {
912
+ action: 'OPTIONS_SHOW',
913
+ parameters: {
914
+ options: parameters.options,
915
+ selectedIndex: parameters.options.indexOf(option),
916
+ update: true,
917
+ menuId: parameters.menuId,
918
+ arrayToEdit: parameters.arrayToEdit,
919
+ menuHeader: parameters.menuHeader,
920
+ action: parameters.action
921
+ }
922
+ }
923
+ }
924
+ ]
925
+ )
926
+ );
927
+ }
928
+ } else {
929
+ // New handling for boolean-based options (like subtitle localization)
930
+ let index = 0;
931
+ for (const option of parameters.options) {
932
+ if (!option) continue;
933
+ if (option.compactLinkRenderer) {
934
+ buttons.push(option);
935
+ index++;
936
+ continue;
937
+ }
938
+ const isRadioChoice = option.key !== null && option.key !== undefined;
939
+ const currentVal = option.value === null ? undefined : configRead(isRadioChoice ? option.key : option.value);
940
+ buttons.push(
941
+ buttonItem(
942
+ { title: option.name, subtitle: option.subtitle },
943
+ {
944
+ icon: option.icon ? option.icon : 'CHEVRON_DOWN',
945
+ secondaryIcon: isRadioChoice ? currentVal === option.value ? 'RADIO_BUTTON_CHECKED' : 'RADIO_BUTTON_UNCHECKED' : option.value === null ? 'CHEVRON_RIGHT' : currentVal ? 'CHECK_BOX' : 'CHECK_BOX_OUTLINE_BLANK'
946
+ },
947
+ option.value === null ? [
948
+ {
949
+ customAction: {
950
+ action: 'OPTIONS_SHOW',
951
+ parameters: {
952
+ options: option.options,
953
+ selectedIndex: 0,
954
+ update: option.options?.title ? 'customUI' : false,
955
+ menuId: option.menuId,
956
+ arrayToEdit: option.arrayToEdit,
957
+ menuHeader: option.menuHeader,
958
+ action: option.action
959
+ }
960
+ }
961
+ }
962
+ ] : option.key !== null && option.key !== undefined ? [
963
+ {
964
+ setClientSettingEndpoint: {
965
+ settingDatas: [
966
+ {
967
+ clientSettingEnum: {
968
+ item: option.key
969
+ },
970
+ stringValue: option.value
971
+ }
972
+ ]
973
+ }
974
+ },
975
+ {
976
+ customAction: {
977
+ action: 'OPTIONS_SHOW',
978
+ parameters: {
979
+ options: parameters.options,
980
+ selectedIndex: index,
981
+ update: parameters.options?.title ? 'customUI' : true,
982
+ menuId: parameters.menuId,
983
+ arrayToEdit: parameters.arrayToEdit,
984
+ menuHeader: parameters.menuHeader,
985
+ action: parameters.action
986
+ }
987
+ }
988
+ }
989
+ ] : [
990
+ {
991
+ setClientSettingEndpoint: {
992
+ settingDatas: [
993
+ {
994
+ clientSettingEnum: {
995
+ item: option.value
996
+ },
997
+ boolValue: !currentVal
998
+ }
999
+ ]
1000
+ }
1001
+ },
1002
+ {
1003
+ customAction: {
1004
+ action: 'OPTIONS_SHOW',
1005
+ parameters: {
1006
+ options: parameters.options,
1007
+ selectedIndex: index,
1008
+ update: parameters.options?.title ? 'customUI' : true,
1009
+ menuId: parameters.menuId,
1010
+ arrayToEdit: parameters.arrayToEdit,
1011
+ menuHeader: parameters.menuHeader,
1012
+ action: parameters.action
1013
+ }
1014
+ }
1015
+ }
1016
+ ]
1017
+ )
1018
+ );
1019
+ index++;
1020
+ }
1021
+ }
1022
+
1023
+ showModal(parameters.menuHeader ? parameters.menuHeader : t('settings.ttSettings.title'), overlayPanelItemListRenderer(buttons, parameters.selectedIndex), parameters.menuId || 'tt-settings-options', update);
1024
+ }