From 590d6213adb7315a2f24ea49b9286e0eb421a7a6 Mon Sep 17 00:00:00 2001 From: gedoor Date: Wed, 20 Jan 2021 19:33:43 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/model/analyzeRule/AnalyzeRule.kt | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeRule.kt b/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeRule.kt index 5445884bf..47789be84 100644 --- a/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeRule.kt +++ b/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeRule.kt @@ -636,17 +636,19 @@ class AnalyzeRule(val ruleData: RuleDataInterface) : JsExtensions { * 执行JS */ fun evalJS(jsStr: String, result: Any?): Any? { - val bindings = SimpleBindings() - bindings["java"] = this - bindings["cookie"] = CookieStore - bindings["cache"] = CacheManager - bindings["book"] = book - bindings["result"] = result - bindings["baseUrl"] = baseUrl - bindings["chapter"] = chapter - bindings["title"] = chapter?.title - bindings["src"] = content - return SCRIPT_ENGINE.eval(jsStr, bindings) + return runBlocking { + val bindings = SimpleBindings() + bindings["java"] = this + bindings["cookie"] = CookieStore + bindings["cache"] = CacheManager + bindings["book"] = book + bindings["result"] = result + bindings["baseUrl"] = baseUrl + bindings["chapter"] = chapter + bindings["title"] = chapter?.title + bindings["src"] = content + SCRIPT_ENGINE.eval(jsStr, bindings) + } } /**