正文规则添加字体

pull/475/head
gedoor 5 years ago
parent a9fd3a350d
commit 50b55076b8
  1. 2
      app/src/main/java/io/legado/app/data/entities/rule/ContentRule.kt
  2. 19
      app/src/main/java/io/legado/app/help/JsExtensions.kt

@ -11,5 +11,5 @@ data class ContentRule(
var sourceRegex: String? = null,
var replaceRegex: String? = null,
var imageStyle: String? = null, //默认大小居中,FULL最大宽度
var font: String? = null
var font: String? = null //必须返回ByteArray
) : Parcelable

@ -121,10 +121,10 @@ interface JsExtensions {
.execute()
}
/**
*js实现读取cookie
*/
fun getCookie(tag: String, key: String? = null): String {
/**
*js实现读取cookie
*/
fun getCookie(tag: String, key: String? = null): String {
val cookie = CookieStore.getCookie(tag)
val cookieMap = CookieStore.cookieToMap(cookie)
return if (key != null) {
@ -132,7 +132,7 @@ interface JsExtensions {
} else {
cookie
}
}
}
/**
* js实现解码,不能删
@ -191,4 +191,13 @@ interface JsExtensions {
fun htmlFormat(str: String): String {
return str.htmlFormat()
}
fun base64DecodeToByteArray(str: String): ByteArray {
return Base64.decode(str, Base64.DEFAULT)
}
fun base64DecodeToByteArray(str: String, flags: Int): ByteArray {
return Base64.decode(str, flags)
}
}

Loading…
Cancel
Save