Fix channel video playback and stabilize edit gear menu

This commit is contained in:
thePR0M3TH3AN committed 2025-10-06 21:45:53 -04:00
1 parent 715087992e
commit f4925a2726
2 files changed
+52

No files matched your search

+51
View File
@@ -1963,6 +1963,57 @@ async function loadUserVideos(pubkey) {
app?.attachMoreMenuHandlers?.(container);
if (!container.dataset.playHandlerBound) {
container.addEventListener("click", (event) => {
if (!event || !(event.target instanceof HTMLElement)) {
return;
}
const trigger = event.target.closest("[data-play-url],[data-play-magnet]");
if (!trigger || !(trigger instanceof HTMLElement)) {
return;
}
const isPrimaryClick =
typeof event.button !== "number" || event.button === 0;
if (!isPrimaryClick || event.ctrlKey || event.metaKey) {
return;
}
if (!container.contains(trigger)) {
return;
}
event.preventDefault();
const dataset = trigger.dataset || {};
const videoId = dataset.videoId || trigger.getAttribute("data-video-id") || "";
if (videoId && typeof app?.playVideoByEventId === "function") {
app.playVideoByEventId(videoId);
return;
}
const rawUrl = dataset.playUrl || trigger.getAttribute("data-play-url") || "";
let url = "";
if (typeof rawUrl === "string" && rawUrl) {
try {
url = decodeURIComponent(rawUrl);
} catch (error) {
url = rawUrl;
}
}
const magnetValue =
dataset.playMagnet || trigger.getAttribute("data-play-magnet") || "";
const magnet = typeof magnetValue === "string" ? magnetValue : "";
if (typeof app?.playVideoWithFallback === "function") {
app.playVideoWithFallback({ url, magnet });
}
});
container.dataset.playHandlerBound = "true";
}
// Gear menu toggles
const gearButtons = container.querySelectorAll("[data-settings-dropdown]");
gearButtons.forEach((btn) => {
+1
View File
@@ -995,6 +995,7 @@ export class VideoCard {
if (this.settingsButton && this.settingsDropdown) {
this.settingsButton.addEventListener("click", (event) => {
event.preventDefault();
event.stopPropagation();
const willOpen = this.settingsDropdown.classList.contains("hidden");
if (this.onRequestCloseAllMenus) {
this.onRequestCloseAllMenus(this);