From c38da3abf161cf0df38eb9422f904ea2026945ac Mon Sep 17 00:00:00 2001 From: ca1e Date: Fri, 3 Jan 2020 21:44:11 +0800 Subject: [PATCH] =?UTF-8?q?commit=20=E4=BF=AE=E6=94=B9web=E6=9C=8D?= =?UTF-8?q?=E5=8A=A1=E9=83=A8=E5=88=86=E6=8E=A5=E5=8F=A3json=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E8=8E=B7=E5=8F=96=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/assets/web/bookshelf.js | 28 +++++++++---------- app/src/main/assets/web/index.html | 1 + .../app/ui/book/search/SearchViewModel.kt | 5 +--- 3 files changed, 16 insertions(+), 18 deletions(-) diff --git a/app/src/main/assets/web/bookshelf.js b/app/src/main/assets/web/bookshelf.js index 22c8ff87e..c182f49fa 100644 --- a/app/src/main/assets/web/bookshelf.js +++ b/app/src/main/assets/web/bookshelf.js @@ -45,15 +45,15 @@ var init = () => { books.forEach(book => { let bookDiv = $c("div"); let img = $c("img"); - img.src = book.bookInfoBean.coverUrl || randomImg; + img.src = book.coverUrl || randomImg; img.setAttribute("data-series-num", book.serialNumber); bookDiv.appendChild(img); bookDiv.innerHTML += ` - - - - - + + + + +
书名:${book.bookInfoBean.name}
作者:${book.bookInfoBean.author}
阅读:${book.durChapterName}
${formatTime(book.finalDate)}
更新:${book.lastChapterName}
${formatTime(book.finalRefreshData)}
来源:${book.bookInfoBean.origin}
书名:${book.name}
作者:${book.author}
阅读:${book.durChapterTitle}
${formatTime(book.durChapterTime)}
更新:${book.latestChapterTitle}
${formatTime(book.latestChapterTime)}
来源:${book.origin}
`; $('#books').appendChild(bookDiv); }); @@ -62,19 +62,19 @@ var init = () => { $('#allcontent').classList.add("read"); var book = books[bookImg.getAttribute("data-series-num")]; $("#info").innerHTML = ` -

  来源:${book.bookInfoBean.origin}

-

  书名:${book.bookInfoBean.name}

-

  作者:${book.bookInfoBean.author}

+

  来源:${book.origin}

+

  书名:${book.name}

+

  作者:${book.author}

阅读章节:${book.durChapterName}

-

阅读时间:${formatTime(book.finalDate)}

-

最新章节:${book.lastChapterName}

-

检查时间:${formatTime(book.finalRefreshData)}

-

  简介:${book.bookInfoBean.introduce.trim().replace(/\n/g, "
")}

`; +

阅读时间:${formatTime(book.durChapterTime)}

+

最新章节:${book.latestChapterTitle}

+

检查时间:${formatTime(book.lastCheckTime)}

+

  简介:${book.intro.trim().replace(/\n/g, "
")}

`; window.location.hash = ""; window.location.hash = "#info"; $("#content").innerHTML = "章节列表加载中..."; $("#chapter").innerHTML = ""; - fetch(apiAddress("getChapterList", book.noteUrl), { mode: "cors" }) + fetch(apiAddress("getChapterList", book.bookUrl), { mode: "cors" }) .then(res => res.json()) .then(data => { if (!data.isSuccess) { diff --git a/app/src/main/assets/web/index.html b/app/src/main/assets/web/index.html index 2c47adb7f..452e521f3 100644 --- a/app/src/main/assets/web/index.html +++ b/app/src/main/assets/web/index.html @@ -294,6 +294,7 @@
(?i) 前缀表示忽略大小写 代码在线运行工具 + 阅读书架(测试) diff --git a/app/src/main/java/io/legado/app/ui/book/search/SearchViewModel.kt b/app/src/main/java/io/legado/app/ui/book/search/SearchViewModel.kt index b02414b29..6bca4a5f4 100644 --- a/app/src/main/java/io/legado/app/ui/book/search/SearchViewModel.kt +++ b/app/src/main/java/io/legado/app/ui/book/search/SearchViewModel.kt @@ -93,9 +93,7 @@ class SearchViewModel(application: Application) : BaseViewModel(application) { //存在 for (temp in newDataS) { var hasSame = false - var i = 0 - val size = copyDataS.size - while (i < size) { + for (i in copyDataS.indices) { val searchBook = copyDataS[i] if (temp.name == searchBook.name && temp.author == searchBook.author @@ -104,7 +102,6 @@ class SearchViewModel(application: Application) : BaseViewModel(application) { searchBook.addOrigin(temp.bookUrl) break } - i++ } if (!hasSame) { searchBooksAdd.add(temp)