Skip to content

Commit 77c8bab

Browse files
committed
Lint
1 parent 3d3b9f8 commit 77c8bab

File tree

3 files changed

+22
-20
lines changed

3 files changed

+22
-20
lines changed

injected/src/features/duckplayer/components/ddg-video-drawer-mobile.js

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ export class DDGVideoDrawerMobile extends HTMLElement {
2929
/** @type {HTMLElement | null} */
3030
drawer;
3131

32-
3332
connectedCallback() {
3433
this.createMarkupAndStyles();
3534
}
@@ -44,10 +43,7 @@ export class DDGVideoDrawerMobile extends HTMLElement {
4443
shadow.append(style, overlayElement);
4544
this.setupElements(overlayElement);
4645
this.setupEventHandlers();
47-
48-
// setTimeout(() => {
49-
this.animate('in');
50-
// }, 100); /* TODO FIX THIS */
46+
this.animateOverlay('in');
5147
}
5248

5349
/** @param {HTMLElement} container */
@@ -102,11 +98,11 @@ export class DDGVideoDrawerMobile extends HTMLElement {
10298
*
10399
* @param {'in'|'out'} direction
104100
*/
105-
animate(direction) {
101+
animateOverlay(direction) {
106102
const overlay = this.container?.querySelector('.ddg-mobile-drawer-overlay');
107103
if (!overlay) return;
108104

109-
switch(direction) {
105+
switch (direction) {
110106
case 'in':
111107
overlay.classList.remove('animateOut');
112108
overlay.classList.add('animateIn');
@@ -132,7 +128,15 @@ export class DDGVideoDrawerMobile extends HTMLElement {
132128
const overlay = this.container.querySelector('.ddg-mobile-drawer-overlay');
133129
const background = this.container.querySelector('.ddg-mobile-drawer-background');
134130

135-
if (!cancelElement || !watchInPlayer || !switchElem || !infoButton || !overlay || !background || !(remember instanceof HTMLInputElement)) {
131+
if (
132+
!cancelElement ||
133+
!watchInPlayer ||
134+
!switchElem ||
135+
!infoButton ||
136+
!overlay ||
137+
!background ||
138+
!(remember instanceof HTMLInputElement)
139+
) {
136140
return console.warn('missing elements');
137141
}
138142

@@ -151,28 +155,20 @@ export class DDGVideoDrawerMobile extends HTMLElement {
151155
}
152156
});
153157

154-
const cancelHandler = (e) => {
155-
if (!e.isTrusted) return;
156-
e.preventDefault();
157-
e.stopImmediatePropagation();
158-
this.animate('out');
159-
this.dispatchEvent(new CustomEvent(DDGVideoDrawerMobile.OPT_OUT, { detail: { remember: remember.checked } }));
160-
};
161-
162158
cancelElement.addEventListener('click', (e) => {
163159
if (!e.isTrusted) return;
164160
e.preventDefault();
165161
e.stopImmediatePropagation();
166-
this.animate('out');
162+
this.animateOverlay('out');
167163
this.dispatchEvent(new CustomEvent(DDGVideoDrawerMobile.OPT_OUT, { detail: { remember: remember.checked } }));
168164
});
169165

170166
background.addEventListener('click', (e) => {
171167
if (!e.isTrusted || e.target !== background) return;
172168
e.preventDefault();
173169
e.stopImmediatePropagation();
174-
this.animate('out');
175-
this.dispatchEvent(new CustomEvent(DDGVideoDrawerMobile.DISMISS, { detail: { remember: false } }));
170+
this.animateOverlay('out');
171+
this.dispatchEvent(new CustomEvent(DDGVideoDrawerMobile.DISMISS));
176172
});
177173

178174
watchInPlayer.addEventListener('click', (e) => {

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,9 @@ export class DDGVideoOverlayMobile extends HTMLElement {
6969
if (!e.isTrusted) return;
7070
e.preventDefault();
7171
e.stopImmediatePropagation();
72-
this.dispatchEvent(new CustomEvent(DDGVideoOverlayMobile.OPT_OUT, { detail: { remember: false } })); /* TODO: get actual value of remember */
72+
this.dispatchEvent(
73+
new CustomEvent(DDGVideoOverlayMobile.OPT_OUT, { detail: { remember: false } }),
74+
); /* TODO: get actual value of remember */
7375
});
7476
}
7577
}

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,10 @@ export class VideoOverlay {
296296
});
297297
}
298298

299+
appendThumbnail(overlayElement) {
300+
console.log('TODO', overlayElement);
301+
}
302+
299303
/**
300304
* If the checkbox was checked, this action means that we want to 'always'
301305
* use the private player

0 commit comments

Comments
 (0)