From 5fb2ec2fdab5ca30c37367107da9aa327a52f016 Mon Sep 17 00:00:00 2001 From: tarsin Date: Tue, 6 Jun 2023 22:31:27 +0800 Subject: [PATCH] Cleanup js apply --- .../hippo/ehviewer/ui/settings/UConfigScreen.kt | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/app/src/main/java/com/hippo/ehviewer/ui/settings/UConfigScreen.kt b/app/src/main/java/com/hippo/ehviewer/ui/settings/UConfigScreen.kt index 77f862230..887761f60 100644 --- a/app/src/main/java/com/hippo/ehviewer/ui/settings/UConfigScreen.kt +++ b/app/src/main/java/com/hippo/ehviewer/ui/settings/UConfigScreen.kt @@ -31,6 +31,8 @@ import eu.kanade.tachiyomi.util.lang.launchIO import okhttp3.Cookie import okhttp3.HttpUrl.Companion.toHttpUrl +private val applyJs = "javascript:(function(){var apply = document.getElementById(\"apply\").children[0];apply.click();})();" + @SuppressLint("SetJavaScriptEnabled") @Composable fun UConfigScreen() { @@ -47,18 +49,7 @@ fun UConfigScreen() { } }, actions = { - IconButton( - onClick = { - webview.get()?.loadUrl( - """ - javascript:(function() { - var apply = document.getElementById("apply").children[0]; - apply.click(); - })(); - """, - ) - }, - ) { + IconButton(onClick = { webview.get()?.loadUrl(applyJs) }) { Icon(imageVector = Icons.Default.Check, contentDescription = null) } },