pull/32/head
kunfei 5 years ago
parent d70b0d0de6
commit 9fa16062df
  1. 41
      app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeRule.kt

@ -472,31 +472,32 @@ class AnalyzeRule(private var book: BaseBook? = null) {
fun makeUpRule(result: Any?) { fun makeUpRule(result: Any?) {
val infoVal = StringBuilder() val infoVal = StringBuilder()
var j = ruleParam.size if (ruleParam.isNotEmpty()) {
while (j-- > 0) { var j = ruleParam.size
val regType = ruleType[j] while (j-- > 0) {
if (regType > 0) { val regType = ruleType[j]
@Suppress("UNCHECKED_CAST") if (regType > 0) {
val resultList = result as List<String> @Suppress("UNCHECKED_CAST")
if (resultList.size > regType) { val resultList = result as List<String>
infoVal.insert(0, resultList[regType]) if (resultList.size > regType) {
} infoVal.insert(0, resultList[regType])
} else if (regType < 0) { }
val jsEval: Any = evalJS(ruleParam[j], result) } else if (regType < 0) {
if (jsEval is String) { val jsEval: Any = evalJS(ruleParam[j], result)
infoVal.insert(0, jsEval) if (jsEval is String) {
} else if (jsEval is Double && jsEval % 1.0 == 0.0) { infoVal.insert(0, jsEval)
infoVal.insert(0, String.format("%.0f", jsEval)) } else if (jsEval is Double && jsEval % 1.0 == 0.0) {
infoVal.insert(0, String.format("%.0f", jsEval))
} else {
infoVal.insert(0, jsEval.toString())
}
} else { } else {
infoVal.insert(0, jsEval.toString()) infoVal.insert(0, ruleParam[j])
} }
} else {
infoVal.insert(0, ruleParam[j])
} }
rule = infoVal.toString()
} }
rule = infoVal.toString()
} }
} }
enum class Mode { enum class Mode {

Loading…
Cancel
Save