From 9ac632a6286fe57a2d566f8c01c1cfc8d95e858a Mon Sep 17 00:00:00 2001 From: kunfei Date: Tue, 16 Jul 2019 21:43:30 +0800 Subject: [PATCH] up --- .../io/legado/app/model/webbook/BookList.kt | 53 ++----------------- 1 file changed, 5 insertions(+), 48 deletions(-) diff --git a/app/src/main/java/io/legado/app/model/webbook/BookList.kt b/app/src/main/java/io/legado/app/model/webbook/BookList.kt index ef99f7e8e..031062044 100644 --- a/app/src/main/java/io/legado/app/model/webbook/BookList.kt +++ b/app/src/main/java/io/legado/app/model/webbook/BookList.kt @@ -8,7 +8,6 @@ import io.legado.app.data.entities.rule.BookListRule import io.legado.app.model.analyzeRule.AnalyzeRule import io.legado.app.model.analyzeRule.AnalyzeUrl import io.legado.app.utils.NetworkUtils -import org.mozilla.javascript.NativeObject import retrofit2.Response object BookList { @@ -42,20 +41,12 @@ object BookList { } val collections: List var reverse = false - var allInOne = false val bookListRule = if (isSearch) bookSource.getSearchRule() else bookSource.getExploreRule() var ruleList = bookListRule.bookList ?: "" if (ruleList.startsWith("-")) { reverse = true ruleList = ruleList.substring(1) } - if (ruleList.startsWith(":")) { - ruleList = ruleList.substring(1) - } - if (ruleList.startsWith("+")) { - allInOne = true - ruleList = ruleList.substring(1) - } collections = analyzer.getElements(ruleList) if (collections.isEmpty() && bookSource.bookUrlPattern.isNullOrEmpty()) { getInfoItem(analyzer, bookSource, baseUrl)?.let { searchBook -> @@ -63,23 +54,12 @@ object BookList { bookList.add(searchBook) } } else { - if (allInOne) { - for (item in collections) { - getAllInOneItem(item, analyzer, bookListRule, bookSource, baseUrl)?.let { searchBook -> - if (baseUrl == searchBook.bookUrl) { - searchBook.bookInfoHtml = body - } - bookList.add(searchBook) - } - } - } else { - for (item in collections) { - getSearchItem(item, analyzer, bookListRule, bookSource, baseUrl)?.let { searchBook -> - if (baseUrl == searchBook.bookUrl) { - searchBook.bookInfoHtml = body - } - bookList.add(searchBook) + for (item in collections) { + getSearchItem(item, analyzer, bookListRule, bookSource, baseUrl)?.let { searchBook -> + if (baseUrl == searchBook.bookUrl) { + searchBook.bookInfoHtml = body } + bookList.add(searchBook) } } if (reverse) { @@ -114,29 +94,6 @@ object BookList { return null } - private fun getAllInOneItem( - item: Any, - analyzeRule: AnalyzeRule, - bookListRule: BookListRule, - bookSource: BookSource, - baseUrl: String - ): SearchBook? { - val searchBook = SearchBook() - searchBook.origin = bookSource.bookSourceUrl - searchBook.originName = bookSource.bookSourceName - val nativeObject = item as NativeObject - searchBook.name = nativeObject[bookListRule.name]?.toString() - searchBook.name?.let { - searchBook.author = nativeObject[bookListRule.author]?.toString() - searchBook.coverUrl = nativeObject[bookListRule.coverUrl]?.toString() - searchBook.intro = nativeObject[bookListRule.intro]?.toString() - searchBook.kind = nativeObject[bookListRule.kind]?.toString() - searchBook.wordCount = nativeObject[bookListRule.wordCount]?.toString() - return searchBook - } - return null - } - private fun getSearchItem( item: Any, analyzeRule: AnalyzeRule,