修改书源调试和RSS

・增加目录页和正文页调试
・修改RSS的会根据是否存在style来自动增加img、video、body的style
pull/63/head
Celeter 6 years ago
parent f6ad152e27
commit e707336f01
  1. 18
      app/src/main/java/io/legado/app/model/Debug.kt
  2. 21
      app/src/main/java/io/legado/app/ui/rss/read/ReadRssViewModel.kt

@ -111,6 +111,24 @@ object Debug {
log(webBook.sourceUrl, "⇒开始访问发现页:$url") log(webBook.sourceUrl, "⇒开始访问发现页:$url")
exploreDebug(webBook, url) exploreDebug(webBook, url)
} }
key.startsWith("++")-> {
val url = key.substring(2)
val book = Book()
book.origin = webBook.sourceUrl
book.tocUrl = url
log(webBook.sourceUrl, "⇒开始访目录页:$url")
tocDebug(webBook, book)
}
key.startsWith("--")-> {
val url = key.substring(2)
val book = Book()
book.origin = webBook.sourceUrl
log(webBook.sourceUrl, "⇒开始访正文页:$url")
val chapter = BookChapter()
chapter.title = "调试"
chapter.url = url
contentDebug(webBook, book, chapter, null)
}
else -> { else -> {
log(webBook.sourceUrl, "⇒开始搜索关键字:$key") log(webBook.sourceUrl, "⇒开始搜索关键字:$key")
searchDebug(webBook, key) searchDebug(webBook, key)

@ -78,16 +78,17 @@ class ReadRssViewModel(application: Application) : BaseViewModel(application) {
} }
fun clHtml(content: String): String { fun clHtml(content: String): String {
return """ return if (content.contains("<style>|style=".toRegex())) {
<html> content
<head> } else {
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no"> """
<style>img{max-width:100% !important; width:auto; height:auto;}</style> <style>
</head> img{max-width:100% !important; width:auto; height:auto;}
<body style:"height:auto;max-width: 100%; width:auto;"> video{object-fit:fill; max-width:100% !important; width:auto; height:auto;}
$content body{word-wrap:break-word; height:auto;max-width: 100%; width:auto;}
</body></html> </style>$content
""" """
}
} }
interface CallBack { interface CallBack {

Loading…
Cancel
Save