diff --git a/public/script.js b/public/script.js index cd6e0a3b4..3e47b0880 100644 --- a/public/script.js +++ b/public/script.js @@ -1213,6 +1213,13 @@ function addOneMessage(mes, { type = "normal", insertAfter = null, scroll = true messageText = mes.extra.display_text; } + // Forbidden black magic + // This allows to use "continue" on user messages + if (type === 'swipe' && mes.swipe_id === undefined) { + mes.swipe_id = 0; + mes.swipes = [mes.mes]; + } + if (mes.name === name1) { var characterName = name1; //set to user's name by default } else { var characterName = mes.name } diff --git a/public/scripts/power-user.js b/public/scripts/power-user.js index b8acf84bc..4c0b04544 100644 --- a/public/scripts/power-user.js +++ b/public/scripts/power-user.js @@ -51,7 +51,7 @@ const avatar_styles = { RECTANGULAR: 1, } -const chat_styles = { +export const chat_styles = { DEFAULT: 0, BUBBLES: 1, DOCUMENT: 2, diff --git a/public/scripts/slash-commands.js b/public/scripts/slash-commands.js index d4c263f5e..312561779 100644 --- a/public/scripts/slash-commands.js +++ b/public/scripts/slash-commands.js @@ -21,7 +21,7 @@ import { saveSettings, } from "../script.js"; import { humanizedDateTime } from "./RossAscends-mods.js"; -import { power_user } from "./power-user.js"; +import { chat_styles, power_user } from "./power-user.js"; export { executeSlashCommands, registerSlashCommand, @@ -107,11 +107,19 @@ parser.addCommand('sendas', sendMessageAs, [], ` – sends message as a specific parser.addCommand('sys', sendNarratorMessage, [], '(text) – sends message as a system narrator', false, true); parser.addCommand('sysname', setNarratorName, [], '(name) – sets a name for future system narrator messages in this chat (display only). Default: System. Leave empty to reset.', true, true); parser.addCommand('comment', sendCommentMessage, [], '(text) – adds a note/comment message not part of the chat', false, true); +parser.addCommand('single', setStoryModeCallback, ['story'], ' – sets the message style to single document mode without names or avatars visible', true, true); +parser.addCommand('bubble', setBubbleModeCallback, ['bubbles'], ' – sets the message style to bubble chat mode', true, true); +parser.addCommand('flat', setFlatModeCallback, ['default'], ' – sets the message style to flat chat mode', true, true); +parser.addCommand('continue', continueChatCallback, ['cont'], ' – continues the last message in the chat', true, true); const NARRATOR_NAME_KEY = 'narrator_name'; const NARRATOR_NAME_DEFAULT = 'System'; const COMMENT_NAME_DEFAULT = 'Note'; +function continueChatCallback() { + $('#option_continue').trigger('click'); +} + function syncCallback() { $('#sync_name_button').trigger('click'); } @@ -120,6 +128,18 @@ function bindCallback() { $('#lock_user_name').trigger('click'); } +function setStoryModeCallback() { + $('#chat_display').val(chat_styles.DOCUMENT).trigger('change'); +} + +function setBubbleModeCallback() { + $('#chat_display').val(chat_styles.BUBBLES).trigger('change'); +} + +function setFlatModeCallback() { + $('#chat_display').val(chat_styles.DEFAULT).trigger('change'); +} + function setNameCallback(_, name) { if (!name) { toastr.warning('you must specify a name to change to')