mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-11-02 19:02:28 +00:00
Refine channel profile video click handling
This commit is contained in:
1 parent
56b478454c
commit
1e77d617ec
1 file changed
+7
-11
+7
-11
@@ -256,6 +256,10 @@ async function loadUserVideos(pubkey) {
|
||||
video.alreadyDecrypted = true;
|
||||
}
|
||||
|
||||
// Ensure the global videos map is kept up to date so delegated handlers
|
||||
// have the freshest metadata for this event.
|
||||
window.app?.videosMap?.set(video.id, video);
|
||||
|
||||
// Check if user can edit
|
||||
const canEdit = video.pubkey === app.pubkey;
|
||||
let hasOlder = false;
|
||||
@@ -338,8 +342,6 @@ async function loadUserVideos(pubkey) {
|
||||
|
||||
const encodedUrl = encodeDataValue(video.url);
|
||||
const encodedMagnet = encodeDataValue(video.magnet);
|
||||
const rawUrl = typeof video.url === "string" ? video.url : "";
|
||||
const rawMagnet = typeof video.magnet === "string" ? video.magnet : "";
|
||||
|
||||
cardEl.innerHTML = `
|
||||
<div
|
||||
@@ -374,20 +376,14 @@ async function loadUserVideos(pubkey) {
|
||||
</div>
|
||||
`;
|
||||
|
||||
// Clicking the card => open the video modal
|
||||
cardEl.addEventListener("click", () => {
|
||||
app.playVideoWithFallback({
|
||||
eventId: video.id,
|
||||
url: rawUrl,
|
||||
magnet: rawMagnet,
|
||||
});
|
||||
});
|
||||
|
||||
fragment.appendChild(cardEl);
|
||||
});
|
||||
|
||||
container.appendChild(fragment);
|
||||
|
||||
window.app.videoList = container;
|
||||
window.app.attachVideoListHandler();
|
||||
|
||||
// Lazy-load images
|
||||
const lazyEls = container.querySelectorAll("[data-lazy]");
|
||||
lazyEls.forEach((el) => app.mediaLoader.observe(el));
|
||||
|
||||
Reference in new issue
Block a user