登录ui按钮支持JavaScript (#2558)

* LoginUI button supports running JavaScript

* Update jsHelp.md

* Update ruleHelp.md
This commit is contained in:
Xwite
2022-11-12 04:49:28 +08:00
committed by GitHub
parent 6132e417a4
commit ccc23db253
3 changed files with 20 additions and 6 deletions
@@ -67,6 +67,15 @@ class SourceLoginDialog : BaseDialogFragment(R.layout.dialog_login, true) {
it.root.onClick {
if (rowUi.action.isAbsUrl()) {
context?.openUrl(rowUi.action!!)
} else {
// JavaScript
rowUi.action?.let {
kotlin.runCatching {
source.evalJS(it)
}.onFailure {
AppLog.put("LoginUI Button ${rowUi.name} JavaScript error", it)
}
}
}
}
}
@@ -133,4 +142,4 @@ class SourceLoginDialog : BaseDialogFragment(R.layout.dialog_login, true) {
activity?.finish()
}
}
}