Hide tag for character (#4019)

* Add tagOptions parameter to printTagList for character-specific filtering

* Add toggle functionality to hide tags in tag management popup

* Add translations for "Hide on character card" in multiple locale files

* Add is_hidden_on_character_card property to newTag function

* applied linter

* revert back `DEFAULT_TAGS_LIMIT`

* Remove debug logs

* Adjust HTML

* Render list and save settings on toggle change

* Make tag manager wide

---------

Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
This commit is contained in:
aalizelau
2025-05-20 10:41:03 -07:00
committed by GitHub
parent f181b46cfc
commit 77f5ef3424
18 changed files with 37 additions and 2 deletions

View File

@@ -6008,6 +6008,7 @@
<div title="Tag as folder" class="tag_as_folder fa-solid fa-folder-open right_menu_button" data-i18n="[title]Use tag as folder"> <div title="Tag as folder" class="tag_as_folder fa-solid fa-folder-open right_menu_button" data-i18n="[title]Use tag as folder">
<span class="tag_folder_indicator"></span> <span class="tag_folder_indicator"></span>
</div> </div>
<div class="right_menu_button fa-solid fa-eye fa-fw eye-toggle" title="Hide on character card" data-i18n="[title]Hide on character card"></div>
<div class="tag_view_color_picker" data-value="color"></div> <div class="tag_view_color_picker" data-value="color"></div>
<div class="tag_view_color_picker" data-value="color2"></div> <div class="tag_view_color_picker" data-value="color2"></div>
<div class="tag_view_name" contenteditable="true"></div> <div class="tag_view_name" contenteditable="true"></div>

View File

@@ -939,6 +939,7 @@
"Download chat as plain text document": "تنزيل الدردشة كمستند نصي عادي", "Download chat as plain text document": "تنزيل الدردشة كمستند نصي عادي",
"Delete chat file": "حذف ملف الدردشة", "Delete chat file": "حذف ملف الدردشة",
"Use tag as folder": "وضع علامة كمجلد", "Use tag as folder": "وضع علامة كمجلد",
"Hide on character card": "إخفاء في بطاقة الشخصية",
"Delete tag": "حذف العلامة", "Delete tag": "حذف العلامة",
"Entry Title/Memo": "عنوان الإدخال/المذكرة", "Entry Title/Memo": "عنوان الإدخال/المذكرة",
"WI Entry Status:🔵 Constant🟢 Normal🔗 Vectorized❌ Disabled": "حالة دخول وي:\r🔵 ثابت\r🟢 عادي\r🔗 ناقل\r❌ معطل", "WI Entry Status:🔵 Constant🟢 Normal🔗 Vectorized❌ Disabled": "حالة دخول وي:\r🔵 ثابت\r🟢 عادي\r🔗 ناقل\r❌ معطل",

View File

@@ -939,6 +939,7 @@
"Download chat as plain text document": "Chat als einfaches Textdokument herunterladen", "Download chat as plain text document": "Chat als einfaches Textdokument herunterladen",
"Delete chat file": "Chatdatei löschen", "Delete chat file": "Chatdatei löschen",
"Use tag as folder": "Als Ordner markieren", "Use tag as folder": "Als Ordner markieren",
"Hide on character card": "Auf Charakterkarte ausblenden",
"Delete tag": "Tag löschen", "Delete tag": "Tag löschen",
"Entry Title/Memo": "Eintragstitel/Memo", "Entry Title/Memo": "Eintragstitel/Memo",
"WI Entry Status:🔵 Constant🟢 Normal🔗 Vectorized❌ Disabled": "WI-Eintragstatus: 🔵 Konstant 🟢 Normal 🔗 Vektorisiert ❌ Deaktiviert", "WI Entry Status:🔵 Constant🟢 Normal🔗 Vectorized❌ Disabled": "WI-Eintragstatus: 🔵 Konstant 🟢 Normal 🔗 Vektorisiert ❌ Deaktiviert",

View File

@@ -939,6 +939,7 @@
"Download chat as plain text document": "Descargar chat como documento de texto sin formato", "Download chat as plain text document": "Descargar chat como documento de texto sin formato",
"Delete chat file": "Eliminar archivo de chat", "Delete chat file": "Eliminar archivo de chat",
"Use tag as folder": "Etiquetar como carpeta", "Use tag as folder": "Etiquetar como carpeta",
"Hide on character card": "Ocultar en la tarjeta del personaje",
"Delete tag": "Eliminar etiqueta", "Delete tag": "Eliminar etiqueta",
"Entry Title/Memo": "Título/Memo", "Entry Title/Memo": "Título/Memo",
"WI Entry Status:🔵 Constant🟢 Normal🔗 Vectorized❌ Disabled": "Estado de entrada a WI:\r🔵 Constante\r🟢Normal\r🔗 Vectorizado\r❌ Deshabilitado", "WI Entry Status:🔵 Constant🟢 Normal🔗 Vectorized❌ Disabled": "Estado de entrada a WI:\r🔵 Constante\r🟢Normal\r🔗 Vectorizado\r❌ Deshabilitado",

View File

@@ -884,6 +884,7 @@
"Download chat as plain text document": "Télécharger la discussion sous forme de document texte brut", "Download chat as plain text document": "Télécharger la discussion sous forme de document texte brut",
"Delete chat file": "Supprimer le fichier de discussion", "Delete chat file": "Supprimer le fichier de discussion",
"Use tag as folder": "Utiliser les tags comme dossier", "Use tag as folder": "Utiliser les tags comme dossier",
"Hide on character card": "Masquer sur la fiche du personnage",
"Delete tag": "Supprimer le tag'", "Delete tag": "Supprimer le tag'",
"Entry Title/Memo": "Titre de l'entrée/Mémo", "Entry Title/Memo": "Titre de l'entrée/Mémo",
"WI_Entry_Status_Constant": "Constante", "WI_Entry_Status_Constant": "Constante",

View File

@@ -939,6 +939,7 @@
"Download chat as plain text document": "Niðurhala spjalli sem einfaldan textaskjal", "Download chat as plain text document": "Niðurhala spjalli sem einfaldan textaskjal",
"Delete chat file": "Eyða spjallaskrá", "Delete chat file": "Eyða spjallaskrá",
"Use tag as folder": "Merktu sem mappa", "Use tag as folder": "Merktu sem mappa",
"Hide on character card": "Fela á persónukorti",
"Delete tag": "Eyða merki", "Delete tag": "Eyða merki",
"Entry Title/Memo": "Titill færslu/Minnisblað", "Entry Title/Memo": "Titill færslu/Minnisblað",
"WI Entry Status:🔵 Constant🟢 Normal🔗 Vectorized❌ Disabled": "WI inngangsstaða:\r🔵 Stöðugt\r😢 Venjulegt\r🔗 Vectorized\r❌ Óvirk", "WI Entry Status:🔵 Constant🟢 Normal🔗 Vectorized❌ Disabled": "WI inngangsstaða:\r🔵 Stöðugt\r😢 Venjulegt\r🔗 Vectorized\r❌ Óvirk",

View File

@@ -939,6 +939,7 @@
"Download chat as plain text document": "Scarica la chat come documento di testo semplice", "Download chat as plain text document": "Scarica la chat come documento di testo semplice",
"Delete chat file": "Elimina il file di chat", "Delete chat file": "Elimina il file di chat",
"Use tag as folder": "Contrassegna come cartella", "Use tag as folder": "Contrassegna come cartella",
"Hide on character card": "Nascondi sulla scheda del personaggio",
"Delete tag": "Elimina il tag", "Delete tag": "Elimina il tag",
"Entry Title/Memo": "Titolo/Memo dell'Ingresso", "Entry Title/Memo": "Titolo/Memo dell'Ingresso",
"WI Entry Status:🔵 Constant🟢 Normal🔗 Vectorized❌ Disabled": "Stato della voce WI:\r🔵 Costante\r🟢 Normale\r🔗 Vettorializzato\r❌Disabili", "WI Entry Status:🔵 Constant🟢 Normal🔗 Vectorized❌ Disabled": "Stato della voce WI:\r🔵 Costante\r🟢 Normale\r🔗 Vettorializzato\r❌Disabili",

View File

@@ -939,6 +939,7 @@
"Download chat as plain text document": "プレーンテキストドキュメントとしてチャットをダウンロード", "Download chat as plain text document": "プレーンテキストドキュメントとしてチャットをダウンロード",
"Delete chat file": "チャットファイルを削除", "Delete chat file": "チャットファイルを削除",
"Use tag as folder": "フォルダとしてタグ付け", "Use tag as folder": "フォルダとしてタグ付け",
"Hide on character card": "キャラクターカードで非表示",
"Delete tag": "タグを削除", "Delete tag": "タグを削除",
"Entry Title/Memo": "エントリータイトル/メモ", "Entry Title/Memo": "エントリータイトル/メモ",
"WI Entry Status:🔵 Constant🟢 Normal🔗 Vectorized❌ Disabled": "WI エントリ ステータス: 🔵 定数 🟢 通常 🔗 ベクトル化 ❌ 無効", "WI Entry Status:🔵 Constant🟢 Normal🔗 Vectorized❌ Disabled": "WI エントリ ステータス: 🔵 定数 🟢 通常 🔗 ベクトル化 ❌ 無効",

View File

@@ -955,6 +955,7 @@
"Download chat as plain text document": "일반 텍스트 문서로 채팅 다운로드", "Download chat as plain text document": "일반 텍스트 문서로 채팅 다운로드",
"Delete chat file": "채팅 파일 삭제", "Delete chat file": "채팅 파일 삭제",
"Use tag as folder": "폴더로 태그 지정", "Use tag as folder": "폴더로 태그 지정",
"Hide on character card": "캐릭터 카드에서 숨기기",
"Delete tag": "태그 삭제", "Delete tag": "태그 삭제",
"Entry Title/Memo": "항목 제목/메모", "Entry Title/Memo": "항목 제목/메모",
"WI Entry Status:🔵 Constant🟢 Normal🔗 Vectorized❌ Disabled": "WI 입국 상태:\r🔵 상시\r🟢 조건 만족시\r🔗 벡터화됨\r❌ 비활성화", "WI Entry Status:🔵 Constant🟢 Normal🔗 Vectorized❌ Disabled": "WI 입국 상태:\r🔵 상시\r🟢 조건 만족시\r🔗 벡터화됨\r❌ 비활성화",

View File

@@ -939,6 +939,7 @@
"Download chat as plain text document": "Download chat als plat tekstbestand", "Download chat as plain text document": "Download chat als plat tekstbestand",
"Delete chat file": "Chatbestand verwijderen", "Delete chat file": "Chatbestand verwijderen",
"Use tag as folder": "Taggen als map", "Use tag as folder": "Taggen als map",
"Hide on character card": "Verbergen op karakterkaart",
"Delete tag": "Tag verwijderen", "Delete tag": "Tag verwijderen",
"Entry Title/Memo": "Titel/Memo", "Entry Title/Memo": "Titel/Memo",
"WI Entry Status:🔵 Constant🟢 Normal🔗 Vectorized❌ Disabled": "WI-invoerstatus:\r🔵Constant\r🟢 Normaal\r🔗 Gevectoriseerd\r❌ Uitgeschakeld", "WI Entry Status:🔵 Constant🟢 Normal🔗 Vectorized❌ Disabled": "WI-invoerstatus:\r🔵Constant\r🟢 Normaal\r🔗 Gevectoriseerd\r❌ Uitgeschakeld",

View File

@@ -939,6 +939,7 @@
"Download chat as plain text document": "Baixar bate-papo como documento de texto simples", "Download chat as plain text document": "Baixar bate-papo como documento de texto simples",
"Delete chat file": "Excluir arquivo de bate-papo", "Delete chat file": "Excluir arquivo de bate-papo",
"Use tag as folder": "Marcar como pasta", "Use tag as folder": "Marcar como pasta",
"Hide on character card": "Ocultar no cartão do personagem",
"Delete tag": "Excluir tag", "Delete tag": "Excluir tag",
"Entry Title/Memo": "Título da Entrada/Memo", "Entry Title/Memo": "Título da Entrada/Memo",
"WI Entry Status:🔵 Constant🟢 Normal🔗 Vectorized❌ Disabled": "Status de entrada WI:\r🔵 Constante\r🟢 Normais\r🔗 Vetorizado\r❌ Desativado", "WI Entry Status:🔵 Constant🟢 Normal🔗 Vectorized❌ Disabled": "Status de entrada WI:\r🔵 Constante\r🟢 Normais\r🔗 Vetorizado\r❌ Desativado",

View File

@@ -2255,6 +2255,7 @@
"Manual": "Когда вы скажете", "Manual": "Когда вы скажете",
"Auto Mode delay": "Задержка авто-режима", "Auto Mode delay": "Задержка авто-режима",
"Use tag as folder": "Тег-папка", "Use tag as folder": "Тег-папка",
"Hide on character card": "Скрыть на карточке персонажа",
"All connections to ${0} have been removed.": "Все связи с персонажем ${0} были удалены.", "All connections to ${0} have been removed.": "Все связи с персонажем ${0} были удалены.",
"Personas Unlocked": "Персоны отвязаны", "Personas Unlocked": "Персоны отвязаны",
"Remove All Connections": "Удалить все связи", "Remove All Connections": "Удалить все связи",

View File

@@ -939,6 +939,7 @@
"Download chat as plain text document": "Завантажити чат як документ у форматі простого тексту", "Download chat as plain text document": "Завантажити чат як документ у форматі простого тексту",
"Delete chat file": "Видалити файл чату", "Delete chat file": "Видалити файл чату",
"Use tag as folder": "Позначити як папку", "Use tag as folder": "Позначити як папку",
"Hide on character card": "Сховати на картці персонажа",
"Delete tag": "Видалити тег", "Delete tag": "Видалити тег",
"Entry Title/Memo": "Заголовок запису", "Entry Title/Memo": "Заголовок запису",
"WI Entry Status:🔵 Constant🟢 Normal🔗 Vectorized❌ Disabled": "Статус вступу до WI:\r🔵 Постійно\r🟢 Нормально\r🔗 Векторизовано\r❌ Вимкнено", "WI Entry Status:🔵 Constant🟢 Normal🔗 Vectorized❌ Disabled": "Статус вступу до WI:\r🔵 Постійно\r🟢 Нормально\r🔗 Векторизовано\r❌ Вимкнено",

View File

@@ -939,6 +939,7 @@
"Download chat as plain text document": "Tải xuống cuộc trò chuyện dưới dạng tài liệu văn bản đơn giản", "Download chat as plain text document": "Tải xuống cuộc trò chuyện dưới dạng tài liệu văn bản đơn giản",
"Delete chat file": "Xóa tệp trò chuyện", "Delete chat file": "Xóa tệp trò chuyện",
"Use tag as folder": "Gắn thẻ dưới dạng thư mục", "Use tag as folder": "Gắn thẻ dưới dạng thư mục",
"Hide on character card": "Ẩn trên thẻ nhân vật",
"Delete tag": "Xóa tag", "Delete tag": "Xóa tag",
"Entry Title/Memo": "Tiêu đề Đăng nhập/Ghi chú", "Entry Title/Memo": "Tiêu đề Đăng nhập/Ghi chú",
"WI Entry Status:🔵 Constant🟢 Normal🔗 Vectorized❌ Disabled": "Trạng thái nhập WI:\r🔵 Hằng số\r🟢 Bình thường\r🔗 Được vector hóa\r❌ Bị vô hiệu hóa", "WI Entry Status:🔵 Constant🟢 Normal🔗 Vectorized❌ Disabled": "Trạng thái nhập WI:\r🔵 Hằng số\r🟢 Bình thường\r🔗 Được vector hóa\r❌ Bị vô hiệu hóa",

View File

@@ -1082,6 +1082,7 @@
"Delete chat file": "删除聊天文件", "Delete chat file": "删除聊天文件",
"Drag to reorder tag": "拖动以排序", "Drag to reorder tag": "拖动以排序",
"Use tag as folder": "标记为文件夹", "Use tag as folder": "标记为文件夹",
"Hide on character card": "在角色卡上隐藏",
"Delete tag": "删除标签", "Delete tag": "删除标签",
"Toggle entry's active state.": "切换条目激活状态。", "Toggle entry's active state.": "切换条目激活状态。",
"Entry Title/Memo": "条目标题/备忘录", "Entry Title/Memo": "条目标题/备忘录",

View File

@@ -940,6 +940,7 @@
"Delete chat file": "刪除聊天檔案", "Delete chat file": "刪除聊天檔案",
"Drag to reorder tag": "拖動以重新排序標籤", "Drag to reorder tag": "拖動以重新排序標籤",
"Use tag as folder": "將標籤作為資料夾", "Use tag as folder": "將標籤作為資料夾",
"Hide on character card": "在角色卡上隱藏標籤",
"Delete tag": "刪除標籤", "Delete tag": "刪除標籤",
"Entry Title/Memo": "條目標題/備註", "Entry Title/Memo": "條目標題/備註",
"WI Entry Status:🔵 Constant🟢 Normal🔗 Vectorized❌ Disabled": "世界資訊條目狀態:🔵常數 🟢正常 🔗向量 ❌停用", "WI Entry Status:🔵 Constant🟢 Normal🔗 Vectorized❌ Disabled": "世界資訊條目狀態:🔵常數 🟢正常 🔗向量 ❌停用",

View File

@@ -1499,7 +1499,7 @@ function getCharacterBlock(item, id) {
// Display inline tags // Display inline tags
const tagsElement = template.find('.tags'); const tagsElement = template.find('.tags');
printTagList(tagsElement, { forEntityOrKey: id }); printTagList(tagsElement, { forEntityOrKey: id, tagOptions: { isCharacterList: true } });
// Add to the list // Add to the list
return template; return template;

View File

@@ -136,6 +136,7 @@ const TAG_FOLDER_DEFAULT_TYPE = 'NONE';
* @property {string} [color] - The background color of the tag * @property {string} [color] - The background color of the tag
* @property {string} [color2] - The foreground color of the tag * @property {string} [color2] - The foreground color of the tag
* @property {number} [create_date] - A number representing the date when this tag was created * @property {number} [create_date] - A number representing the date when this tag was created
* @property {boolean} is_hidden_on_character_card - Whether this tag is hidden on the character card
* *
* @property {function} [action] - An optional function that gets executed when this tag is an actionable tag and is clicked on. * @property {function} [action] - An optional function that gets executed when this tag is an actionable tag and is clicked on.
* @property {string} [class] - An optional css class added to the control representing this tag when printed. Used for custom tags in the filters. * @property {string} [class] - An optional css class added to the control representing this tag when printed. Used for custom tags in the filters.
@@ -895,6 +896,7 @@ function newTag(tagName) {
folder_type: TAG_FOLDER_DEFAULT_TYPE, folder_type: TAG_FOLDER_DEFAULT_TYPE,
filter_state: DEFAULT_FILTER_STATE, filter_state: DEFAULT_FILTER_STATE,
sort_order: Math.max(0, ...tags.map(t => t.sort_order)) + 1, sort_order: Math.max(0, ...tags.map(t => t.sort_order)) + 1,
is_hidden_on_character_card: false,
color: '', color: '',
color2: '', color2: '',
create_date: Date.now(), create_date: Date.now(),
@@ -909,6 +911,7 @@ function newTag(tagName) {
* @property {(tag: Tag)=>boolean} [removeAction=undefined] - Action to perform on tag removal instead of the default remove action. If the action returns false, the tag will not be removed. * @property {(tag: Tag)=>boolean} [removeAction=undefined] - Action to perform on tag removal instead of the default remove action. If the action returns false, the tag will not be removed.
* @property {boolean} [isGeneralList=false] - If true, indicates that this is the general list of tags. * @property {boolean} [isGeneralList=false] - If true, indicates that this is the general list of tags.
* @property {boolean} [skipExistsCheck=false] - If true, the tag gets added even if a tag with the same id already exists. * @property {boolean} [skipExistsCheck=false] - If true, the tag gets added even if a tag with the same id already exists.
* @property {boolean} [isCharacterList=false] - If true, indicates that this is the character's list of tags.
*/ */
/** /**
@@ -934,6 +937,10 @@ function printTagList(element, { tags = undefined, addTag = undefined, forEntity
const key = forEntityOrKey !== undefined ? getTagKeyForEntity(forEntityOrKey) : getTagKey(); const key = forEntityOrKey !== undefined ? getTagKeyForEntity(forEntityOrKey) : getTagKey();
let printableTags = tags ? (typeof tags === 'function' ? tags() : tags) : getTagsList(key, sort); let printableTags = tags ? (typeof tags === 'function' ? tags() : tags) : getTagsList(key, sort);
if (tagOptions.isCharacterList) {
printableTags = printableTags.filter(tag => !tag.is_hidden_on_character_card);
}
if (empty === 'always' || (empty && (printableTags?.length > 0 || key))) { if (empty === 'always' || (empty && (printableTags?.length > 0 || key))) {
$element.empty(); $element.empty();
} }
@@ -1308,7 +1315,7 @@ async function onViewTagsListClick() {
printViewTagList(tagContainer); printViewTagList(tagContainer);
makeTagListDraggable(tagContainer); makeTagListDraggable(tagContainer);
await callGenericPopup(html, POPUP_TYPE.TEXT, null, { allowVerticalScrolling: true }); await callGenericPopup(html, POPUP_TYPE.TEXT, null, { allowVerticalScrolling: true, wide: true });
} }
/** /**
@@ -1594,6 +1601,18 @@ function appendViewTagToList(list, tag, everything) {
colorPicker[0].color = defaultColor; colorPicker[0].color = defaultColor;
}); });
const hideToggle = template.find('.eye-toggle');
hideToggle.toggleClass('fa-eye-slash', tag.is_hidden_on_character_card);
hideToggle.toggleClass('fa-eye', !tag.is_hidden_on_character_card);
hideToggle.on('click', () => {
tag.is_hidden_on_character_card = !tag.is_hidden_on_character_card;
hideToggle.toggleClass('fa-eye-slash', tag.is_hidden_on_character_card);
hideToggle.toggleClass('fa-eye', !tag.is_hidden_on_character_card);
printCharactersDebounced();
saveSettingsDebounced();
});
list.append(template); list.append(template);
// We prevent the popup from auto-close on Escape press on the color pickups. If the user really wants to, he can hit it again // We prevent the popup from auto-close on Escape press on the color pickups. If the user really wants to, he can hit it again