From 1911578b7eb18b6ed6704278f9cdc1956f4eb9ec Mon Sep 17 00:00:00 2001 From: liwenrui Date: Tue, 5 Mar 2024 15:21:15 +0800 Subject: [PATCH] * fix ai stuff relied on js(). --- module/ai/ui/inputinject.html.php | 4 +++- module/ai/ui/promptexecute.html.php | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/module/ai/ui/inputinject.html.php b/module/ai/ui/inputinject.html.php index 3899d7aad6..d8204e2a9b 100644 --- a/module/ai/ui/inputinject.html.php +++ b/module/ai/ui/inputinject.html.php @@ -30,7 +30,8 @@ $inputInject = function() $this->app->loadLang('ai'); - js(<<< JAVASCRIPT + h::globalJS(<<< JAVASCRIPT + (() => { window.injectToInputElement = (inputName, data, index, tries = 0) => { let name = inputName; @@ -178,6 +179,7 @@ $inputInject = function() } } }); + })(); JAVASCRIPT); /* TODO: handle prompt audit, see original ../view/inputinject.html.php. */ diff --git a/module/ai/ui/promptexecute.html.php b/module/ai/ui/promptexecute.html.php index 829ca2929a..4ad3b3ab43 100644 --- a/module/ai/ui/promptexecute.html.php +++ b/module/ai/ui/promptexecute.html.php @@ -3,4 +3,4 @@ declare(strict_types=1); namespace zin; -js("requestAnimationFrame(() => setTimeout(() => openUrl(`{$formLocation}`), 1000));"); +h::globalJS("requestAnimationFrame(() => setTimeout(() => openUrl(`{$formLocation}`), 1000));");