mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Redesigned assets connect button
This commit is contained in:
@@ -97,7 +97,8 @@ function downloadAssetsList(url) {
|
|||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
toastr.error("Problem with assets URL",DEBUG_PREFIX+"Cannot get assets list")
|
toastr.error("Problem with assets URL",DEBUG_PREFIX+"Cannot get assets list");
|
||||||
|
$('#assets-connect-button').addClass("fa-plug-circle-xmark");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -159,19 +160,25 @@ jQuery(async () => {
|
|||||||
// This is an example of loading HTML from a file
|
// This is an example of loading HTML from a file
|
||||||
const windowHtml = $(await $.get(`${extensionFolderPath}/window.html`));
|
const windowHtml = $(await $.get(`${extensionFolderPath}/window.html`));
|
||||||
|
|
||||||
const assetsJsonUrl = windowHtml.find('#assets_json_url_field');
|
const assetsJsonUrl = windowHtml.find('#assets-json-url-field');
|
||||||
assetsJsonUrl.val(ASSETS_JSON_URL);
|
assetsJsonUrl.val(ASSETS_JSON_URL);
|
||||||
|
|
||||||
const connectButton = windowHtml.find('#assets_connect_button');
|
const connectButton = windowHtml.find('#assets-connect-button');
|
||||||
connectButton.on("click", async function(){
|
connectButton.on("click", async function(){
|
||||||
const confirmation = await callPopup(`Are you sure you want to connect to '${assetsJsonUrl.val()}'?`, 'confirm')
|
const confirmation = await callPopup(`Are you sure you want to connect to '${assetsJsonUrl.val()}'?`, 'confirm')
|
||||||
if (confirmation) {
|
if (confirmation) {
|
||||||
try {
|
try {
|
||||||
console.debug(DEBUG_PREFIX,"Confimation, loading assets...");
|
console.debug(DEBUG_PREFIX,"Confimation, loading assets...");
|
||||||
downloadAssetsList(assetsJsonUrl.val());
|
downloadAssetsList(assetsJsonUrl.val());
|
||||||
|
connectButton.removeClass("fa-plug");
|
||||||
|
connectButton.removeClass("fa-plug-circle-xmark");
|
||||||
|
connectButton.addClass("fa-plug-circle-check");
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error:', error);
|
console.error('Error:', error);
|
||||||
toastr.error(`Cannot get assets list from ${assetsJsonUrl.val()}`);
|
toastr.error(`Cannot get assets list from ${assetsJsonUrl.val()}`);
|
||||||
|
connectButton.removeClass("fa-plug");
|
||||||
|
connectButton.removeClass("fa-plug-circle-check");
|
||||||
|
connectButton.addClass("fa-plug-circle-xmark");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@@ -1,6 +1,17 @@
|
|||||||
|
#assets-json-url-field {
|
||||||
|
width: 350px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#assets-connect-button {
|
||||||
|
width: 50px;
|
||||||
|
height: 50px;
|
||||||
|
margin-left: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
.assets-connect-div {
|
.assets-connect-div {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
|
padding: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.assets-list-div i {
|
.assets-list-div i {
|
||||||
|
@@ -6,10 +6,10 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="inline-drawer-content">
|
<div class="inline-drawer-content">
|
||||||
<div class="assets-connect-div">
|
<div class="assets-connect-div">
|
||||||
<label for="assets_json_url_field">Assets URL
|
<label for="assets-json-url-field">Assets URL
|
||||||
<input id="assets_json_url_field" class="flex1 heightFitContent text_pole widthNatural">
|
<input id="assets-json-url-field" class="text_pole">
|
||||||
</label>
|
</label>
|
||||||
<input id="assets_connect_button" class="menu_button" value="Connect">
|
<i id="assets-connect-button" class="menu_button fa-solid fa-plug fa-xl"></i>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<p>Please refresh ST after downloading new asset to use them.</p>
|
<p>Please refresh ST after downloading new asset to use them.</p>
|
||||||
|
Reference in New Issue
Block a user