Ensure card clicks open video modal without navigation

This commit is contained in:
thePR0M3TH3AN committed 2025-09-30 11:31:05 -04:00
1 parent 80fcb22f89
commit cd96e3a2b4
3 files changed
+12 -12

No files matched your search

+11 -7
View File
@@ -5572,6 +5572,12 @@ class bitvidApp {
}
attachVideoListHandler() {
const nextTarget = document;
if (this._videoListElement === nextTarget && this._videoListClickHandler) {
return;
}
if (this._videoListElement && this._videoListClickHandler) {
this._videoListElement.removeEventListener(
"click",
@@ -5581,10 +5587,6 @@ class bitvidApp {
this._videoListClickHandler = null;
}
if (!this.videoList) {
return;
}
const handler = async (event) => {
const trigger = event.target.closest(
"[data-play-magnet],[data-play-url]"
@@ -5593,7 +5595,9 @@ class bitvidApp {
return;
}
if (event.button === 0 && !event.ctrlKey && !event.metaKey) {
const isPrimaryClick =
typeof event.button !== "number" || event.button === 0;
if (isPrimaryClick && !event.ctrlKey && !event.metaKey) {
event.preventDefault();
const rawUrlValue =
@@ -5626,9 +5630,9 @@ class bitvidApp {
}
};
this._videoListElement = this.videoList;
nextTarget.addEventListener("click", handler);
this._videoListElement = nextTarget;
this._videoListClickHandler = handler;
this.videoList.addEventListener("click", handler);
}
/**
-1
View File
@@ -794,7 +794,6 @@ async function loadUserVideos(pubkey) {
app.handleUrlHealthBadge({ video, url, badgeEl });
});
window.app.videoList = container;
window.app.attachVideoListHandler();
// Lazy-load images
+1 -4
View File
@@ -614,10 +614,7 @@ class SubscriptionsManager {
window.app.handleUrlHealthBadge({ video, url, badgeEl });
});
if (window.app) {
window.app.videoList = container;
window.app.attachVideoListHandler?.();
}
window.app?.attachVideoListHandler?.();
// Lazy-load
const lazyEls = container.querySelectorAll("[data-lazy]");