commit
b715b6f4fe
@ -0,0 +1,5 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<resources> |
||||
<string name="app_name">閲讀.D</string> |
||||
<string name="receiving_shared_label">閲讀·D·搜索</string> |
||||
</resources> |
@ -0,0 +1,5 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<resources> |
||||
<string name="app_name">閲讀.D</string> |
||||
<string name="receiving_shared_label">閲讀·D·搜索</string> |
||||
</resources> |
@ -0,0 +1,4 @@ |
||||
<resources> |
||||
<string name="app_name">阅读·D</string> |
||||
<string name="receiving_shared_label">阅读·D·搜索</string> |
||||
</resources> |
@ -1,4 +1,4 @@ |
||||
<resources> |
||||
<string name="app_name" translatable="false">阅读·D</string> |
||||
<string name="receiving_shared_label" translatable="false">阅读·D·搜索</string> |
||||
<string name="app_name">legado·D</string> |
||||
<string name="receiving_shared_label">legado·D·search</string> |
||||
</resources> |
@ -0,0 +1,6 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<resources> |
||||
|
||||
<string name="app_name">阅读Pro</string> |
||||
|
||||
</resources> |
@ -1,6 +1,6 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<resources> |
||||
|
||||
<string name="app_name">阅读Pro</string> |
||||
<string name="app_name">legadoPro</string> |
||||
|
||||
</resources> |
@ -1,46 +1,3 @@ |
||||
<!DOCTYPE html> |
||||
<html lang=en style="padding: 0;height:100%"> |
||||
|
||||
<head> |
||||
<meta charset=utf-8> |
||||
<meta http-equiv=X-UA-Compatible content="IE=edge"> |
||||
<meta name=viewport content="width=device-width,initial-scale=1"> |
||||
<!--[if IE]><link rel="icon" href="favicon.ico" /><![endif]--> |
||||
<title>yd-web-tool</title> |
||||
<link href=css/about.f23c15cb.css rel=prefetch> |
||||
<link href=css/detail.42c41bd6.css rel=prefetch> |
||||
<link href=js/about.2589b5fe.js rel=prefetch> |
||||
<link href=js/about~detail.08c372e6.js rel=prefetch> |
||||
<link href=js/detail.043d6e39.js rel=prefetch> |
||||
<link href=css/app.e1c0d2e4.css rel=preload as=style> |
||||
<link href=css/chunk-vendors.ad4ff18f.css rel=preload as=style> |
||||
<link href=js/app.b25f3cec.js rel=preload as=script> |
||||
<link href=js/chunk-vendors.b3838a2d.js rel=preload as=script> |
||||
<link href=css/chunk-vendors.ad4ff18f.css rel=stylesheet> |
||||
<link href=css/app.e1c0d2e4.css rel=stylesheet> |
||||
<link rel=icon type=image/png sizes=32x32 href=img/icons/favicon-32x32.png> |
||||
<link rel=icon type=image/png sizes=16x16 href=img/icons/favicon-16x16.png> |
||||
<link rel=manifest href=manifest.json> |
||||
<meta name=theme-color content=#4DBA87> |
||||
<meta name=apple-mobile-web-app-capable content=no> |
||||
<meta name=apple-mobile-web-app-status-bar-style content=default> |
||||
<meta name=apple-mobile-web-app-title content=yd-web-tool> |
||||
<link rel=apple-touch-icon href=img/icons/apple-touch-icon-152x152.png> |
||||
<link rel=mask-icon href=img/icons/safari-pinned-tab.svg color=#4DBA87> |
||||
<meta name=msapplication-TileImage content=img/icons/msapplication-icon-144x144.png> |
||||
<meta name=msapplication-TileColor content=#000000> |
||||
</head> |
||||
<style> |
||||
body::-webkit-scrollbar { |
||||
display: none; |
||||
} |
||||
</style> |
||||
|
||||
<body style="margin: 0;height:100%"><noscript><strong>We're sorry but yd-web-tool doesn't work properly without |
||||
JavaScript enabled. Please enable it to continue.</strong></noscript> |
||||
<div id=app></div> |
||||
<script src=js/chunk-vendors.b3838a2d.js></script> |
||||
<script src=js/app.b25f3cec.js></script> |
||||
</body> |
||||
|
||||
</html> |
||||
<!DOCTYPE html><html lang=en style="padding: 0;height:100%"><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><meta name=viewport content="width=device-width,initial-scale=1"><!--[if IE]><link rel="icon" href="favicon.ico" /><![endif]--><title>yd-web-tool</title><link href=css/about.8c965d87.css rel=prefetch><link href=css/detail.fb767a87.css rel=prefetch><link href=js/about.a0534951.js rel=prefetch><link href=js/about~detail.47586100.js rel=prefetch><link href=js/detail.ff471d08.js rel=prefetch><link href=css/app.e1c0d2e4.css rel=preload as=style><link href=css/chunk-vendors.ad4ff18f.css rel=preload as=style><link href=js/app.a7aae935.js rel=preload as=script><link href=js/chunk-vendors.c98251cd.js rel=preload as=script><link href=css/chunk-vendors.ad4ff18f.css rel=stylesheet><link href=css/app.e1c0d2e4.css rel=stylesheet><link rel=icon type=image/png sizes=32x32 href=img/icons/favicon-32x32.png><link rel=icon type=image/png sizes=16x16 href=img/icons/favicon-16x16.png><link rel=manifest href=manifest.json><meta name=theme-color content=#4DBA87><meta name=apple-mobile-web-app-capable content=no><meta name=apple-mobile-web-app-status-bar-style content=default><meta name=apple-mobile-web-app-title content=yd-web-tool><link rel=apple-touch-icon href=img/icons/apple-touch-icon-152x152.png><link rel=mask-icon href=img/icons/safari-pinned-tab.svg color=#4DBA87><meta name=msapplication-TileImage content=img/icons/msapplication-icon-144x144.png><meta name=msapplication-TileColor content=#000000></head><style>body::-webkit-scrollbar { |
||||
display: none; |
||||
}</style><body style="margin: 0;height:100%"><noscript><strong>We're sorry but yd-web-tool doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id=app></div><script src=js/chunk-vendors.c98251cd.js></script><script src=js/app.a7aae935.js></script></body></html> |
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 4.2 KiB |
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -0,0 +1,74 @@ |
||||
self.__precacheManifest = (self.__precacheManifest || []).concat([ |
||||
{ |
||||
"revision": "80a8de284bb3fa9a4a9f", |
||||
"url": "css/about.8c965d87.css" |
||||
}, |
||||
{ |
||||
"revision": "9da3e990110565bfa57c", |
||||
"url": "css/app.e1c0d2e4.css" |
||||
}, |
||||
{ |
||||
"revision": "c900d6091039998c94b9", |
||||
"url": "css/chunk-vendors.ad4ff18f.css" |
||||
}, |
||||
{ |
||||
"revision": "607ffe83acdcd9c9180e", |
||||
"url": "css/detail.fb767a87.css" |
||||
}, |
||||
{ |
||||
"revision": "535877f50039c0cb49a6196a5b7517cd", |
||||
"url": "fonts/element-icons.535877f5.woff" |
||||
}, |
||||
{ |
||||
"revision": "732389ded34cb9c52dd88271f1345af9", |
||||
"url": "fonts/element-icons.732389de.ttf" |
||||
}, |
||||
{ |
||||
"revision": "f9a3fb0e145017e166dd4d91d9280cc4", |
||||
"url": "fonts/iconfont.f9a3fb0e.woff" |
||||
}, |
||||
{ |
||||
"revision": "f39ecc1a1d2a1eff3aca8aadd818bb61", |
||||
"url": "fonts/popfont.f39ecc1a.ttf" |
||||
}, |
||||
{ |
||||
"revision": "6c094b6d4ae9404dbed273c41b06fae8", |
||||
"url": "fonts/shelffont.6c094b6d.ttf" |
||||
}, |
||||
{ |
||||
"revision": "b5c48bc1e1fe73212a31be704875b71f", |
||||
"url": "img/noCover.b5c48bc1.jpeg" |
||||
}, |
||||
{ |
||||
"revision": "1006935c8b91408961a7012a08445ffd", |
||||
"url": "index.html" |
||||
}, |
||||
{ |
||||
"revision": "80a8de284bb3fa9a4a9f", |
||||
"url": "js/about.a0534951.js" |
||||
}, |
||||
{ |
||||
"revision": "8e5e793e10c338503af6", |
||||
"url": "js/about~detail.47586100.js" |
||||
}, |
||||
{ |
||||
"revision": "9da3e990110565bfa57c", |
||||
"url": "js/app.a7aae935.js" |
||||
}, |
||||
{ |
||||
"revision": "c900d6091039998c94b9", |
||||
"url": "js/chunk-vendors.c98251cd.js" |
||||
}, |
||||
{ |
||||
"revision": "607ffe83acdcd9c9180e", |
||||
"url": "js/detail.ff471d08.js" |
||||
}, |
||||
{ |
||||
"revision": "b46d04eb43bc31ca0f9f95121646440d", |
||||
"url": "manifest.json" |
||||
}, |
||||
{ |
||||
"revision": "735ab4f94fbcd57074377afca324c813", |
||||
"url": "robots.txt" |
||||
} |
||||
]); |
@ -0,0 +1,34 @@ |
||||
/** |
||||
* Welcome to your Workbox-powered service worker! |
||||
* |
||||
* You'll need to register this file in your web app and you should |
||||
* disable HTTP caching for this file too. |
||||
* See https://goo.gl/nhQhGp
|
||||
* |
||||
* The rest of the code is auto-generated. Please don't update this file |
||||
* directly; instead, make changes to your Workbox build configuration |
||||
* and re-run your build process. |
||||
* See https://goo.gl/2aRDsh
|
||||
*/ |
||||
|
||||
importScripts("https://storage.googleapis.com/workbox-cdn/releases/4.3.1/workbox-sw.js"); |
||||
|
||||
importScripts( |
||||
"precache-manifest.9ae0b839acd886dbe2adc2f9d92aeabf.js" |
||||
); |
||||
|
||||
workbox.core.setCacheNameDetails({prefix: "yd-web-tool"}); |
||||
|
||||
self.addEventListener('message', (event) => { |
||||
if (event.data && event.data.type === 'SKIP_WAITING') { |
||||
self.skipWaiting(); |
||||
} |
||||
}); |
||||
|
||||
/** |
||||
* The workboxSW.precacheAndRoute() method efficiently caches and responds to |
||||
* requests for URLs in the manifest. |
||||
* See https://goo.gl/S9QRab
|
||||
*/ |
||||
self.__precacheManifest = [].concat(self.__precacheManifest || []); |
||||
workbox.precaching.precacheAndRoute(self.__precacheManifest, {}); |
@ -1,39 +1,13 @@ |
||||
package io.legado.app.data.entities.rule |
||||
|
||||
import android.os.Parcel |
||||
import android.os.Parcelable |
||||
import kotlinx.android.parcel.Parcelize |
||||
|
||||
@Parcelize |
||||
data class ContentRule( |
||||
var content: String? = null, |
||||
var nextContentUrl: String? = null, |
||||
var webJs: String? = null, |
||||
var sourceRegex: String? = null |
||||
) : Parcelable { |
||||
constructor(parcel: Parcel) : this( |
||||
parcel.readString(), |
||||
parcel.readString(), |
||||
parcel.readString(), |
||||
parcel.readString() |
||||
) |
||||
|
||||
override fun writeToParcel(dest: Parcel, flags: Int) { |
||||
dest.writeString(content) |
||||
dest.writeString(nextContentUrl) |
||||
dest.writeString(webJs) |
||||
dest.writeString(sourceRegex) |
||||
} |
||||
|
||||
override fun describeContents(): Int { |
||||
return 0 |
||||
} |
||||
|
||||
companion object CREATOR : Parcelable.Creator<ContentRule> { |
||||
override fun createFromParcel(parcel: Parcel): ContentRule { |
||||
return ContentRule(parcel) |
||||
} |
||||
|
||||
override fun newArray(size: Int): Array<ContentRule?> { |
||||
return arrayOfNulls(size) |
||||
} |
||||
} |
||||
} |
||||
var sourceRegex: String? = null, |
||||
var imageStyle: Int = 0 //0默认大小居中,1最大宽度 |
||||
) : Parcelable |
@ -0,0 +1,185 @@ |
||||
package io.legado.app.model.localBook |
||||
|
||||
import android.graphics.Bitmap |
||||
import android.graphics.BitmapFactory |
||||
import android.net.Uri |
||||
import android.text.TextUtils |
||||
import io.legado.app.App |
||||
import io.legado.app.data.entities.BookChapter |
||||
import io.legado.app.utils.* |
||||
import nl.siegmann.epublib.domain.Book |
||||
import nl.siegmann.epublib.domain.TOCReference |
||||
import nl.siegmann.epublib.epub.EpubReader |
||||
import org.jsoup.Jsoup |
||||
import java.io.File |
||||
import java.io.FileOutputStream |
||||
import java.io.IOException |
||||
import java.io.InputStream |
||||
import java.nio.charset.Charset |
||||
import java.util.* |
||||
|
||||
class EPUBFile(val book: io.legado.app.data.entities.Book) { |
||||
|
||||
companion object { |
||||
private var eFile: EPUBFile? = null |
||||
|
||||
@Synchronized |
||||
private fun getEFile(book: io.legado.app.data.entities.Book): EPUBFile { |
||||
if (eFile == null || eFile?.book?.bookUrl != book.bookUrl) { |
||||
eFile = EPUBFile(book) |
||||
return eFile!! |
||||
} |
||||
return eFile!! |
||||
} |
||||
|
||||
@Synchronized |
||||
fun getChapterList(book: io.legado.app.data.entities.Book): ArrayList<BookChapter> { |
||||
return getEFile(book).getChapterList() |
||||
} |
||||
|
||||
@Synchronized |
||||
fun getContent(book: io.legado.app.data.entities.Book, chapter: BookChapter): String? { |
||||
return getEFile(book).getContent(chapter) |
||||
} |
||||
|
||||
@Synchronized |
||||
fun getImage( |
||||
book: io.legado.app.data.entities.Book, |
||||
href: String |
||||
): InputStream? { |
||||
return getEFile(book).getImage(href) |
||||
} |
||||
} |
||||
|
||||
private var epubBook: Book? = null |
||||
private var mCharset: Charset = Charset.defaultCharset() |
||||
|
||||
init { |
||||
try { |
||||
val epubReader = EpubReader() |
||||
val inputStream = if (book.bookUrl.isContentPath()) { |
||||
val uri = Uri.parse(book.bookUrl) |
||||
App.INSTANCE.contentResolver.openInputStream(uri) |
||||
} else { |
||||
File(book.bookUrl).inputStream() |
||||
} |
||||
epubBook = epubReader.readEpub(inputStream) |
||||
if (book.coverUrl.isNullOrEmpty()) { |
||||
book.coverUrl = FileUtils.getPath( |
||||
App.INSTANCE.externalFilesDir, |
||||
"${MD5Utils.md5Encode16(book.bookUrl)}.jpg", |
||||
"covers" |
||||
) |
||||
} |
||||
if (!File(book.coverUrl!!).exists()) { |
||||
epubBook!!.coverImage?.inputStream?.use { |
||||
val cover = BitmapFactory.decodeStream(it) |
||||
val out = FileOutputStream(FileUtils.createFileIfNotExist(book.coverUrl!!)) |
||||
cover.compress(Bitmap.CompressFormat.JPEG, 90, out) |
||||
out.flush() |
||||
out.close() |
||||
} |
||||
} |
||||
} catch (e: Exception) { |
||||
e.printStackTrace() |
||||
} |
||||
} |
||||
|
||||
private fun getContent(chapter: BookChapter): String? { |
||||
epubBook?.let { eBook -> |
||||
val resource = eBook.resources.getByHref(chapter.url) |
||||
val doc = Jsoup.parse(String(resource.data, mCharset)) |
||||
val elements = doc.body().children() |
||||
elements.select("script").remove() |
||||
elements.select("style").remove() |
||||
return elements.outerHtml().htmlFormat() |
||||
} |
||||
return null |
||||
} |
||||
|
||||
private fun getImage(href: String): InputStream? { |
||||
val abHref = href.replace("../", "") |
||||
return epubBook?.resources?.getByHref(abHref)?.inputStream |
||||
} |
||||
|
||||
private fun getChapterList(): ArrayList<BookChapter> { |
||||
val chapterList = ArrayList<BookChapter>() |
||||
epubBook?.let { eBook -> |
||||
val metadata = eBook.metadata |
||||
book.name = metadata.firstTitle |
||||
if (metadata.authors.size > 0) { |
||||
val author = |
||||
metadata.authors[0].toString().replace("^, |, $".toRegex(), "") |
||||
book.author = author |
||||
} |
||||
if (metadata.descriptions.size > 0) { |
||||
book.intro = Jsoup.parse(metadata.descriptions[0]).text() |
||||
} |
||||
|
||||
val refs = eBook.tableOfContents.tocReferences |
||||
if (refs == null || refs.isEmpty()) { |
||||
val spineReferences = eBook.spine.spineReferences |
||||
var i = 0 |
||||
val size = spineReferences.size |
||||
while (i < size) { |
||||
val resource = |
||||
spineReferences[i].resource |
||||
var title = resource.title |
||||
if (TextUtils.isEmpty(title)) { |
||||
try { |
||||
val doc = |
||||
Jsoup.parse(String(resource.data, mCharset)) |
||||
val elements = doc.getElementsByTag("title") |
||||
if (elements.size > 0) { |
||||
title = elements[0].text() |
||||
} |
||||
} catch (e: IOException) { |
||||
e.printStackTrace() |
||||
} |
||||
} |
||||
val chapter = BookChapter() |
||||
chapter.index = i |
||||
chapter.bookUrl = book.bookUrl |
||||
chapter.url = resource.href |
||||
if (i == 0 && title.isEmpty()) { |
||||
chapter.title = "封面" |
||||
} else { |
||||
chapter.title = title |
||||
} |
||||
chapterList.add(chapter) |
||||
i++ |
||||
} |
||||
} else { |
||||
parseMenu(chapterList, refs, 0) |
||||
for (i in chapterList.indices) { |
||||
chapterList[i].index = i |
||||
} |
||||
} |
||||
} |
||||
book.latestChapterTitle = chapterList.lastOrNull()?.title |
||||
book.totalChapterNum = chapterList.size |
||||
return chapterList |
||||
} |
||||
|
||||
private fun parseMenu( |
||||
chapterList: ArrayList<BookChapter>, |
||||
refs: List<TOCReference>?, |
||||
level: Int |
||||
) { |
||||
if (refs == null) return |
||||
for (ref in refs) { |
||||
if (ref.resource != null) { |
||||
val chapter = BookChapter() |
||||
chapter.bookUrl = book.bookUrl |
||||
chapter.title = ref.title |
||||
chapter.url = ref.completeHref |
||||
chapterList.add(chapter) |
||||
} |
||||
if (ref.children != null && ref.children.isNotEmpty()) { |
||||
parseMenu(chapterList, ref.children, level + 1) |
||||
} |
||||
} |
||||
} |
||||
|
||||
|
||||
} |
@ -0,0 +1,55 @@ |
||||
package io.legado.app.ui.book.read.config |
||||
|
||||
import android.content.Context |
||||
import android.text.Spannable |
||||
import android.text.SpannableString |
||||
import android.text.style.ForegroundColorSpan |
||||
import android.util.AttributeSet |
||||
import io.legado.app.R |
||||
import io.legado.app.help.AppConfig |
||||
import io.legado.app.help.ReadBookConfig |
||||
import io.legado.app.lib.dialogs.alert |
||||
import io.legado.app.lib.theme.accentColor |
||||
import io.legado.app.ui.widget.text.StrokeTextView |
||||
import org.jetbrains.anko.sdk27.listeners.onClick |
||||
|
||||
class TextFontWeightConverter(context: Context, attrs: AttributeSet?) : StrokeTextView(context, attrs) { |
||||
|
||||
private val spannableString = SpannableString("中/粗/细") |
||||
private var enabledSpan: ForegroundColorSpan = ForegroundColorSpan(context.accentColor) |
||||
private var onChanged: (() -> Unit)? = null |
||||
|
||||
init { |
||||
text = spannableString |
||||
if (!isInEditMode) { |
||||
upUi(ReadBookConfig.textBold) |
||||
} |
||||
onClick { |
||||
selectType() |
||||
} |
||||
} |
||||
|
||||
private fun upUi(type: Int) { |
||||
spannableString.removeSpan(enabledSpan) |
||||
when (type) { |
||||
0 -> spannableString.setSpan(enabledSpan, 0, 1, Spannable.SPAN_INCLUSIVE_EXCLUSIVE) |
||||
1 -> spannableString.setSpan(enabledSpan, 2, 3, Spannable.SPAN_INCLUSIVE_EXCLUSIVE) |
||||
2 -> spannableString.setSpan(enabledSpan, 4, 5, Spannable.SPAN_INCLUSIVE_EXCLUSIVE) |
||||
} |
||||
text = spannableString |
||||
} |
||||
|
||||
private fun selectType() { |
||||
context.alert(titleResource = R.string.text_font_weight_converter) { |
||||
items(context.resources.getStringArray(R.array.text_font_weight).toList()) { _, i -> |
||||
ReadBookConfig.textBold = i |
||||
upUi(i) |
||||
onChanged?.invoke() |
||||
} |
||||
}.show() |
||||
} |
||||
|
||||
fun onChanged(unit: () -> Unit) { |
||||
onChanged = unit |
||||
} |
||||
} |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue