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..02e90a6ab 100644
--- a/app/src/main/assets/web/bookshelf.js
+++ b/app/src/main/assets/web/bookshelf.js
@@ -6,6 +6,8 @@
, books
;
+var now_chapter = -1;
+
var formatTime = value => {
return new Date(value).toLocaleString('zh-CN', {
hour12: false, year: "numeric", month: "2-digit", day: "2-digit", hour: "2-digit", minute: "2-digit", second: "2-digit"
@@ -62,6 +64,7 @@ var init = () => {
});
$$('#books img').forEach(bookImg =>
bookImg.addEventListener("click", () => {
+ now_chapter = -1
$('#allcontent').classList.add("read");
var book = books[bookImg.getAttribute("data-series-num")];
$("#info").innerHTML = `
@@ -130,6 +133,24 @@ $('#showchapter').addEventListener("click", () => {
window.location.hash = "#chapter";
});
+$('#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 +162,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())