aboutsummaryrefslogtreecommitdiff
path: root/modules/ui.py
diff options
context:
space:
mode:
authorAUTOMATIC <16777216c@gmail.com>2022-09-18 08:37:03 +0300
committerAUTOMATIC <16777216c@gmail.com>2022-09-18 08:37:03 +0300
commita86c2794197692fe3cfab06247d0d20423e401cd (patch)
treeb93c86c70688fdea4ee7bc26411a95334cf1cf7a /modules/ui.py
parent3f91de3c9193fd5ff5293a62875e637cd6f1ef84 (diff)
script.js split work
Diffstat (limited to 'modules/ui.py')
-rw-r--r--modules/ui.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/modules/ui.py b/modules/ui.py
index 2f6eb307..202f4551 100644
--- a/modules/ui.py
+++ b/modules/ui.py
@@ -908,12 +908,17 @@ def create_ui(txt2img, img2img, run_extras, run_pnginfo):
with open(os.path.join(script_path, "script.js"), "r", encoding="utf8") as jsfile:
- javascript = jsfile.read()
+ javascript = f'<script>{jsfile.read()}</script>'
+
+jsdir = os.path.join(script_path, "javascript")
+for filename in os.listdir(jsdir):
+ with open(os.path.join(jsdir, filename), "r", encoding="utf8") as jsfile:
+ javascript += f"\n<script>{jsfile.read()}</script>"
def template_response(*args, **kwargs):
res = gradio_routes_templates_response(*args, **kwargs)
- res.body = res.body.replace(b'</head>', f'<script>{javascript}</script></head>'.encode("utf8"))
+ res.body = res.body.replace(b'</head>', f'{javascript}</head>'.encode("utf8"))
res.init_headers()
return res