Skip to content
Snippets Groups Projects
Commit 019ef5fc authored by Aaron Christian's avatar Aaron Christian
Browse files

Issue #3531440 by aaronchristian: Get drupal.org eslint test to pass

parent 7ab16abd
No related branches found
No related tags found
No related merge requests found
Pipeline #527552 canceled
......@@ -3,16 +3,16 @@
constructor(heroBanner) {
this.heroBanner = heroBanner;
this.audioControls = heroBanner.querySelector(
".hero__banner--audio-controls",
'.hero__banner--audio-controls',
);
this.initPlayer();
}
initPlayer() {
const playerMap = {
".hero__banner-video--html5-player": this.initHTML5Player,
".hero__banner-video--vimeo-player": this.initVimeoPlayer,
".hero__banner-video--youtube-player": this.initYouTubePlayer,
'.hero__banner-video--html5-player': this.initHTML5Player,
'.hero__banner-video--vimeo-player': this.initVimeoPlayer,
'.hero__banner-video--youtube-player': this.initYouTubePlayer,
};
for (const [selector, initFn] of Object.entries(playerMap)) {
......@@ -26,16 +26,16 @@
attachControls(playFn, pauseFn, unmuteFn, muteFn) {
const events = {
".hero__banner--btn-play": playFn,
".hero__banner--btn-pause": pauseFn,
".hero__banner--btn-unmute": unmuteFn,
".hero__banner--btn-mute": muteFn,
'.hero__banner--btn-play': playFn,
'.hero__banner--btn-pause': pauseFn,
'.hero__banner--btn-unmute': unmuteFn,
'.hero__banner--btn-mute': muteFn,
};
for (const [selector, handler] of Object.entries(events)) {
const button = this.heroBanner.querySelector(selector);
if (button) {
button.addEventListener("click", () => {
button.addEventListener('click', () => {
handler();
this.updateControlsState(selector);
});
......@@ -44,17 +44,17 @@
}
updateControlsState(selector) {
if (selector.includes("play")) {
this.audioControls.classList.add("is-playing");
if (selector.includes('play')) {
this.audioControls.classList.add('is-playing');
}
if (selector.includes("pause")) {
this.audioControls.classList.remove("is-playing");
if (selector.includes('pause')) {
this.audioControls.classList.remove('is-playing');
}
if (selector.includes("unmute")) {
this.audioControls.classList.remove("is-muted");
if (selector.includes('unmute')) {
this.audioControls.classList.remove('is-muted');
}
if (selector.includes("mute") && !selector.includes("unmute")) {
this.audioControls.classList.add("is-muted");
if (selector.includes('mute') && !selector.includes('unmute')) {
this.audioControls.classList.add('is-muted');
}
}
......@@ -92,7 +92,7 @@
modestbranding: true,
controls: 0,
autohide: 1,
wmode: "opaque",
wmode: 'opaque',
showinfo: 0,
loop: 1,
rel: 0,
......@@ -114,8 +114,8 @@
}
loadYouTubeAPI() {
const script = document.createElement("script");
script.src = "https://www.youtube.com/player_api";
const script = document.createElement('script');
script.src = 'https://www.youtube.com/player_api';
document.head.appendChild(script);
}
}
......@@ -195,14 +195,14 @@
playYouTubeVideo(iframe) {
iframe.contentWindow.postMessage(
'{"event":"command","func":"playVideo","args":""}',
"*",
'*',
);
}
pauseYouTubeVideo(iframe) {
iframe.contentWindow.postMessage(
'{"event":"command","func":"pauseVideo","args":""}',
"*",
'*',
);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment