diff --git a/src/ru/mintmanga/build.gradle b/src/ru/mintmanga/build.gradle index 505530596..1c3da9ae2 100644 --- a/src/ru/mintmanga/build.gradle +++ b/src/ru/mintmanga/build.gradle @@ -5,7 +5,7 @@ ext { extName = 'Mintmanga' pkgNameSuffix = 'ru.mintmanga' extClass = '.Mintmanga' - extVersionCode = 25 + extVersionCode = 26 libVersion = '1.2' } diff --git a/src/ru/mintmanga/src/eu/kanade/tachiyomi/extension/ru/mintmanga/Mintmanga.kt b/src/ru/mintmanga/src/eu/kanade/tachiyomi/extension/ru/mintmanga/Mintmanga.kt index dc0879dab..4c0e3d5be 100644 --- a/src/ru/mintmanga/src/eu/kanade/tachiyomi/extension/ru/mintmanga/Mintmanga.kt +++ b/src/ru/mintmanga/src/eu/kanade/tachiyomi/extension/ru/mintmanga/Mintmanga.kt @@ -68,7 +68,7 @@ class Mintmanga : ParsedHttpSource() { override fun latestUpdatesNextPageSelector() = "a.nextLink" override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request { - val url = HttpUrl.parse("$baseUrl/search/advanced")!!.newBuilder() + var url = HttpUrl.parse("$baseUrl/search/advanced")!!.newBuilder() (if (filters.isEmpty()) getFilterList() else filters).forEach { filter -> when (filter) { is GenreList -> filter.state.forEach { genre -> @@ -81,6 +81,30 @@ class Mintmanga : ParsedHttpSource() { url.addQueryParameter(category.id, arrayOf("=", "=in", "=ex")[category.state]) } } + is AgeList -> filter.state.forEach { age -> + if (age.state != Filter.TriState.STATE_IGNORE) { + url.addQueryParameter(age.id, arrayOf("=", "=in", "=ex")[age.state]) + } + } + is More -> filter.state.forEach { more -> + if (more.state != Filter.TriState.STATE_IGNORE) { + url.addQueryParameter(more.id, arrayOf("=", "=in", "=ex")[more.state]) + } + } + is FilList -> filter.state.forEach { fils -> + if (fils.state != Filter.TriState.STATE_IGNORE) { + url.addQueryParameter(fils.id, arrayOf("=", "=in", "=ex")[fils.state]) + } + } + is OrderBy -> { + if (filter.state == 0) { + url = HttpUrl.parse("$baseUrl/search/advanced")!!.newBuilder() + } else { + val ord = arrayOf("not", "year", "name", "rate", "popularity", "votes", "created", "updated")[filter.state] + url = HttpUrl.parse("$baseUrl/list?sortType=$ord")!!.newBuilder() + return GET(url.toString(), headers) + } + } } } if (query.isNotEmpty()) { @@ -248,9 +272,18 @@ class Mintmanga : ParsedHttpSource() { return GET(page.imageUrl!!, imgHeader) } + private class OrderBy : Filter.Select( + "Сортировать\n(отдельно от фильтров)", + arrayOf("Без(фильтры)", "По году", "По алфавиту", "По популярности", "Популярно сейчас", "По рейтингу", "Новинки", "По дате обновления") + ) + private class Genre(name: String, val id: String) : Filter.TriState(name) - private class GenreList(genres: List) : Filter.Group("Genres", genres) - private class Category(categories: List) : Filter.Group("Category", categories) + + private class GenreList(genres: List) : Filter.Group("Жанры", genres) + private class Category(categories: List) : Filter.Group("Категории", categories) + private class AgeList(ages: List) : Filter.Group("Возрастная рекомендация", ages) + private class More(moren: List) : Filter.Group("Прочее", moren) + private class FilList(fils: List) : Filter.Group("Фильтры", fils) /* [...document.querySelectorAll("tr.advanced_option:nth-child(1) > td:nth-child(3) span.js-link")] * .map(el => `Genre("${el.textContent.trim()}", $"{el.getAttribute('onclick') @@ -258,22 +291,43 @@ class Mintmanga : ParsedHttpSource() { * on https://mintmanga.live/search/advanced */ override fun getFilterList() = FilterList( + OrderBy(), Category(getCategoryList()), - GenreList(getGenreList()) + GenreList(getGenreList()), + AgeList(getAgeList()), + More(getMore()), + FilList(getFilList()) ) - - private fun getCategoryList() = listOf( + private fun getFilList() = listOf( + Genre("Высокий рейтинг", "s_high_rate"), + Genre("Сингл", "s_single"), + Genre("Для взрослых", "s_mature"), + Genre("Завершенная", "s_completed"), + Genre("Переведено", "s_translated"), + Genre("Длинная", "s_many_chapters"), + Genre("Ожидает загрузки", "s_wait_upload"), + ) + private fun getMore() = listOf( Genre("В цвете", "el_4614"), Genre("Веб", "el_1355"), Genre("Выпуск приостановлен", "el_5232"), + Genre("Не Яой", "el_1874"), + Genre("Сборник", "el_1348") + ) + + private fun getAgeList() = listOf( + Genre("NC-17", "el_3969"), + Genre("R", "el_3968"), + Genre("R18+", "el_3990") + ) + + private fun getCategoryList() = listOf( Genre("Ёнкома", "el_2741"), Genre("Комикс западный", "el_1903"), Genre("Комикс русский", "el_2173"), Genre("Манхва", "el_1873"), Genre("Маньхуа", "el_1875"), - Genre("Не Яой", "el_1874"), Genre("Ранобэ", "el_5688"), - Genre("Сборник", "el_1348") ) private fun getGenreList() = listOf( diff --git a/src/ru/readmanga/build.gradle b/src/ru/readmanga/build.gradle index f058b9b8e..6433ebc5c 100644 --- a/src/ru/readmanga/build.gradle +++ b/src/ru/readmanga/build.gradle @@ -5,7 +5,7 @@ ext { extName = 'Readmanga' pkgNameSuffix = 'ru.readmanga' extClass = '.Readmanga' - extVersionCode = 23 + extVersionCode = 24 libVersion = '1.2' } diff --git a/src/ru/readmanga/src/eu/kanade/tachiyomi/extension/ru/readmanga/Readmanga.kt b/src/ru/readmanga/src/eu/kanade/tachiyomi/extension/ru/readmanga/Readmanga.kt index f75d0d48d..c4cdd9705 100644 --- a/src/ru/readmanga/src/eu/kanade/tachiyomi/extension/ru/readmanga/Readmanga.kt +++ b/src/ru/readmanga/src/eu/kanade/tachiyomi/extension/ru/readmanga/Readmanga.kt @@ -68,7 +68,7 @@ class Readmanga : ParsedHttpSource() { override fun latestUpdatesNextPageSelector() = "a.nextLink" override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request { - val url = HttpUrl.parse("$baseUrl/search/advanced")!!.newBuilder() + var url = HttpUrl.parse("$baseUrl/search/advanced")!!.newBuilder() (if (filters.isEmpty()) getFilterList() else filters).forEach { filter -> when (filter) { is GenreList -> filter.state.forEach { genre -> @@ -81,6 +81,30 @@ class Readmanga : ParsedHttpSource() { url.addQueryParameter(category.id, arrayOf("=", "=in", "=ex")[category.state]) } } + is AgeList -> filter.state.forEach { age -> + if (age.state != Filter.TriState.STATE_IGNORE) { + url.addQueryParameter(age.id, arrayOf("=", "=in", "=ex")[age.state]) + } + } + is More -> filter.state.forEach { more -> + if (more.state != Filter.TriState.STATE_IGNORE) { + url.addQueryParameter(more.id, arrayOf("=", "=in", "=ex")[more.state]) + } + } + is FilList -> filter.state.forEach { fils -> + if (fils.state != Filter.TriState.STATE_IGNORE) { + url.addQueryParameter(fils.id, arrayOf("=", "=in", "=ex")[fils.state]) + } + } + is OrderBy -> { + if (filter.state == 0) { + url = HttpUrl.parse("$baseUrl/search/advanced")!!.newBuilder() + } else { + val ord = arrayOf("not", "name", "rate", "popularity", "votes", "created", "updated")[filter.state] + url = HttpUrl.parse("$baseUrl/list?sortType=$ord")!!.newBuilder() + return GET(url.toString(), headers) + } + } } } if (query.isNotEmpty()) { @@ -248,30 +272,63 @@ class Readmanga : ParsedHttpSource() { return GET(page.imageUrl!!, imgHeader) } + private class OrderBy : Filter.Select( + "Сортировать\n(отдельно от фильтров)", + arrayOf("Без(фильтры)", "По алфавиту", "По популярности", "Популярно сейчас", "По рейтингу", "Новинки", "По дате обновления") + ) + private class Genre(name: String, val id: String) : Filter.TriState(name) - private class GenreList(genres: List) : Filter.Group("Genres", genres) - private class Category(categories: List) : Filter.Group("Category", categories) + + private class GenreList(genres: List) : Filter.Group("Жанры", genres) + private class Category(categories: List) : Filter.Group("Категории", categories) + private class AgeList(ages: List) : Filter.Group("Возрастная рекомендация", ages) + private class More(moren: List) : Filter.Group("Прочее", moren) + private class FilList(fils: List) : Filter.Group("Фильтры", fils) /* [...document.querySelectorAll("tr.advanced_option:nth-child(1) > td:nth-child(3) span.js-link")] * .map(el => `Genre("${el.textContent.trim()}", $"{el.getAttribute('onclick') * .substr(31,el.getAttribute('onclick').length-33)"})`).join(',\n') * on https://readmanga.me/search/advanced */ + override fun getFilterList() = FilterList( + OrderBy(), Category(getCategoryList()), - GenreList(getGenreList()) + GenreList(getGenreList()), + AgeList(getAgeList()), + More(getMore()), + FilList(getFilList()) ) - private fun getCategoryList() = listOf( + private fun getFilList() = listOf( + Genre("Высокий рейтинг", "s_high_rate"), + Genre("Сингл", "s_single"), + Genre("Для взрослых", "s_mature"), + Genre("Завершенная", "s_completed"), + Genre("Переведено", "s_translated"), + Genre("Длинная", "s_many_chapters"), + Genre("Ожидает загрузки", "s_wait_upload"), + Genre("Продается", "s_sale") + ) + private fun getMore() = listOf( Genre("В цвете", "el_7290"), Genre("Веб", "el_2160"), Genre("Выпуск приостановлен", "el_8033"), + Genre("Сборник", "el_2157") + ) + + private fun getAgeList() = listOf( + Genre("G", "el_6180"), + Genre("PG", "el_6179"), + Genre("PG-13", "el_6181") + ) + + private fun getCategoryList() = listOf( Genre("Ёнкома", "el_2161"), Genre("Комикс западный", "el_3515"), Genre("Манхва", "el_3001"), Genre("Маньхуа", "el_3002"), Genre("Ранобэ", "el_8575"), - Genre("Сборник", "el_2157") ) private fun getGenreList() = listOf(