Display toast when narrator name is set

This commit is contained in:
SillyLossy
2023-05-17 21:02:09 +03:00
parent 60bf3f4a70
commit 3f8435f676
4 changed files with 25 additions and 3 deletions

12
package-lock.json generated
View File

@ -45,7 +45,8 @@
}, },
"devDependencies": { "devDependencies": {
"pkg": "^5.8.1", "pkg": "^5.8.1",
"pkg-fetch": "^3.5.2" "pkg-fetch": "^3.5.2",
"toastr": "^2.1.4"
} }
}, },
"node_modules/@babel/generator": { "node_modules/@babel/generator": {
@ -3031,6 +3032,15 @@
"node": ">=8.0" "node": ">=8.0"
} }
}, },
"node_modules/toastr": {
"version": "2.1.4",
"resolved": "https://registry.npmjs.org/toastr/-/toastr-2.1.4.tgz",
"integrity": "sha512-LIy77F5n+sz4tefMmFOntcJ6HL0Fv3k1TDnNmFZ0bU/GcvIIfy6eG2v7zQmMiYgaalAiUv75ttFrPn5s0gyqlA==",
"dev": true,
"dependencies": {
"jquery": ">=1.12.0"
}
},
"node_modules/toidentifier": { "node_modules/toidentifier": {
"version": "1.0.1", "version": "1.0.1",
"license": "MIT", "license": "MIT",

View File

@ -72,6 +72,7 @@
}, },
"devDependencies": { "devDependencies": {
"pkg": "^5.8.1", "pkg": "^5.8.1",
"pkg-fetch": "^3.5.2" "pkg-fetch": "^3.5.2",
"toastr": "^2.1.4"
} }
} }

View File

@ -2577,6 +2577,15 @@
<div id="rawPromptPopup" class="list-group"> <div id="rawPromptPopup" class="list-group">
<div id="rawPromptWrapper" class="tokenItemizingSubclass"></div> <div id="rawPromptWrapper" class="tokenItemizingSubclass"></div>
</div> </div>
<script>
// Configure toast library:
toastr.options.escapeHtml = true; // Prevent raw HTML inserts
toastr.options.timeOut = 3000; // How long the toast will display without user interaction
toastr.options.extendedTimeOut = 10000; // How long the toast will display after a user hovers over it
toastr.options.progressBar = true; // Visually indicate how long before a toast expires.
toastr.options.closeButton = true; // enable a close button
</script>
</body> </body>
</html> </html>

View File

@ -88,7 +88,9 @@ const NARRATOR_NAME_KEY = 'narrator_name';
const NARRATOR_NAME_DEFAULT = 'System'; const NARRATOR_NAME_DEFAULT = 'System';
function setNarratorName(_, text) { function setNarratorName(_, text) {
chat_metadata[NARRATOR_NAME_KEY] = text || NARRATOR_NAME_DEFAULT; const name = text || NARRATOR_NAME_DEFAULT;
chat_metadata[NARRATOR_NAME_KEY] = name;
toastr.info(`System narrator name set to ${name}`);
saveChatConditional(); saveChatConditional();
} }