From fad4762fc2da534de091c2f70fe07cf6a3dcf983 Mon Sep 17 00:00:00 2001 From: Antecer Date: Wed, 20 Jan 2021 22:34:47 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=8D=8F=E7=A8=8B=E8=B0=83?= =?UTF-8?q?=E7=94=A8js=E5=BC=95=E6=93=8E=E5=AF=BC=E8=87=B4=E7=9A=84?= =?UTF-8?q?=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/model/analyzeRule/AnalyzeRule.kt | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 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 47789be84..98e590cf9 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,17 @@ 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 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) } }