From 3a3699fb0f176f7f837f79a7804cff9dbac0f130 Mon Sep 17 00:00:00 2001 From: bmy <2271608011@qq.com> Date: Sun, 31 May 2026 02:51:33 +0800 Subject: [PATCH] d --- newKs/src/public/index.html | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/newKs/src/public/index.html b/newKs/src/public/index.html index 6811a57..02f0185 100644 --- a/newKs/src/public/index.html +++ b/newKs/src/public/index.html @@ -47,6 +47,7 @@ let scrollLock = false; let handlerId = null; + let currentVideo = null; const ul = document.querySelector("ul"); // 懒加载实例(只初始化一次) @@ -104,6 +105,8 @@ video.loop = true; video.playsInline = true; + video.author = `https://www.kuaishou.com/profile/${item.author.id}` + const posterUrl = item.photo.animatedCoverUrl || item.photo.coverUrl; video.poster = posterUrl; video.dataset.src = item.photo.photoUrls[0]?.url || ""; @@ -153,19 +156,26 @@ */ document.onclick = toggleScroll; document.onkeydown = (e) => { - if (e.keyCode === 32) { + const { keyCode } = e + + if (keyCode === 79) { + e.preventDefault(); + if (currentVideo) open(currentVideo.author) + } + + if (keyCode === 32) { e.preventDefault(); toggleScroll(); } - if (e.keyCode === 82) { + if (keyCode === 82) { e.preventDefault(); scrollSpeed = defaultSpeed; } - if (e.keyCode === 40) { + if (keyCode === 40) { e.preventDefault(); scrollSpeed += 2; } - if (e.keyCode === 38) { + if (keyCode === 38) { e.preventDefault(); scrollSpeed > defaultSpeed && (scrollSpeed -= 2); } @@ -195,6 +205,8 @@ ul.addEventListener("mouseenter", (e) => { if (e.target.tagName === "VIDEO") { e.target.readyState >= 2 && e.target.play(); + currentVideo = e.target + console.log("currentVideo: ", currentVideo); } }, true);