@foxreis/tizentube 1.2.7 → 1.3.0
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.
- package/.gitattributes +0 -0
- package/LICENSE +0 -0
- package/README.md +0 -0
- package/dist/service.js +49829 -0
- package/dist/userScript.js +0 -0
- package/mods/adblock.js +0 -0
- package/mods/config.js +0 -0
- package/mods/domrect-polyfill.js +0 -0
- package/mods/package-lock.json +0 -0
- package/mods/package.json +0 -0
- package/mods/rollup.config.js +0 -0
- package/mods/spatial-navigation-polyfill.js +0 -0
- package/mods/speedUI.js +0 -0
- package/mods/sponsorblock.js +0 -0
- package/mods/theme.js +0 -0
- package/mods/tiny-sha256.js +0 -0
- package/mods/ui.css +0 -0
- package/mods/ui.js +282 -282
- package/mods/userScript.js +0 -0
- package/package.json +2 -1
- package/service/package-lock.json +4177 -0
- package/service/package.json +27 -0
- package/service/rollup.config.js +47 -0
- package/service/service.js +68 -0
package/dist/userScript.js
CHANGED
|
File without changes
|
package/mods/adblock.js
CHANGED
|
File without changes
|
package/mods/config.js
CHANGED
|
File without changes
|
package/mods/domrect-polyfill.js
CHANGED
|
File without changes
|
package/mods/package-lock.json
CHANGED
|
File without changes
|
package/mods/package.json
CHANGED
|
File without changes
|
package/mods/rollup.config.js
CHANGED
|
File without changes
|
|
File without changes
|
package/mods/speedUI.js
CHANGED
|
File without changes
|
package/mods/sponsorblock.js
CHANGED
|
File without changes
|
package/mods/theme.js
CHANGED
|
File without changes
|
package/mods/tiny-sha256.js
CHANGED
|
File without changes
|
package/mods/ui.css
CHANGED
|
File without changes
|
package/mods/ui.js
CHANGED
|
@@ -1,283 +1,283 @@
|
|
|
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
|
-
|
|
7
|
-
// It just works, okay?
|
|
8
|
-
const interval = setInterval(() => {
|
|
9
|
-
const videoElement = document.querySelector('video');
|
|
10
|
-
if (videoElement) {
|
|
11
|
-
execute_once_dom_loaded();
|
|
12
|
-
clearInterval(interval);
|
|
13
|
-
}
|
|
14
|
-
}, 250);
|
|
15
|
-
|
|
16
|
-
function execute_once_dom_loaded() {
|
|
17
|
-
|
|
18
|
-
// Add CSS to head.
|
|
19
|
-
|
|
20
|
-
const existingStyle = document.querySelector('style[nonce]');
|
|
21
|
-
if (existingStyle) {
|
|
22
|
-
existingStyle.textContent += css;
|
|
23
|
-
} else {
|
|
24
|
-
const style = document.createElement('style');
|
|
25
|
-
style.textContent = css;
|
|
26
|
-
document.head.appendChild(style);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
// Fix UI issues.
|
|
30
|
-
const ui = configRead('enableFixedUI');
|
|
31
|
-
if (ui) {
|
|
32
|
-
try {
|
|
33
|
-
window.tectonicConfig.featureSwitches.isLimitedMemory = false;
|
|
34
|
-
window.tectonicConfig.clientData.legacyApplicationQuality = 'full-animation';
|
|
35
|
-
window.tectonicConfig.featureSwitches.enableAnimations = true;
|
|
36
|
-
window.tectonicConfig.featureSwitches.enableOnScrollLinearAnimation = true;
|
|
37
|
-
window.tectonicConfig.featureSwitches.enableListAnimations = true;
|
|
38
|
-
} catch (e) { }
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
// We handle key events ourselves.
|
|
42
|
-
window.__spatialNavigation__.keyMode = 'NONE';
|
|
43
|
-
|
|
44
|
-
var ARROW_KEY_CODE = { 37: 'left', 38: 'up', 39: 'right', 40: 'down' };
|
|
45
|
-
|
|
46
|
-
var uiContainer = document.createElement('div');
|
|
47
|
-
uiContainer.classList.add('ytaf-ui-container');
|
|
48
|
-
uiContainer.style['display'] = 'none';
|
|
49
|
-
uiContainer.setAttribute('tabindex', 0);
|
|
50
|
-
uiContainer.addEventListener(
|
|
51
|
-
'focus',
|
|
52
|
-
() => console.info('uiContainer focused!'),
|
|
53
|
-
true
|
|
54
|
-
);
|
|
55
|
-
uiContainer.addEventListener(
|
|
56
|
-
'blur',
|
|
57
|
-
() => console.info('uiContainer blured!'),
|
|
58
|
-
true
|
|
59
|
-
);
|
|
60
|
-
|
|
61
|
-
uiContainer.addEventListener(
|
|
62
|
-
'keydown',
|
|
63
|
-
(evt) => {
|
|
64
|
-
console.info('uiContainer key event:', evt.type, evt.keyCode);
|
|
65
|
-
if (evt.keyCode !== 404 && evt.keyCode !== 172) {
|
|
66
|
-
if (evt.keyCode in ARROW_KEY_CODE) {
|
|
67
|
-
navigate(ARROW_KEY_CODE[evt.keyCode]);
|
|
68
|
-
} else if (evt.keyCode === 13 || evt.keyCode === 32) {
|
|
69
|
-
// "OK" button
|
|
70
|
-
document.querySelector(':focus').click();
|
|
71
|
-
} else if (evt.keyCode === 27 && document.querySelector(':focus').type !== 'text') {
|
|
72
|
-
// Back button
|
|
73
|
-
uiContainer.style.display = 'none';
|
|
74
|
-
uiContainer.blur();
|
|
75
|
-
} else if (document.querySelector(':focus').type === 'text' && evt.keyCode === 27) {
|
|
76
|
-
const focusedElement = document.querySelector(':focus');
|
|
77
|
-
focusedElement.value = focusedElement.value.slice(0, -1);
|
|
78
|
-
}
|
|
79
|
-
evt.preventDefault();
|
|
80
|
-
evt.stopPropagation();
|
|
81
|
-
}
|
|
82
|
-
},
|
|
83
|
-
true
|
|
84
|
-
);
|
|
85
|
-
|
|
86
|
-
uiContainer.innerHTML = `
|
|
87
|
-
<h1>TizenTube Configuration</h1>
|
|
88
|
-
<label for="__adblock"><input type="checkbox" id="__adblock" /> Enable AdBlocking</label>
|
|
89
|
-
<label for="__fixedUI"><input type="checkbox" id="__fixedUI" /> Enable Fixed UI</label>
|
|
90
|
-
<label for="__sponsorblock"><input type="checkbox" id="__sponsorblock" /> Enable SponsorBlock</label>
|
|
91
|
-
<blockquote>
|
|
92
|
-
<label for="__sponsorblock_sponsor"><input type="checkbox" id="__sponsorblock_sponsor" /> Skip Sponsor Segments</label>
|
|
93
|
-
<label for="__sponsorblock_intro"><input type="checkbox" id="__sponsorblock_intro" /> Skip Intro Segments</label>
|
|
94
|
-
<label for="__sponsorblock_outro"><input type="checkbox" id="__sponsorblock_outro" /> Skip Outro Segments</label>
|
|
95
|
-
<label for="__sponsorblock_interaction"><input type="checkbox" id="__sponsorblock_interaction" /> Skip Interaction Reminder Segments</label>
|
|
96
|
-
<label for="__sponsorblock_selfpromo"><input type="checkbox" id="__sponsorblock_selfpromo" /> Skip Self Promotion Segments</label>
|
|
97
|
-
<label for="__sponsorblock_music_offtopic"><input type="checkbox" id="__sponsorblock_music_offtopic" /> Skip Music and Off-topic Segments</label>
|
|
98
|
-
</blockquote>
|
|
99
|
-
<label for="__dearrow"><input type="checkbox" id="__dearrow" /> Enable DeArrow</label>
|
|
100
|
-
<blockquote>
|
|
101
|
-
<label for="__dearrow_thumbnails"><input type="checkbox" id="__dearrow_thumbnails" /> Enable DeArrow Thumbnails</label>
|
|
102
|
-
<div><small>DeArrow Thumbnail changing might break the shelve renderer. Be warned.</small></div>
|
|
103
|
-
</blockquote>
|
|
104
|
-
<label for="__barColor">Navigation Bar Color: <input type="text" id="__barColor"/></label>
|
|
105
|
-
<label for="__routeColor">Main Content Color: <input type="text" id="__routeColor"/></label>
|
|
106
|
-
<div><small>Sponsor segments skipping - https://sponsor.ajay.app</small></div>
|
|
107
|
-
`;
|
|
108
|
-
document.querySelector('body').appendChild(uiContainer);
|
|
109
|
-
|
|
110
|
-
uiContainer.querySelector('#__adblock').checked = configRead('enableAdBlock');
|
|
111
|
-
uiContainer.querySelector('#__adblock').addEventListener('change', (evt) => {
|
|
112
|
-
configWrite('enableAdBlock', evt.target.checked);
|
|
113
|
-
});
|
|
114
|
-
|
|
115
|
-
uiContainer.querySelector('#__sponsorblock').checked =
|
|
116
|
-
configRead('enableSponsorBlock');
|
|
117
|
-
uiContainer
|
|
118
|
-
.querySelector('#__sponsorblock')
|
|
119
|
-
.addEventListener('change', (evt) => {
|
|
120
|
-
configWrite('enableSponsorBlock', evt.target.checked);
|
|
121
|
-
});
|
|
122
|
-
|
|
123
|
-
uiContainer.querySelector('#__sponsorblock_sponsor').checked = configRead(
|
|
124
|
-
'enableSponsorBlockSponsor'
|
|
125
|
-
);
|
|
126
|
-
uiContainer
|
|
127
|
-
.querySelector('#__sponsorblock_sponsor')
|
|
128
|
-
.addEventListener('change', (evt) => {
|
|
129
|
-
configWrite('enableSponsorBlockSponsor', evt.target.checked);
|
|
130
|
-
});
|
|
131
|
-
|
|
132
|
-
uiContainer.querySelector('#__sponsorblock_intro').checked = configRead(
|
|
133
|
-
'enableSponsorBlockIntro'
|
|
134
|
-
);
|
|
135
|
-
uiContainer
|
|
136
|
-
.querySelector('#__sponsorblock_intro')
|
|
137
|
-
.addEventListener('change', (evt) => {
|
|
138
|
-
configWrite('enableSponsorBlockIntro', evt.target.checked);
|
|
139
|
-
});
|
|
140
|
-
|
|
141
|
-
uiContainer.querySelector('#__sponsorblock_outro').checked = configRead(
|
|
142
|
-
'enableSponsorBlockOutro'
|
|
143
|
-
);
|
|
144
|
-
uiContainer
|
|
145
|
-
.querySelector('#__sponsorblock_outro')
|
|
146
|
-
.addEventListener('change', (evt) => {
|
|
147
|
-
configWrite('enableSponsorBlockOutro', evt.target.checked);
|
|
148
|
-
});
|
|
149
|
-
|
|
150
|
-
uiContainer.querySelector('#__sponsorblock_interaction').checked = configRead(
|
|
151
|
-
'enableSponsorBlockInteraction'
|
|
152
|
-
);
|
|
153
|
-
uiContainer
|
|
154
|
-
.querySelector('#__sponsorblock_interaction')
|
|
155
|
-
.addEventListener('change', (evt) => {
|
|
156
|
-
configWrite('enableSponsorBlockInteraction', evt.target.checked);
|
|
157
|
-
});
|
|
158
|
-
|
|
159
|
-
uiContainer.querySelector('#__sponsorblock_selfpromo').checked = configRead(
|
|
160
|
-
'enableSponsorBlockSelfPromo'
|
|
161
|
-
);
|
|
162
|
-
uiContainer
|
|
163
|
-
.querySelector('#__sponsorblock_selfpromo')
|
|
164
|
-
.addEventListener('change', (evt) => {
|
|
165
|
-
configWrite('enableSponsorBlockSelfPromo', evt.target.checked);
|
|
166
|
-
});
|
|
167
|
-
|
|
168
|
-
uiContainer.querySelector('#__sponsorblock_music_offtopic').checked =
|
|
169
|
-
configRead('enableSponsorBlockMusicOfftopic');
|
|
170
|
-
uiContainer
|
|
171
|
-
.querySelector('#__sponsorblock_music_offtopic')
|
|
172
|
-
.addEventListener('change', (evt) => {
|
|
173
|
-
configWrite('enableSponsorBlockMusicOfftopic', evt.target.checked);
|
|
174
|
-
});
|
|
175
|
-
|
|
176
|
-
uiContainer.querySelector('#__dearrow').checked = configRead('enableDeArrow');
|
|
177
|
-
uiContainer.querySelector('#__dearrow').addEventListener('change', (evt) => {
|
|
178
|
-
configWrite('enableDeArrow', evt.target.checked);
|
|
179
|
-
});
|
|
180
|
-
|
|
181
|
-
uiContainer.querySelector('#__dearrow_thumbnails').checked = configRead('enableDeArrowThumbnails');
|
|
182
|
-
uiContainer.querySelector('#__dearrow_thumbnails').addEventListener('change', (evt) => {
|
|
183
|
-
configWrite('enableDeArrowThumbnails', evt.target.checked);
|
|
184
|
-
});
|
|
185
|
-
|
|
186
|
-
uiContainer.querySelector('#__barColor').value = configRead('focusContainerColor');
|
|
187
|
-
uiContainer.querySelector('#__barColor').addEventListener('change', (evt) => {
|
|
188
|
-
configWrite('focusContainerColor', evt.target.value);
|
|
189
|
-
updateStyle();
|
|
190
|
-
});
|
|
191
|
-
|
|
192
|
-
uiContainer.querySelector('#__routeColor').value = configRead('routeColor');
|
|
193
|
-
uiContainer.querySelector('#__routeColor').addEventListener('change', (evt) => {
|
|
194
|
-
configWrite('routeColor', evt.target.value);
|
|
195
|
-
updateStyle();
|
|
196
|
-
});
|
|
197
|
-
|
|
198
|
-
uiContainer.querySelector('#__fixedUI').checked = configRead('enableFixedUI');
|
|
199
|
-
uiContainer.querySelector('#__fixedUI').addEventListener('change', (evt) => {
|
|
200
|
-
configWrite('enableFixedUI', evt.target.checked);
|
|
201
|
-
});
|
|
202
|
-
|
|
203
|
-
var eventHandler = (evt) => {
|
|
204
|
-
// We handle key events ourselves.
|
|
205
|
-
console.info(
|
|
206
|
-
'Key event:',
|
|
207
|
-
evt.type,
|
|
208
|
-
evt.keyCode,
|
|
209
|
-
evt.keyCode,
|
|
210
|
-
evt.defaultPrevented
|
|
211
|
-
);
|
|
212
|
-
if (evt.keyCode == 404 || evt.keyCode == 172) {
|
|
213
|
-
console.info('Taking over!');
|
|
214
|
-
evt.preventDefault();
|
|
215
|
-
evt.stopPropagation();
|
|
216
|
-
if (evt.type === 'keydown') {
|
|
217
|
-
if (uiContainer.style.display === 'none') {
|
|
218
|
-
console.info('Showing and focusing!');
|
|
219
|
-
uiContainer.style.display = 'block';
|
|
220
|
-
uiContainer.focus();
|
|
221
|
-
} else {
|
|
222
|
-
console.info('Hiding!');
|
|
223
|
-
uiContainer.style.display = 'none';
|
|
224
|
-
uiContainer.blur();
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
return false;
|
|
228
|
-
}
|
|
229
|
-
return true;
|
|
230
|
-
};
|
|
231
|
-
|
|
232
|
-
// Red, Green, Yellow, Blue
|
|
233
|
-
// 403, 404, 405, 406
|
|
234
|
-
// ---, 172, 170, 191
|
|
235
|
-
document.addEventListener('keydown', eventHandler, true);
|
|
236
|
-
document.addEventListener('keypress', eventHandler, true);
|
|
237
|
-
document.addEventListener('keyup', eventHandler, true);
|
|
238
|
-
|
|
239
|
-
setTimeout(() => {
|
|
240
|
-
showNotification('Press [GREEN] to open TizenTube configuration screen\nPress [BLUE] to open Video Speed configuration screen');
|
|
241
|
-
}, 2000);
|
|
242
|
-
|
|
243
|
-
// Fix UI issues, again. Love, Googol.
|
|
244
|
-
|
|
245
|
-
if (configRead('enableFixedUI')) {
|
|
246
|
-
try {
|
|
247
|
-
const observer = new MutationObserver((_, _2) => {
|
|
248
|
-
const body = document.querySelector('body');
|
|
249
|
-
if (body.classList.contains('app-quality-root')) {
|
|
250
|
-
body.classList.remove('app-quality-root');
|
|
251
|
-
}
|
|
252
|
-
});
|
|
253
|
-
observer.observe(document.getElementsByTagName('body')[0], { attributes: true, childList: false, subtree: false });
|
|
254
|
-
} catch (e) { }
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
export function showNotification(text, time = 3000) {
|
|
259
|
-
if (!document.querySelector('.ytaf-notification-container')) {
|
|
260
|
-
console.info('Adding notification container');
|
|
261
|
-
const c = document.createElement('div');
|
|
262
|
-
c.classList.add('ytaf-notification-container');
|
|
263
|
-
document.body.appendChild(c);
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
const elm = document.createElement('div');
|
|
267
|
-
const elmInner = document.createElement('div');
|
|
268
|
-
elmInner.innerText = text;
|
|
269
|
-
elmInner.classList.add('message');
|
|
270
|
-
elmInner.classList.add('message-hidden');
|
|
271
|
-
elm.appendChild(elmInner);
|
|
272
|
-
document.querySelector('.ytaf-notification-container').appendChild(elm);
|
|
273
|
-
|
|
274
|
-
setTimeout(() => {
|
|
275
|
-
elmInner.classList.remove('message-hidden');
|
|
276
|
-
}, 100);
|
|
277
|
-
setTimeout(() => {
|
|
278
|
-
elmInner.classList.add('message-hidden');
|
|
279
|
-
setTimeout(() => {
|
|
280
|
-
elm.remove();
|
|
281
|
-
}, 1000);
|
|
282
|
-
}, time);
|
|
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
|
+
|
|
7
|
+
// It just works, okay?
|
|
8
|
+
const interval = setInterval(() => {
|
|
9
|
+
const videoElement = document.querySelector('video');
|
|
10
|
+
if (videoElement) {
|
|
11
|
+
execute_once_dom_loaded();
|
|
12
|
+
clearInterval(interval);
|
|
13
|
+
}
|
|
14
|
+
}, 250);
|
|
15
|
+
|
|
16
|
+
function execute_once_dom_loaded() {
|
|
17
|
+
|
|
18
|
+
// Add CSS to head.
|
|
19
|
+
|
|
20
|
+
const existingStyle = document.querySelector('style[nonce]');
|
|
21
|
+
if (existingStyle) {
|
|
22
|
+
existingStyle.textContent += css;
|
|
23
|
+
} else {
|
|
24
|
+
const style = document.createElement('style');
|
|
25
|
+
style.textContent = css;
|
|
26
|
+
document.head.appendChild(style);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// Fix UI issues.
|
|
30
|
+
const ui = configRead('enableFixedUI');
|
|
31
|
+
if (ui) {
|
|
32
|
+
try {
|
|
33
|
+
window.tectonicConfig.featureSwitches.isLimitedMemory = false;
|
|
34
|
+
window.tectonicConfig.clientData.legacyApplicationQuality = 'full-animation';
|
|
35
|
+
window.tectonicConfig.featureSwitches.enableAnimations = true;
|
|
36
|
+
window.tectonicConfig.featureSwitches.enableOnScrollLinearAnimation = true;
|
|
37
|
+
window.tectonicConfig.featureSwitches.enableListAnimations = true;
|
|
38
|
+
} catch (e) { }
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// We handle key events ourselves.
|
|
42
|
+
window.__spatialNavigation__.keyMode = 'NONE';
|
|
43
|
+
|
|
44
|
+
var ARROW_KEY_CODE = { 37: 'left', 38: 'up', 39: 'right', 40: 'down' };
|
|
45
|
+
|
|
46
|
+
var uiContainer = document.createElement('div');
|
|
47
|
+
uiContainer.classList.add('ytaf-ui-container');
|
|
48
|
+
uiContainer.style['display'] = 'none';
|
|
49
|
+
uiContainer.setAttribute('tabindex', 0);
|
|
50
|
+
uiContainer.addEventListener(
|
|
51
|
+
'focus',
|
|
52
|
+
() => console.info('uiContainer focused!'),
|
|
53
|
+
true
|
|
54
|
+
);
|
|
55
|
+
uiContainer.addEventListener(
|
|
56
|
+
'blur',
|
|
57
|
+
() => console.info('uiContainer blured!'),
|
|
58
|
+
true
|
|
59
|
+
);
|
|
60
|
+
|
|
61
|
+
uiContainer.addEventListener(
|
|
62
|
+
'keydown',
|
|
63
|
+
(evt) => {
|
|
64
|
+
console.info('uiContainer key event:', evt.type, evt.keyCode);
|
|
65
|
+
if (evt.keyCode !== 404 && evt.keyCode !== 172) {
|
|
66
|
+
if (evt.keyCode in ARROW_KEY_CODE) {
|
|
67
|
+
navigate(ARROW_KEY_CODE[evt.keyCode]);
|
|
68
|
+
} else if (evt.keyCode === 13 || evt.keyCode === 32) {
|
|
69
|
+
// "OK" button
|
|
70
|
+
document.querySelector(':focus').click();
|
|
71
|
+
} else if (evt.keyCode === 27 && document.querySelector(':focus').type !== 'text') {
|
|
72
|
+
// Back button
|
|
73
|
+
uiContainer.style.display = 'none';
|
|
74
|
+
uiContainer.blur();
|
|
75
|
+
} else if (document.querySelector(':focus').type === 'text' && evt.keyCode === 27) {
|
|
76
|
+
const focusedElement = document.querySelector(':focus');
|
|
77
|
+
focusedElement.value = focusedElement.value.slice(0, -1);
|
|
78
|
+
}
|
|
79
|
+
evt.preventDefault();
|
|
80
|
+
evt.stopPropagation();
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
true
|
|
84
|
+
);
|
|
85
|
+
|
|
86
|
+
uiContainer.innerHTML = `
|
|
87
|
+
<h1>TizenTube Configuration</h1>
|
|
88
|
+
<label for="__adblock"><input type="checkbox" id="__adblock" /> Enable AdBlocking</label>
|
|
89
|
+
<label for="__fixedUI"><input type="checkbox" id="__fixedUI" /> Enable Fixed UI</label>
|
|
90
|
+
<label for="__sponsorblock"><input type="checkbox" id="__sponsorblock" /> Enable SponsorBlock</label>
|
|
91
|
+
<blockquote>
|
|
92
|
+
<label for="__sponsorblock_sponsor"><input type="checkbox" id="__sponsorblock_sponsor" /> Skip Sponsor Segments</label>
|
|
93
|
+
<label for="__sponsorblock_intro"><input type="checkbox" id="__sponsorblock_intro" /> Skip Intro Segments</label>
|
|
94
|
+
<label for="__sponsorblock_outro"><input type="checkbox" id="__sponsorblock_outro" /> Skip Outro Segments</label>
|
|
95
|
+
<label for="__sponsorblock_interaction"><input type="checkbox" id="__sponsorblock_interaction" /> Skip Interaction Reminder Segments</label>
|
|
96
|
+
<label for="__sponsorblock_selfpromo"><input type="checkbox" id="__sponsorblock_selfpromo" /> Skip Self Promotion Segments</label>
|
|
97
|
+
<label for="__sponsorblock_music_offtopic"><input type="checkbox" id="__sponsorblock_music_offtopic" /> Skip Music and Off-topic Segments</label>
|
|
98
|
+
</blockquote>
|
|
99
|
+
<label for="__dearrow"><input type="checkbox" id="__dearrow" /> Enable DeArrow</label>
|
|
100
|
+
<blockquote>
|
|
101
|
+
<label for="__dearrow_thumbnails"><input type="checkbox" id="__dearrow_thumbnails" /> Enable DeArrow Thumbnails</label>
|
|
102
|
+
<div><small>DeArrow Thumbnail changing might break the shelve renderer. Be warned.</small></div>
|
|
103
|
+
</blockquote>
|
|
104
|
+
<label for="__barColor">Navigation Bar Color: <input type="text" id="__barColor"/></label>
|
|
105
|
+
<label for="__routeColor">Main Content Color: <input type="text" id="__routeColor"/></label>
|
|
106
|
+
<div><small>Sponsor segments skipping - https://sponsor.ajay.app</small></div>
|
|
107
|
+
`;
|
|
108
|
+
document.querySelector('body').appendChild(uiContainer);
|
|
109
|
+
|
|
110
|
+
uiContainer.querySelector('#__adblock').checked = configRead('enableAdBlock');
|
|
111
|
+
uiContainer.querySelector('#__adblock').addEventListener('change', (evt) => {
|
|
112
|
+
configWrite('enableAdBlock', evt.target.checked);
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
uiContainer.querySelector('#__sponsorblock').checked =
|
|
116
|
+
configRead('enableSponsorBlock');
|
|
117
|
+
uiContainer
|
|
118
|
+
.querySelector('#__sponsorblock')
|
|
119
|
+
.addEventListener('change', (evt) => {
|
|
120
|
+
configWrite('enableSponsorBlock', evt.target.checked);
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
uiContainer.querySelector('#__sponsorblock_sponsor').checked = configRead(
|
|
124
|
+
'enableSponsorBlockSponsor'
|
|
125
|
+
);
|
|
126
|
+
uiContainer
|
|
127
|
+
.querySelector('#__sponsorblock_sponsor')
|
|
128
|
+
.addEventListener('change', (evt) => {
|
|
129
|
+
configWrite('enableSponsorBlockSponsor', evt.target.checked);
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
uiContainer.querySelector('#__sponsorblock_intro').checked = configRead(
|
|
133
|
+
'enableSponsorBlockIntro'
|
|
134
|
+
);
|
|
135
|
+
uiContainer
|
|
136
|
+
.querySelector('#__sponsorblock_intro')
|
|
137
|
+
.addEventListener('change', (evt) => {
|
|
138
|
+
configWrite('enableSponsorBlockIntro', evt.target.checked);
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
uiContainer.querySelector('#__sponsorblock_outro').checked = configRead(
|
|
142
|
+
'enableSponsorBlockOutro'
|
|
143
|
+
);
|
|
144
|
+
uiContainer
|
|
145
|
+
.querySelector('#__sponsorblock_outro')
|
|
146
|
+
.addEventListener('change', (evt) => {
|
|
147
|
+
configWrite('enableSponsorBlockOutro', evt.target.checked);
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
uiContainer.querySelector('#__sponsorblock_interaction').checked = configRead(
|
|
151
|
+
'enableSponsorBlockInteraction'
|
|
152
|
+
);
|
|
153
|
+
uiContainer
|
|
154
|
+
.querySelector('#__sponsorblock_interaction')
|
|
155
|
+
.addEventListener('change', (evt) => {
|
|
156
|
+
configWrite('enableSponsorBlockInteraction', evt.target.checked);
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
uiContainer.querySelector('#__sponsorblock_selfpromo').checked = configRead(
|
|
160
|
+
'enableSponsorBlockSelfPromo'
|
|
161
|
+
);
|
|
162
|
+
uiContainer
|
|
163
|
+
.querySelector('#__sponsorblock_selfpromo')
|
|
164
|
+
.addEventListener('change', (evt) => {
|
|
165
|
+
configWrite('enableSponsorBlockSelfPromo', evt.target.checked);
|
|
166
|
+
});
|
|
167
|
+
|
|
168
|
+
uiContainer.querySelector('#__sponsorblock_music_offtopic').checked =
|
|
169
|
+
configRead('enableSponsorBlockMusicOfftopic');
|
|
170
|
+
uiContainer
|
|
171
|
+
.querySelector('#__sponsorblock_music_offtopic')
|
|
172
|
+
.addEventListener('change', (evt) => {
|
|
173
|
+
configWrite('enableSponsorBlockMusicOfftopic', evt.target.checked);
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
uiContainer.querySelector('#__dearrow').checked = configRead('enableDeArrow');
|
|
177
|
+
uiContainer.querySelector('#__dearrow').addEventListener('change', (evt) => {
|
|
178
|
+
configWrite('enableDeArrow', evt.target.checked);
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
uiContainer.querySelector('#__dearrow_thumbnails').checked = configRead('enableDeArrowThumbnails');
|
|
182
|
+
uiContainer.querySelector('#__dearrow_thumbnails').addEventListener('change', (evt) => {
|
|
183
|
+
configWrite('enableDeArrowThumbnails', evt.target.checked);
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
uiContainer.querySelector('#__barColor').value = configRead('focusContainerColor');
|
|
187
|
+
uiContainer.querySelector('#__barColor').addEventListener('change', (evt) => {
|
|
188
|
+
configWrite('focusContainerColor', evt.target.value);
|
|
189
|
+
updateStyle();
|
|
190
|
+
});
|
|
191
|
+
|
|
192
|
+
uiContainer.querySelector('#__routeColor').value = configRead('routeColor');
|
|
193
|
+
uiContainer.querySelector('#__routeColor').addEventListener('change', (evt) => {
|
|
194
|
+
configWrite('routeColor', evt.target.value);
|
|
195
|
+
updateStyle();
|
|
196
|
+
});
|
|
197
|
+
|
|
198
|
+
uiContainer.querySelector('#__fixedUI').checked = configRead('enableFixedUI');
|
|
199
|
+
uiContainer.querySelector('#__fixedUI').addEventListener('change', (evt) => {
|
|
200
|
+
configWrite('enableFixedUI', evt.target.checked);
|
|
201
|
+
});
|
|
202
|
+
|
|
203
|
+
var eventHandler = (evt) => {
|
|
204
|
+
// We handle key events ourselves.
|
|
205
|
+
console.info(
|
|
206
|
+
'Key event:',
|
|
207
|
+
evt.type,
|
|
208
|
+
evt.keyCode,
|
|
209
|
+
evt.keyCode,
|
|
210
|
+
evt.defaultPrevented
|
|
211
|
+
);
|
|
212
|
+
if (evt.keyCode == 404 || evt.keyCode == 172) {
|
|
213
|
+
console.info('Taking over!');
|
|
214
|
+
evt.preventDefault();
|
|
215
|
+
evt.stopPropagation();
|
|
216
|
+
if (evt.type === 'keydown') {
|
|
217
|
+
if (uiContainer.style.display === 'none') {
|
|
218
|
+
console.info('Showing and focusing!');
|
|
219
|
+
uiContainer.style.display = 'block';
|
|
220
|
+
uiContainer.focus();
|
|
221
|
+
} else {
|
|
222
|
+
console.info('Hiding!');
|
|
223
|
+
uiContainer.style.display = 'none';
|
|
224
|
+
uiContainer.blur();
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
return false;
|
|
228
|
+
}
|
|
229
|
+
return true;
|
|
230
|
+
};
|
|
231
|
+
|
|
232
|
+
// Red, Green, Yellow, Blue
|
|
233
|
+
// 403, 404, 405, 406
|
|
234
|
+
// ---, 172, 170, 191
|
|
235
|
+
document.addEventListener('keydown', eventHandler, true);
|
|
236
|
+
document.addEventListener('keypress', eventHandler, true);
|
|
237
|
+
document.addEventListener('keyup', eventHandler, true);
|
|
238
|
+
|
|
239
|
+
setTimeout(() => {
|
|
240
|
+
showNotification('Press [GREEN] to open TizenTube configuration screen\nPress [BLUE] to open Video Speed configuration screen');
|
|
241
|
+
}, 2000);
|
|
242
|
+
|
|
243
|
+
// Fix UI issues, again. Love, Googol.
|
|
244
|
+
|
|
245
|
+
if (configRead('enableFixedUI')) {
|
|
246
|
+
try {
|
|
247
|
+
const observer = new MutationObserver((_, _2) => {
|
|
248
|
+
const body = document.querySelector('body');
|
|
249
|
+
if (body.classList.contains('app-quality-root')) {
|
|
250
|
+
body.classList.remove('app-quality-root');
|
|
251
|
+
}
|
|
252
|
+
});
|
|
253
|
+
observer.observe(document.getElementsByTagName('body')[0], { attributes: true, childList: false, subtree: false });
|
|
254
|
+
} catch (e) { }
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
export function showNotification(text, time = 3000) {
|
|
259
|
+
if (!document.querySelector('.ytaf-notification-container')) {
|
|
260
|
+
console.info('Adding notification container');
|
|
261
|
+
const c = document.createElement('div');
|
|
262
|
+
c.classList.add('ytaf-notification-container');
|
|
263
|
+
document.body.appendChild(c);
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
const elm = document.createElement('div');
|
|
267
|
+
const elmInner = document.createElement('div');
|
|
268
|
+
elmInner.innerText = text;
|
|
269
|
+
elmInner.classList.add('message');
|
|
270
|
+
elmInner.classList.add('message-hidden');
|
|
271
|
+
elm.appendChild(elmInner);
|
|
272
|
+
document.querySelector('.ytaf-notification-container').appendChild(elm);
|
|
273
|
+
|
|
274
|
+
setTimeout(() => {
|
|
275
|
+
elmInner.classList.remove('message-hidden');
|
|
276
|
+
}, 100);
|
|
277
|
+
setTimeout(() => {
|
|
278
|
+
elmInner.classList.add('message-hidden');
|
|
279
|
+
setTimeout(() => {
|
|
280
|
+
elm.remove();
|
|
281
|
+
}, 1000);
|
|
282
|
+
}, time);
|
|
283
283
|
}
|
package/mods/userScript.js
CHANGED
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@foxreis/tizentube",
|
|
3
3
|
"appName": "TizenTube",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.3.0",
|
|
5
5
|
"description": "TizenTube is an ad-free and sponsor-free solution for your favourite streaming website on your Tizen (Samsung) TVs.",
|
|
6
6
|
"packageType": "mods",
|
|
7
7
|
"websiteURL": "https://youtube.com/tv",
|
|
8
8
|
"main": "dist/userScript.js",
|
|
9
9
|
"author": "Reis Can",
|
|
10
|
+
"serviceFile": "dist/service.js",
|
|
10
11
|
"keys": ["MediaPlayPause"],
|
|
11
12
|
"repository": {
|
|
12
13
|
"url": "https://github.com/reisxd/TizenTube"
|