Small updates

This commit is contained in:
city-unit 2023-07-23 18:59:38 -04:00
parent 5bee381ea7
commit 71d47c0a23
2 changed files with 20 additions and 23 deletions

View File

@ -1,30 +1,30 @@
# SillyTavern Extension Example
Provide a brief description of how your extension works, what problem it aims to solve.
*Provide a brief description of how your extension works, what problem it aims to solve.*
## Features
Describe some of the main selling points of your extension.
*Describe some of the main selling points of your extension.*
## Installation and Usage
### Installation
In most cases, this should just be using ST's inbuilt extension installer.
*In most cases, this should just be using ST's inbuilt extension installer.*
### Usage
Explain how to use this extension.
*Explain how to use this extension.*
## Prerequisites
Specify the version of ST necessary here.
*Specify the version of ST necessary here.*
## Support and Contributions
Where should someone ask for support?
How can they help add to this extension?
*Where should someone ask for support?*
*How can they help add to this extension?*
## License
Be cool, use an open source license.
*Be cool, use an open source license.*

View File

@ -9,27 +9,24 @@ const extensionName = "example-extension";
const extensionFolderPath = `scripts/extensions/third-party/${extensionName}/`;
const extensionSettings = extension_settings[extensionName];
function onButtonClick() {
// This function is called when the button is clicked
// You can do whatever you want here
// This function is called when the button is clicked
// You can do whatever you want here
}
// This function is called when the extension is loaded
jQuery(async () => {
// This is an example of loading HTML from a file
const settingsHtml = await $.get(
`${extensionFolderPath}/example.html`
);
// This is an example of loading HTML from a file
const settingsHtml = await $.get(`${extensionFolderPath}/example.html`);
// Append settingsHtml to extensions_settings
// extension_settings and extensions_settings2 are the left and right columns of the settings menu
// You can append to either one
$("#extensions_settings").append(settingsHtml);
// Append settingsHtml to extensions_settings
// extension_settings and extensions_settings2 are the left and right columns of the settings menu
// You can append to either one
$("#extensions_settings").append(settingsHtml);
// These are examples of listening for events
$("#my_button").on("click", onButtonClick());
// These are examples of listening for events
$("#my_button").on("click", onButtonClick());
// Load settings when starting things up (if you have any)
loadSettings();
// Load settings when starting things up (if you have any)
loadSettings();
});