@oxymoron.13/tizentube-s95b 0.2.1 → 0.2.2

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 +42 -49
  2. package/S95B-CHANGES.txt +3 -9
  3. package/dist/userScript.js +2 -2
  4. package/package.json +5 -11
  5. package/UPSTREAM-README.md +0 -42
  6. package/mods/config.js +0 -117
  7. package/mods/domrect-polyfill.js +0 -104
  8. package/mods/features/adblock.js +0 -584
  9. package/mods/features/autoFrameRate.js +0 -42
  10. package/mods/features/enableFeatures.js +0 -19
  11. package/mods/features/moreSubtitles.js +0 -378
  12. package/mods/features/pictureInPicture.js +0 -198
  13. package/mods/features/preferredVideoQuality.js +0 -101
  14. package/mods/features/s95bCodec.js +0 -45
  15. package/mods/features/s95bI18n.js +0 -36
  16. package/mods/features/s95bMenu.js +0 -246
  17. package/mods/features/sponsorblock.js +0 -437
  18. package/mods/features/standaloneUserscript.js +0 -107
  19. package/mods/features/updater.js +0 -119
  20. package/mods/features/userAgentSpoofing.js +0 -73
  21. package/mods/features/videoQueuing.js +0 -64
  22. package/mods/package-lock.json +0 -2321
  23. package/mods/package.json +0 -33
  24. package/mods/resolveCommand.js +0 -376
  25. package/mods/rollup.config.js +0 -41
  26. package/mods/spatial-navigation-polyfill.js +0 -1756
  27. package/mods/tiny-sha256.js +0 -99
  28. package/mods/translations/i18nResources.js +0 -11
  29. package/mods/translations/index.js +0 -18
  30. package/mods/translations/language-names.js +0 -981
  31. package/mods/translations/resources/ar.json +0 -308
  32. package/mods/translations/resources/az.json +0 -308
  33. package/mods/translations/resources/bs.json +0 -308
  34. package/mods/translations/resources/cs.json +0 -308
  35. package/mods/translations/resources/de.json +0 -308
  36. package/mods/translations/resources/dk.json +0 -308
  37. package/mods/translations/resources/el.json +0 -308
  38. package/mods/translations/resources/en.json +0 -308
  39. package/mods/translations/resources/es-419.json +0 -308
  40. package/mods/translations/resources/es.json +0 -308
  41. package/mods/translations/resources/fi-FI.json +0 -308
  42. package/mods/translations/resources/fr.json +0 -311
  43. package/mods/translations/resources/hr.json +0 -308
  44. package/mods/translations/resources/hu.json +0 -308
  45. package/mods/translations/resources/id.json +0 -308
  46. package/mods/translations/resources/it.json +0 -308
  47. package/mods/translations/resources/ja.json +0 -308
  48. package/mods/translations/resources/lt.json +0 -308
  49. package/mods/translations/resources/lv.json +0 -308
  50. package/mods/translations/resources/pl.json +0 -308
  51. package/mods/translations/resources/pt-BR.json +0 -308
  52. package/mods/translations/resources/pt-PT.json +0 -308
  53. package/mods/translations/resources/ro.json +0 -310
  54. package/mods/translations/resources/ru.json +0 -308
  55. package/mods/translations/resources/sr-Cyrl.json +0 -308
  56. package/mods/translations/resources/sr-Latn.json +0 -308
  57. package/mods/translations/resources/tlh.json +0 -308
  58. package/mods/translations/resources/tr.json +0 -308
  59. package/mods/translations/resources/uk.json +0 -308
  60. package/mods/translations/resources/vi.json +0 -309
  61. package/mods/translations/resources/zh-CN.json +0 -308
  62. package/mods/translations/resources/zh-TW.json +0 -308
  63. package/mods/translations/update-translations.js +0 -55
  64. package/mods/ui/chapters.js +0 -137
  65. package/mods/ui/clock.js +0 -71
  66. package/mods/ui/customCommandExecution.js +0 -49
  67. package/mods/ui/customGuideAction.js +0 -119
  68. package/mods/ui/customUI.js +0 -192
  69. package/mods/ui/customYTSettings.js +0 -29
  70. package/mods/ui/disableWhosWatching.js +0 -48
  71. package/mods/ui/settings.js +0 -1024
  72. package/mods/ui/sidebarModification.js +0 -179
  73. package/mods/ui/speedUI.js +0 -119
  74. package/mods/ui/theme.js +0 -26
  75. package/mods/ui/ui.css +0 -157
  76. package/mods/ui/ui.js +0 -261
  77. package/mods/ui/ytUI.js +0 -510
  78. package/mods/userScript.js +0 -28
  79. package/mods/utils/ASTParser.js +0 -67
  80. package/mods/utils/innerTubeCalls.js +0 -138
  81. package/service/package-lock.json +0 -4193
  82. package/service/package.json +0 -29
  83. package/service/rollup.config.js +0 -47
  84. package/service/service.js +0 -118
