From fe21a7c25b38c7040141f1fcbca8428e93822757 Mon Sep 17 00:00:00 2001 From: RossAscends <124905043+RossAscends@users.noreply.github.com> Date: Wed, 22 Nov 2023 07:48:35 +0900 Subject: [PATCH] Add toggle for hiding muted group member sprites --- public/index.html | 6 +++++- .../scripts/extensions/expressions/index.js | 3 ++- public/scripts/group-chats.js | 21 ++++++++++++++++++- 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/public/index.html b/public/index.html index 0522f9bee..a09e83e72 100644 --- a/public/index.html +++ b/public/index.html @@ -3510,6 +3510,10 @@ Auto Mode + @@ -4843,4 +4847,4 @@ - + \ No newline at end of file diff --git a/public/scripts/extensions/expressions/index.js b/public/scripts/extensions/expressions/index.js index 40e0c36c4..eea4a8655 100644 --- a/public/scripts/extensions/expressions/index.js +++ b/public/scripts/extensions/expressions/index.js @@ -4,6 +4,7 @@ import { getContext, getApiUrl, modules, extension_settings, ModuleWorkerWrapper import { loadMovingUIState, power_user } from "../../power-user.js"; import { registerSlashCommand } from "../../slash-commands.js"; import { onlyUnique, debounce, getCharaFilename, trimToEndSentence, trimToStartSentence } from "../../utils.js"; +import { hideMutedSprites } from "../../group-chats.js"; export { MODULE_NAME }; const MODULE_NAME = 'expressions'; @@ -118,7 +119,7 @@ async function visualNovelSetCharacterSprites(container, name, expression) { const isDisabled = group.disabled_members.includes(avatar); // skip disabled characters - if (isDisabled) { + if (isDisabled && hideMutedSprites) { continue; } diff --git a/public/scripts/group-chats.js b/public/scripts/group-chats.js index 12f20839e..89244f0f3 100644 --- a/public/scripts/group-chats.js +++ b/public/scripts/group-chats.js @@ -76,6 +76,7 @@ import { FILTER_TYPES, FilterHelper } from './filters.js'; export { selected_group, is_group_automode_enabled, + hideMutedSprites, is_group_generating, group_generation_id, groups, @@ -92,6 +93,7 @@ export { let is_group_generating = false; // Group generation flag let is_group_automode_enabled = false; +let hideMutedSprites = true; let groups = []; let selected_group = null; let group_generation_id = null; @@ -1172,7 +1174,7 @@ function printGroupCandidates() { function printGroupMembers() { const storageKey = 'GroupMembers_PerPage'; - $(".rm_group_members_pagination").each(function() { + $(".rm_group_members_pagination").each(function () { $(this).pagination({ dataSource: getGroupCharacters({ doFilter: false, onlyMembers: true }), pageRange: 1, @@ -1258,6 +1260,15 @@ async function onGroupSelfResponsesClick() { } } +async function onHideMutedSpritesClick(value) { + if (openGroupId) { + let _thisGroup = groups.find((x) => x.id == openGroupId); + _thisGroup.hideMutedSprites = value; + console.log(`_thisGroup.hideMutedSprites = ${_thisGroup.hideMutedSprites}`) + await editGroup(openGroupId, false, false); + } +} + function select_group_chats(groupId, skipAnimation) { openGroupId = groupId; newGroupMembers = []; @@ -1287,6 +1298,7 @@ function select_group_chats(groupId, skipAnimation) { const groupHasMembers = !!$("#rm_group_members").children().length; $("#rm_group_submit").prop("disabled", !groupHasMembers); $("#rm_group_allow_self_responses").prop("checked", group && group.allow_self_responses); + $("#rm_group_hidemutedsprites").prop("checked", group && group.hideMutedSprites); // bottom buttons if (openGroupId) { @@ -1517,6 +1529,7 @@ async function createGroup() { members: members, avatar_url: isValidImageUrl(avatar_url) ? avatar_url : default_avatar, allow_self_responses: allowSelfResponses, + hideMutedSprites: hideMutedSprites, activation_strategy: activationStrategy, generation_mode: generationMode, disabled_members: [], @@ -1784,6 +1797,12 @@ jQuery(() => { is_group_automode_enabled = value; eventSource.once(event_types.GENERATION_STOPPED, stopAutoModeGeneration); }); + $("#rm_group_hidemutedsprites").on("input", function () { + const value = $(this).prop("checked"); + hideMutedSprites = value; + onHideMutedSpritesClick(value); + + }); $("#send_textarea").on("keyup", onSendTextareaInput); $("#groupCurrentMemberPopoutButton").on('click', doCurMemberListPopout); $("#rm_group_chat_name").on("input", onGroupNameInput)