From d1b533cbfa01f78950e1073c0b1c3905df0dcccd Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Fri, 7 Jun 2024 02:25:42 +0300 Subject: [PATCH] Move caption extension settings into template --- public/scripts/extensions/caption/index.js | 100 +----------------- .../scripts/extensions/caption/settings.html | 90 ++++++++++++++++ 2 files changed, 95 insertions(+), 95 deletions(-) create mode 100644 public/scripts/extensions/caption/settings.html diff --git a/public/scripts/extensions/caption/index.js b/public/scripts/extensions/caption/index.js index 7cdae323..c1ba2904 100644 --- a/public/scripts/extensions/caption/index.js +++ b/public/scripts/extensions/caption/index.js @@ -1,5 +1,5 @@ import { getBase64Async, isTrueBoolean, saveBase64AsFile } from '../../utils.js'; -import { getContext, getApiUrl, doExtrasFetch, extension_settings, modules } from '../../extensions.js'; +import { getContext, getApiUrl, doExtrasFetch, extension_settings, modules, renderExtensionTemplateAsync } from '../../extensions.js'; import { callPopup, getRequestHeaders, saveSettingsDebounced, substituteParams } from '../../../script.js'; import { getMessageTimeStamp } from '../../RossAscends-mods.js'; import { SECRET_KEYS, secret_state } from '../../secrets.js'; @@ -334,7 +334,7 @@ async function captionCommandCallback(args, prompt) { }); } -jQuery(function () { +jQuery(async function () { function addSendPictureButton() { const sendButton = $(`
@@ -399,102 +399,12 @@ jQuery(function () { saveSettingsDebounced(); }); } - function addSettings() { - const html = ` -
-
-
- Image Captioning -
-
-
- - -
-
- - -
-
- - -
- -
- Hint: Set your API keys and endpoints in the 'API Connections' tab first. -
-
-
- - - -
- - - -
-
-
- `; + async function addSettings() { + const html = await renderExtensionTemplateAsync('caption', 'settings'); $('#extensions_settings2').append(html); } - addSettings(); + await addSettings(); addPictureSendForm(); addSendPictureButton(); setImageIcon(); diff --git a/public/scripts/extensions/caption/settings.html b/public/scripts/extensions/caption/settings.html new file mode 100644 index 00000000..ee07d938 --- /dev/null +++ b/public/scripts/extensions/caption/settings.html @@ -0,0 +1,90 @@ + +
+
+
+ Image Captioning +
+
+
+ + +
+
+ + +
+
+ + +
+ +
+ Hint: Set your API keys and endpoints in the 'API Connections' tab first. +
+
+
+ + + +
+ + + +
+
+