package/mods/ui/ui.js DELETED
@@ -1,261 +0,0 @@
1
- /*global navigate*/
2
- import '../spatial-navigation-polyfill.js';
3
- import css from './ui.css';
4
- import { configRead, configWrite } from '../config.js';
5
- import updateStyle from './theme.js';
6
- import { showToast } from './ytUI.js';
7
- import modernUI from './settings.js';
8
- import resolveCommand, { patchResolveCommand } from '../resolveCommand.js';
9
- import { pipToFullscreen } from '../features/pictureInPicture.js';
10
- import getCommandExecutor from './customCommandExecution.js';
11
- import { t } from 'i18next';
12
-
13
- // It just works, okay?
14
- const interval = setInterval(() => {
15
- const videoElement = document.querySelector('video');
16
- if (videoElement) {
17
- execute_once_dom_loaded();
18
- patchResolveCommand();
19
- clearInterval(interval);
20
- }
21
- }, 250);
22
-
23
- let keyTimeout = null;
24
-
25
- const keys = {
26
- 49: 1,
27
- 50: 2,
28
- 51: 3,
29
- 52: 4,
30
- 53: 5,
31
- 54: 6,
32
- 55: 7,
33
- 56: 8,
34
- 57: 9,
35
- 48: 0
36
- };
37
-
38
- function execute_once_dom_loaded() {
39
-
40
- // Add CSS to head.
41
-
42
- const existingStyle = document.querySelector('style[nonce]');
43
- if (existingStyle) {
44
- existingStyle.textContent += css;
45
- } else {
46
- const style = document.createElement('style');
47
- style.textContent = css;
48
- document.head.appendChild(style);
49
- }
50
-
51
- // Fix UI issues.
52
- const ui = configRead('enableFixedUI');
53
- if (ui) {
54
- try {
55
- window.tectonicConfig.featureSwitches.isLimitedMemory = false;
56
- window.tectonicConfig.clientData.legacyApplicationQuality = 'full-animation';
57
- window.tectonicConfig.featureSwitches.enableAnimations = true;
58
- window.tectonicConfig.featureSwitches.enableOnScrollLinearAnimation = true;
59
- window.tectonicConfig.featureSwitches.enableListAnimations = true;
60
- window.tectonicConfig.featureSwitches.supportsLongPress = true;
61
- } catch (e) { }
62
- }
63
-
64
- // We handle key events ourselves.
65
- window.__spatialNavigation__.keyMode = 'NONE';
66
-
67
- var ARROW_KEY_CODE = { 37: 'left', 38: 'up', 39: 'right', 40: 'down' };
68
-
69
- var uiContainer = document.createElement('div');
70
- uiContainer.classList.add('ytaf-ui-container');
71
- uiContainer.style['display'] = 'none';
72
- uiContainer.setAttribute('tabindex', 0);
73
- uiContainer.addEventListener(
74
- 'focus',
75
- () => console.info('uiContainer focused!'),
76
- true
77
- );
78
- uiContainer.addEventListener(
79
- 'blur',
80
- () => console.info('uiContainer blured!'),
81
- true
82
- );
83
-
84
- uiContainer.addEventListener(
85
- 'keydown',
86
- (evt) => {
87
- console.info('uiContainer key event:', evt.type, evt.keyCode, evt);
88
- if (evt.keyCode !== 404 && evt.keyCode !== 172) {
89
- if (evt.keyCode in ARROW_KEY_CODE) {
90
- navigate(ARROW_KEY_CODE[evt.keyCode]);
91
- } else if (evt.keyCode === 13 || evt.keyCode === 32) {
92
- // "OK" button
93
- console.log('OK button pressed');
94
- const focusedElement = document.querySelector(':focus');
95
- if (focusedElement.type === 'checkbox') {
96
- focusedElement.checked = !focusedElement.checked;
97
- focusedElement.dispatchEvent(new Event('change'));
98
- }
99
- evt.preventDefault();
100
- evt.stopPropagation();
101
- return;
102
- } else if (evt.keyCode === 27 && document.querySelector(':focus').type !== 'text') {
103
- // Back button
104
- uiContainer.style.display = 'none';
105
- uiContainer.blur();
106
- } else if (document.querySelector(':focus').type === 'text' && evt.keyCode === 27) {
107
- const focusedElement = document.querySelector(':focus');
108
- focusedElement.value = focusedElement.value.slice(0, -1);
109
- }
110
-
111
-
112
- if (evt.key === 'Enter' || evt.Uc?.key === 'Enter') {
113
- // If the focused element is a text input, emit a change event.
114
- if (document.querySelector(':focus').type === 'text') {
115
- document.querySelector(':focus').dispatchEvent(new Event('change'));
116
- }
117
- }
118
- }
119
- },
120
- true
121
- );
122
-
123
- try {
124
- uiContainer.innerHTML = `
125
- <h1>TizenTube Theme Configuration</h1>
126
- <label for="__barColor">Navigation Bar Color: <input type="text" id="__barColor"/></label>
127
- <label for="__routeColor">Main Content Color: <input type="text" id="__routeColor"/></label>
128
- <div><small>Sponsor segments skipping - https://sponsor.ajay.app</small></div>
129
- `;
130
- document.querySelector('body').appendChild(uiContainer);
131
-
132
- uiContainer.querySelector('#__barColor').value = configRead('focusContainerColor');
133
- uiContainer.querySelector('#__barColor').addEventListener('change', (evt) => {
134
- configWrite('focusContainerColor', evt.target.value);
135
- updateStyle();
136
- });
137
-
138
- uiContainer.querySelector('#__routeColor').value = configRead('routeColor');
139
- uiContainer.querySelector('#__routeColor').addEventListener('change', (evt) => {
140
- configWrite('routeColor', evt.target.value);
141
- updateStyle();
142
- });
143
- } catch (e) { }
144
-
145
- var eventHandler = (evt) => {
146
- // We handle key events ourselves.
147
- console.info(
148
- 'Key event:',
149
- evt.type,
150
- evt.keyCode,
151
- evt.keyCode,
152
- evt.defaultPrevented
153
- );
154
-
155
- if (evt.keyCode in keys) {
156
- const percentage = keys[evt.keyCode] * 10;
157
- const video = document.querySelector('video');
158
- video.currentTime = (percentage / 100) * video.duration;
159
- }
160
-
161
- const container = document.getElementById('container');
162
-
163
- if (window.screenTurnedOffAt && Date.now() - window.screenTurnedOffAt > 1000) {
164
- for (const child of document.body.children) {
165
- if (child.tagName.toLowerCase() === 'script' || child.tagName.toLowerCase() === 'svg') continue;
166
-
167
- child.style.setProperty('display', 'block', 'important');
168
- }
169
- window.screenTurnedOffAt = null;
170
- }
171
-
172
- if (configRead('enableScreenDimming')) {
173
- if (keyTimeout) {
174
- clearTimeout(keyTimeout);
175
- }
176
- container.style.setProperty('opacity', '1', 'important');
177
- keyTimeout = setTimeout(() => {
178
- const videoPlayer = document.querySelector('.html5-video-player');
179
- const playerStateObject = videoPlayer.getPlayerStateObject();
180
- if (playerStateObject.isPlaying) return;
181
- container.style.setProperty('opacity', (1 - configRead('dimmingOpacity')).toString(), 'important');
182
- }, configRead('dimmingTimeout') * 1000);
183
- }
184
- if (evt.keyCode == 403) {
185
- console.info('Taking over!');
186
- evt.preventDefault();
187
- evt.stopPropagation();
188
- if (evt.type === 'keydown') {
189
- try {
190
- if (uiContainer.style.display === 'none') {
191
- console.info('Showing and focusing!');
192
- uiContainer.style.display = 'block';
193
- uiContainer.focus();
194
- } else {
195
- console.info('Hiding!');
196
- uiContainer.style.display = 'none';
197
- uiContainer.blur();
198
- }
199
- } catch (e) { }
200
- }
201
- return false;
202
- } else if (evt.keyCode == 404) {
203
- if (evt.type === 'keydown') {
204
- modernUI();
205
- }
206
- } else if (evt.keyCode == 39) {
207
- // Right key, for PiP
208
- if (evt.type === 'keydown') {
209
- if (document.querySelector('ytlr-search-text-box > .zylon-focus') && window.isPipPlaying) {
210
- const ytlrPlayer = document.querySelector('ytlr-player');
211
- ytlrPlayer.style.setProperty('background-color', 'rgb(0, 0, 0)');
212
- pipToFullscreen();
213
- }
214
- }
215
- };
216
- return true;
217
- }
218
-
219
- // Red, Green, Yellow, Blue
220
- // 403, 404, 405, 406
221
- // ---, 172, 170, 191
222
- document.addEventListener('keydown', eventHandler, true);
223
- document.addEventListener('keypress', eventHandler, true);
224
- document.addEventListener('keyup', eventHandler, true);
225
- if (configRead('showWelcomeToast')) {
226
- setTimeout(() => {
227
- showToast(t('welcomeMsg.title'), t('welcomeMsg.subtitle'));
228
- }, 2000);
229
- }
230
-
231
- if (configRead('reloadHomeOnStartup')) {
232
- if (configRead('launchToOnStartup')) {
233
- resolveCommand(JSON.parse(configRead('launchToOnStartup')));
234
- } else {
235
- resolveCommand({
236
- signalAction: {
237
- signal: 'SOFT_RELOAD_PAGE'
238
- }
239
- });
240
- }
241
- }
242
-
243
- const commandExecutor = getCommandExecutor();
244
- if (commandExecutor) {
245
- commandExecutor.executeFunction(new commandExecutor.commandFunction('reloadGuideAction'));
246
- }
247
-
248
- // Fix UI issues, again. Love, Googol.
249
-
250
- if (configRead('enableFixedUI')) {
251
- try {
252
- const observer = new MutationObserver((_, _2) => {
253
- const body = document.body;
254
- if (body.classList.contains('app-quality-root')) {
255
- body.classList.remove('app-quality-root');
256
- }
257
- });
258
- observer.observe(document.body, { attributes: true, childList: false, subtree: false });
259
- } catch (e) { }
260
- }
261
- }