Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion packages/scripts/dist/other-amount.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@ export class OtherAmount {
targetWrapper.classList.remove("en__field__item--hidden");
if (targetWrapper.parentNode) {
const lastRadioInput = targetWrapper.parentNode.querySelector(".en__field__item:nth-last-child(2) input");
lastRadioInput.checked = !0;
if (lastRadioInput) {
lastRadioInput.checked = true;
}
}
}
}
Expand Down
19 changes: 10 additions & 9 deletions packages/scripts/dist/src-defer.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,16 @@ export class SrcDefer {
}
// To get the browser to request the video asset defined we need to remove the <video> tag and re-add it
let videoBackgroundParent = video.parentNode; // Determine the parent of the <video> tag
let copyOfVideoBackground = video; // Copy the <video> tag
if (videoBackgroundParent && copyOfVideoBackground) {
videoBackgroundParent.replaceChild(copyOfVideoBackground, video); // Replace the <video> with the copy of itself
// Update the video to auto play, mute, loop
video.muted = true; // Mute the video by default
video.controls = false; // Hide the browser controls
video.loop = true; // Loop the video
video.playsInline = true; // Encourage the user agent to display video content within the element's playback area
video.play(); // Plays the video
if (videoBackgroundParent && video) {
// Remove the video element and re-add it to trigger the browser to request the video asset
const videoClone = video.cloneNode(true);
videoBackgroundParent.replaceChild(videoClone, video);
// Update the cloned video to auto play, mute, loop
videoClone.muted = true; // Mute the video by default
videoClone.controls = false; // Hide the browser controls
videoClone.loop = true; // Loop the video
videoClone.playsInline = true; // Encourage the user agent to display video content within the element's playback area
videoClone.play(); // Plays the video
}
}
}
Expand Down
6 changes: 4 additions & 2 deletions packages/scripts/src/other-amount.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export class OtherAmount {
constructor() {
"focusin input".split(" ").forEach((e) => {
// We're attaching this event to the body because sometimes the other amount input is not in the DOM yet and comes via AJAX.
document.querySelector("body")?.addEventListener(e, (event) => {
document.querySelector("body")?.addEventListener(e as string, (event: Event) => {
const target = event.target as HTMLInputElement;
if (target.classList.contains("en__field__input--other")) {
this.logger.log("Other Amount Field Focused");
Expand Down Expand Up @@ -81,7 +81,9 @@ export class OtherAmount {
const lastRadioInput = targetWrapper.parentNode.querySelector(
".en__field__item:nth-last-child(2) input"
) as HTMLInputElement;
lastRadioInput.checked = !0;
if (lastRadioInput) {
lastRadioInput.checked = true;
}
}
}
}
Expand Down
19 changes: 10 additions & 9 deletions packages/scripts/src/src-defer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,16 +70,17 @@ export class SrcDefer {

// To get the browser to request the video asset defined we need to remove the <video> tag and re-add it
let videoBackgroundParent = video.parentNode; // Determine the parent of the <video> tag
let copyOfVideoBackground = video; // Copy the <video> tag
if (videoBackgroundParent && copyOfVideoBackground) {
videoBackgroundParent.replaceChild(copyOfVideoBackground, video); // Replace the <video> with the copy of itself
if (videoBackgroundParent && video) {
// Remove the video element and re-add it to trigger the browser to request the video asset
const videoClone = video.cloneNode(true) as HTMLVideoElement;
videoBackgroundParent.replaceChild(videoClone, video);

// Update the video to auto play, mute, loop
video.muted = true; // Mute the video by default
video.controls = false; // Hide the browser controls
video.loop = true; // Loop the video
video.playsInline = true; // Encourage the user agent to display video content within the element's playback area
video.play(); // Plays the video
// Update the cloned video to auto play, mute, loop
videoClone.muted = true; // Mute the video by default
videoClone.controls = false; // Hide the browser controls
videoClone.loop = true; // Loop the video
videoClone.playsInline = true; // Encourage the user agent to display video content within the element's playback area
videoClone.play(); // Plays the video
}
}
}
Expand Down
Loading