From 60a2e85b4db0b9093bd513c08bf64952df165f04 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E7=8E=8B=E8=89=AF?= <841369634@qq.com>
Date: Tue, 14 May 2024 02:02:41 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
p/index.html | 4 +++-
p/index.js | 17 +++++++++++++++++
2 files changed, 20 insertions(+), 1 deletion(-)
diff --git a/p/index.html b/p/index.html
index f1a2f1e..8827efb 100644
--- a/p/index.html
+++ b/p/index.html
@@ -28,7 +28,9 @@
-
+
+
+
diff --git a/p/index.js b/p/index.js
index 3a9dd7c..1fc0187 100644
--- a/p/index.js
+++ b/p/index.js
@@ -7,6 +7,8 @@ const count = document.getElementById("count"); // 图片数
const loading = document.getElementById("loading"); // loading效果
const auto = document.getElementById("auto"); // 自动
+const save = document.getElementById("save"); // 保存
+const load = document.getElementById("load"); // 加载
const prev = document.getElementById("prev"); // 上一张
const next = document.getElementById("next"); // 下一张
@@ -57,6 +59,21 @@ let inFocus = false; // 输入框是否获取到了焦点
}
});
+ // “保存” 按钮点击事件
+ save.addEventListener("click", function () {
+ if (input.value > 0) {
+ localStorage.setItem("savePid", input.value);
+ }
+ });
+ // “加载” 按钮点击事件
+ load.addEventListener("click", function () {
+ const savePid = localStorage.getItem("savePid") - 0;
+ if (savePid > 0) {
+ input.value = savePid;
+ doEnter(savePid, false);
+ }
+ });
+
// “上一张” 按钮点击事件
prev.addEventListener("click", doPrev);