From 0f3580cfe3b9310082b449fd5f6da7b994d82e65 Mon Sep 17 00:00:00 2001 From: Celeter Date: Sun, 8 Mar 2020 18:10:03 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A0=E4=BA=86=E4=B8=8A=E4=B8=80=E7=AB=A0?= =?UTF-8?q?=E4=B8=8B=E4=B8=80=E7=AB=A0=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/assets/web/bookshelf.html | 3 +++ app/src/main/assets/web/bookshelf.js | 20 ++++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/app/src/main/assets/web/bookshelf.html b/app/src/main/assets/web/bookshelf.html index d5a37ae51..86639426f 100644 --- a/app/src/main/assets/web/bookshelf.html +++ b/app/src/main/assets/web/bookshelf.html @@ -28,6 +28,9 @@
+
+
+
diff --git a/app/src/main/assets/web/bookshelf.js b/app/src/main/assets/web/bookshelf.js index 19909b0f5..338332ab8 100644 --- a/app/src/main/assets/web/bookshelf.js +++ b/app/src/main/assets/web/bookshelf.js @@ -130,6 +130,25 @@ $('#showchapter').addEventListener("click", () => { window.location.hash = "#chapter"; }); +var now_chapter = -1; +$('#up').addEventListener('click', e => { + if (now_chapter > 0) { + now_chapter--; + let clickEvent = document.createEvent('MouseEvents'); + clickEvent.initEvent("click", true, false); + $('[data-index="' + now_chapter + '"]').dispatchEvent(clickEvent); + } +}); + +$('#down').addEventListener('click', e => { + if (now_chapter > -1) { + now_chapter++; + let clickEvent = document.createEvent('MouseEvents'); + clickEvent.initEvent("click", true, false); + $('[data-index="' + now_chapter + '"]').dispatchEvent(clickEvent); + } +}); + $('#chapter').addEventListener("click", (e) => { if (e.target.tagName === "BUTTON") { var url = e.target.getAttribute("data-url"); @@ -141,6 +160,7 @@ $('#chapter').addEventListener("click", (e) => { if (!index && (0 != index)) { alert("未取得章节索引"); } + now_chapter = parseInt(index); $("#content").innerHTML = "

" + name + " 加载中...

"; fetch(apiAddress("getBookContent", url, index), { mode: "cors" }) .then(res => res.json())