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);