From 29d1d99e58c072bde2a65e084e865bcde7dd38dc Mon Sep 17 00:00:00 2001 From: happywillow0 <45346080+happywillow0@users.noreply.github.com> Date: Sun, 1 Mar 2020 07:23:05 -0500 Subject: [PATCH] View Trending / New via Filter (#2322) KissManga - Enable Trending / New Manga lists --- src/en/kissmanga/build.gradle | 2 +- .../extension/en/kissmanga/Kissmanga.kt | 18 +++++++++++++++--- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/en/kissmanga/build.gradle b/src/en/kissmanga/build.gradle index b9bd51ac8..49378e6c3 100644 --- a/src/en/kissmanga/build.gradle +++ b/src/en/kissmanga/build.gradle @@ -5,7 +5,7 @@ ext { appName = 'Tachiyomi: Kissmanga' pkgNameSuffix = 'en.kissmanga' extClass = '.Kissmanga' - extVersionCode = 10 + extVersionCode = 11 libVersion = '1.2' } diff --git a/src/en/kissmanga/src/eu/kanade/tachiyomi/extension/en/kissmanga/Kissmanga.kt b/src/en/kissmanga/src/eu/kanade/tachiyomi/extension/en/kissmanga/Kissmanga.kt index edeb521d4..ea3284b7e 100644 --- a/src/en/kissmanga/src/eu/kanade/tachiyomi/extension/en/kissmanga/Kissmanga.kt +++ b/src/en/kissmanga/src/eu/kanade/tachiyomi/extension/en/kissmanga/Kissmanga.kt @@ -87,6 +87,12 @@ class Kissmanga : ParsedHttpSource() { override fun latestUpdatesNextPageSelector(): String = "ul.pager > li > a:contains(Next)" override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request { + for (filter in filters) { + when (filter) { + is SortTrending -> if (filter.state) return GET("$baseUrl/MangaList/Trending?page=$page", headers) + is NewManga -> if (filter.state) return GET("$baseUrl/MangaList/Newest?page=$page", headers) + } + } val form = FormBody.Builder().apply { add("mangaName", query) @@ -190,11 +196,17 @@ class Kissmanga : ParsedHttpSource() { private class Author : Filter.Text("Author") private class Genre(name: String) : Filter.TriState(name) private class GenreList(genres: List) : Filter.Group("Genres", genres) + private class SortTrending: Filter.CheckBox("View Trending Manga") + private class NewManga: Filter.CheckBox("View New Manga") override fun getFilterList() = FilterList( - Author(), - Status(), - GenreList(getGenreList()) + Author(), + Status(), + GenreList(getGenreList()), + Filter.Separator(), + Filter.Header("Change Manga List"), + SortTrending(), + NewManga() ) // $("select[name=\"genres\"]").map((i,el) => `Genre("${$(el).next().text().trim()}", ${i})`).get().join(',\n')