Small updates
This commit is contained in:
parent
5bee381ea7
commit
71d47c0a23
16
README.md
16
README.md
@ -1,30 +1,30 @@
|
|||||||
# SillyTavern Extension Example
|
# 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
|
## 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 and Usage
|
||||||
|
|
||||||
### Installation
|
### 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
|
### Usage
|
||||||
|
|
||||||
Explain how to use this extension.
|
*Explain how to use this extension.*
|
||||||
|
|
||||||
## Prerequisites
|
## Prerequisites
|
||||||
|
|
||||||
Specify the version of ST necessary here.
|
*Specify the version of ST necessary here.*
|
||||||
|
|
||||||
## Support and Contributions
|
## Support and Contributions
|
||||||
|
|
||||||
Where should someone ask for support?
|
*Where should someone ask for support?*
|
||||||
How can they help add to this extension?
|
*How can they help add to this extension?*
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
Be cool, use an open source license.
|
*Be cool, use an open source license.*
|
27
index.js
27
index.js
@ -9,27 +9,24 @@ const extensionName = "example-extension";
|
|||||||
const extensionFolderPath = `scripts/extensions/third-party/${extensionName}/`;
|
const extensionFolderPath = `scripts/extensions/third-party/${extensionName}/`;
|
||||||
const extensionSettings = extension_settings[extensionName];
|
const extensionSettings = extension_settings[extensionName];
|
||||||
|
|
||||||
|
|
||||||
function onButtonClick() {
|
function onButtonClick() {
|
||||||
// This function is called when the button is clicked
|
// This function is called when the button is clicked
|
||||||
// You can do whatever you want here
|
// You can do whatever you want here
|
||||||
}
|
}
|
||||||
|
|
||||||
// This function is called when the extension is loaded
|
// This function is called when the extension is loaded
|
||||||
jQuery(async () => {
|
jQuery(async () => {
|
||||||
// This is an example of loading HTML from a file
|
// This is an example of loading HTML from a file
|
||||||
const settingsHtml = await $.get(
|
const settingsHtml = await $.get(`${extensionFolderPath}/example.html`);
|
||||||
`${extensionFolderPath}/example.html`
|
|
||||||
);
|
|
||||||
|
|
||||||
// Append settingsHtml to extensions_settings
|
// Append settingsHtml to extensions_settings
|
||||||
// extension_settings and extensions_settings2 are the left and right columns of the settings menu
|
// extension_settings and extensions_settings2 are the left and right columns of the settings menu
|
||||||
// You can append to either one
|
// You can append to either one
|
||||||
$("#extensions_settings").append(settingsHtml);
|
$("#extensions_settings").append(settingsHtml);
|
||||||
|
|
||||||
// These are examples of listening for events
|
// These are examples of listening for events
|
||||||
$("#my_button").on("click", onButtonClick());
|
$("#my_button").on("click", onButtonClick());
|
||||||
|
|
||||||
// Load settings when starting things up (if you have any)
|
// Load settings when starting things up (if you have any)
|
||||||
loadSettings();
|
loadSettings();
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user