Skip to content

Commit 2d0264c

Browse files
committed
Cleanup
1 parent 5a4c56e commit 2d0264c

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

injected/src/features/duckplayer/components/ddg-video-overlay.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,6 @@ export class DDGVideoOverlay extends HTMLElement {
105105
* @param {string} videoId
106106
*/
107107
appendThumbnail(overlayElement, videoId) {
108-
console.log('Appending thumbnail', overlayElement, videoId);
109-
110108
const imageUrl = this.environment.getLargeThumbnailSrc(videoId);
111109
appendImageAsBackground(overlayElement, '.ddg-vpo-bg', imageUrl);
112110
}

injected/src/features/duckplayer/overlays.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,11 @@ export class Environment {
215215
}
216216

217217
getLargeThumbnailSrc(videoId) {
218+
const url = new URL(`/vi/${videoId}/maxresdefault.jpg`, 'https://i.ytimg.com');
219+
return url.href;
220+
}
221+
222+
getHiResThumbnailSrc(videoId) {
218223
const url = new URL(`/vi/${videoId}/hqdefault.jpg`, 'https://i.ytimg.com');
219224
return url.href;
220225
}

injected/src/features/duckplayer/video-overlay.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ import { DDGVideoDrawerMobile } from './components/ddg-video-drawer-mobile.js';
3939
* + conduct any communications
4040
*/
4141
export class VideoOverlay {
42-
sideEffects = new SideEffects({ debug: true }); /* TODO: REMOVE debug */
42+
sideEffects = new SideEffects();
4343

4444
/** @type {string | null} */
4545
lastVideoId = null;
@@ -56,7 +56,6 @@ export class VideoOverlay {
5656
* @param {import("../duck-player.js").UISettings} options.ui
5757
*/
5858
constructor({ userValues, settings, environment, messages, ui }) {
59-
console.log('SETTINGS', settings);
6059
this.userValues = userValues;
6160
this.settings = settings;
6261
this.environment = environment;
@@ -181,8 +180,8 @@ export class VideoOverlay {
181180
*/
182181
const videoElement = document.querySelector(this.settings.selectors.videoElement);
183182
const playerContainer = document.querySelector(this.settings.selectors.videoElementContainer);
184-
const overlayContainer = document.body; // TODO: Move to RC
185-
if (!videoElement || !playerContainer || !overlayContainer) {
183+
const drawerContainer = document.body;
184+
if (!videoElement || !playerContainer || !drawerContainer) {
186185
return null;
187186
}
188187

@@ -221,7 +220,7 @@ export class VideoOverlay {
221220

222221
// if we get here, we're trying to prevent the video playing
223222
this.stopVideoFromPlaying();
224-
this.appendOverlayToPage(playerContainer, overlayContainer, params);
223+
this.appendOverlayToPage(playerContainer, drawerContainer, params);
225224
}
226225
}
227226
}
@@ -230,7 +229,7 @@ export class VideoOverlay {
230229
* @param {Element} targetElement
231230
* @param {import("./util").VideoParams} params
232231
*/
233-
appendOverlayToPage(targetElement, overlayElement, params) {
232+
appendOverlayToPage(targetElement, drawerTargetElement, params) {
234233
this.sideEffects.add(`appending ${DDGVideoOverlay.CUSTOM_TAG_NAME} or ${DDGVideoOverlayMobile.CUSTOM_TAG_NAME} to the page`, () => {
235234
this.messages.sendPixel(new Pixel({ name: 'overlay' }));
236235
const controller = new AbortController();
@@ -261,7 +260,7 @@ export class VideoOverlay {
261260
drawer.addEventListener(DDGVideoDrawerMobile.OPT_IN, (/** @type {CustomEvent<{remember: boolean}>} */ e) => {
262261
return this.mobileOptIn(e.detail.remember, params).catch(console.error);
263262
});
264-
overlayElement.appendChild(drawer);
263+
drawerTargetElement.appendChild(drawer);
265264

266265
if (thumbnailOverlay.container) {
267266
this.appendThumbnail(thumbnailOverlay.container);

0 commit comments

Comments
 (0)