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));");