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>

77f5ef34248bef39cc5cf7279efe81196789d686

aalizelau <aalizelau@gmail.com>

Signed
18 files changed, +37 -2Ignore whitespace
public/index.html+1 -0
@@ -6008,6 +6008,7 @@
6008 <div title="Tag as folder" class="tag_as_folder fa-solid fa-folder-open right_menu_button" data-i18n="[title]Use tag as folder">6008 <div title="Tag as folder" class="tag_as_folder fa-solid fa-folder-open right_menu_button" data-i18n="[title]Use tag as folder">
6009 <span class="tag_folder_indicator"></span>6009 <span class="tag_folder_indicator"></span>
6010 </div>6010 </div>
6011 <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>
6011 <div class="tag_view_color_picker" data-value="color"></div>6012 <div class="tag_view_color_picker" data-value="color"></div>
6012 <div class="tag_view_color_picker" data-value="color2"></div>6013 <div class="tag_view_color_picker" data-value="color2"></div>
6013 <div class="tag_view_name" contenteditable="true"></div>6014 <div class="tag_view_name" contenteditable="true"></div>
public/locales/ar-sa.json+1 -0
@@ -939,6 +939,7 @@
939 "Download chat as plain text document": "تنزيل الدردشة كمستند نصي عادي",939 "Download chat as plain text document": "تنزيل الدردشة كمستند نصي عادي",
940 "Delete chat file": "حذف ملف الدردشة",940 "Delete chat file": "حذف ملف الدردشة",
941 "Use tag as folder": "وضع علامة كمجلد",941 "Use tag as folder": "وضع علامة كمجلد",
942 "Hide on character card": "إخفاء في بطاقة الشخصية",
942 "Delete tag": "حذف العلامة",943 "Delete tag": "حذف العلامة",
943 "Entry Title/Memo": "عنوان الإدخال/المذكرة",944 "Entry Title/Memo": "عنوان الإدخال/المذكرة",
944 "WI Entry Status:🔵 Constant🟢 Normal🔗 Vectorized❌ Disabled": "حالة دخول وي:\r🔵 ثابت\r🟢 عادي\r🔗 ناقل\r❌ معطل",945 "WI Entry Status:🔵 Constant🟢 Normal🔗 Vectorized❌ Disabled": "حالة دخول وي:\r🔵 ثابت\r🟢 عادي\r🔗 ناقل\r❌ معطل",
public/locales/de-de.json+1 -0
@@ -939,6 +939,7 @@
939 "Download chat as plain text document": "Chat als einfaches Textdokument herunterladen",939 "Download chat as plain text document": "Chat als einfaches Textdokument herunterladen",
940 "Delete chat file": "Chatdatei löschen",940 "Delete chat file": "Chatdatei löschen",
941 "Use tag as folder": "Als Ordner markieren",941 "Use tag as folder": "Als Ordner markieren",
942 "Hide on character card": "Auf Charakterkarte ausblenden",
942 "Delete tag": "Tag löschen",943 "Delete tag": "Tag löschen",
943 "Entry Title/Memo": "Eintragstitel/Memo",944 "Entry Title/Memo": "Eintragstitel/Memo",
944 "WI Entry Status:🔵 Constant🟢 Normal🔗 Vectorized❌ Disabled": "WI-Eintragstatus: 🔵 Konstant 🟢 Normal 🔗 Vektorisiert ❌ Deaktiviert",945 "WI Entry Status:🔵 Constant🟢 Normal🔗 Vectorized❌ Disabled": "WI-Eintragstatus: 🔵 Konstant 🟢 Normal 🔗 Vektorisiert ❌ Deaktiviert",
public/locales/es-es.json+1 -0
@@ -939,6 +939,7 @@
939 "Download chat as plain text document": "Descargar chat como documento de texto sin formato",939 "Download chat as plain text document": "Descargar chat como documento de texto sin formato",
940 "Delete chat file": "Eliminar archivo de chat",940 "Delete chat file": "Eliminar archivo de chat",
941 "Use tag as folder": "Etiquetar como carpeta",941 "Use tag as folder": "Etiquetar como carpeta",
942 "Hide on character card": "Ocultar en la tarjeta del personaje",
942 "Delete tag": "Eliminar etiqueta",943 "Delete tag": "Eliminar etiqueta",
943 "Entry Title/Memo": "Título/Memo",944 "Entry Title/Memo": "Título/Memo",
944 "WI Entry Status:🔵 Constant🟢 Normal🔗 Vectorized❌ Disabled": "Estado de entrada a WI:\r🔵 Constante\r🟢Normal\r🔗 Vectorizado\r❌ Deshabilitado",945 "WI Entry Status:🔵 Constant🟢 Normal🔗 Vectorized❌ Disabled": "Estado de entrada a WI:\r🔵 Constante\r🟢Normal\r🔗 Vectorizado\r❌ Deshabilitado",
public/locales/fr-fr.json+1 -0
@@ -884,6 +884,7 @@
884 "Download chat as plain text document": "Télécharger la discussion sous forme de document texte brut",884 "Download chat as plain text document": "Télécharger la discussion sous forme de document texte brut",
885 "Delete chat file": "Supprimer le fichier de discussion",885 "Delete chat file": "Supprimer le fichier de discussion",
886 "Use tag as folder": "Utiliser les tags comme dossier",886 "Use tag as folder": "Utiliser les tags comme dossier",
887 "Hide on character card": "Masquer sur la fiche du personnage",
887 "Delete tag": "Supprimer le tag'",888 "Delete tag": "Supprimer le tag'",
888 "Entry Title/Memo": "Titre de l'entrée/Mémo",889 "Entry Title/Memo": "Titre de l'entrée/Mémo",
889 "WI_Entry_Status_Constant": "Constante",890 "WI_Entry_Status_Constant": "Constante",
public/locales/is-is.json+1 -0
@@ -939,6 +939,7 @@
939 "Download chat as plain text document": "Niðurhala spjalli sem einfaldan textaskjal",939 "Download chat as plain text document": "Niðurhala spjalli sem einfaldan textaskjal",
940 "Delete chat file": "Eyða spjallaskrá",940 "Delete chat file": "Eyða spjallaskrá",
941 "Use tag as folder": "Merktu sem mappa",941 "Use tag as folder": "Merktu sem mappa",
942 "Hide on character card": "Fela á persónukorti",
942 "Delete tag": "Eyða merki",943 "Delete tag": "Eyða merki",
943 "Entry Title/Memo": "Titill færslu/Minnisblað",944 "Entry Title/Memo": "Titill færslu/Minnisblað",
944 "WI Entry Status:🔵 Constant🟢 Normal🔗 Vectorized❌ Disabled": "WI inngangsstaða:\r🔵 Stöðugt\r😢 Venjulegt\r🔗 Vectorized\r❌ Óvirk",945 "WI Entry Status:🔵 Constant🟢 Normal🔗 Vectorized❌ Disabled": "WI inngangsstaða:\r🔵 Stöðugt\r😢 Venjulegt\r🔗 Vectorized\r❌ Óvirk",
public/locales/it-it.json+1 -0
@@ -939,6 +939,7 @@
939 "Download chat as plain text document": "Scarica la chat come documento di testo semplice",939 "Download chat as plain text document": "Scarica la chat come documento di testo semplice",
940 "Delete chat file": "Elimina il file di chat",940 "Delete chat file": "Elimina il file di chat",
941 "Use tag as folder": "Contrassegna come cartella",941 "Use tag as folder": "Contrassegna come cartella",
942 "Hide on character card": "Nascondi sulla scheda del personaggio",
942 "Delete tag": "Elimina il tag",943 "Delete tag": "Elimina il tag",
943 "Entry Title/Memo": "Titolo/Memo dell'Ingresso",944 "Entry Title/Memo": "Titolo/Memo dell'Ingresso",
944 "WI Entry Status:🔵 Constant🟢 Normal🔗 Vectorized❌ Disabled": "Stato della voce WI:\r🔵 Costante\r🟢 Normale\r🔗 Vettorializzato\r❌Disabili",945 "WI Entry Status:🔵 Constant🟢 Normal🔗 Vectorized❌ Disabled": "Stato della voce WI:\r🔵 Costante\r🟢 Normale\r🔗 Vettorializzato\r❌Disabili",
public/locales/ja-jp.json+1 -0
@@ -939,6 +939,7 @@
939 "Download chat as plain text document": "プレーンテキストドキュメントとしてチャットをダウンロード",939 "Download chat as plain text document": "プレーンテキストドキュメントとしてチャットをダウンロード",
940 "Delete chat file": "チャットファイルを削除",940 "Delete chat file": "チャットファイルを削除",
941 "Use tag as folder": "フォルダとしてタグ付け",941 "Use tag as folder": "フォルダとしてタグ付け",
942 "Hide on character card": "キャラクターカードで非表示",
942 "Delete tag": "タグを削除",943 "Delete tag": "タグを削除",
943 "Entry Title/Memo": "エントリータイトル/メモ",944 "Entry Title/Memo": "エントリータイトル/メモ",
944 "WI Entry Status:🔵 Constant🟢 Normal🔗 Vectorized❌ Disabled": "WI エントリ ステータス: 🔵 定数 🟢 通常 🔗 ベクトル化 ❌ 無効",945 "WI Entry Status:🔵 Constant🟢 Normal🔗 Vectorized❌ Disabled": "WI エントリ ステータス: 🔵 定数 🟢 通常 🔗 ベクトル化 ❌ 無効",
public/locales/ko-kr.json+1 -0
@@ -955,6 +955,7 @@
955 "Download chat as plain text document": "일반 텍스트 문서로 채팅 다운로드",955 "Download chat as plain text document": "일반 텍스트 문서로 채팅 다운로드",
956 "Delete chat file": "채팅 파일 삭제",956 "Delete chat file": "채팅 파일 삭제",
957 "Use tag as folder": "폴더로 태그 지정",957 "Use tag as folder": "폴더로 태그 지정",
958 "Hide on character card": "캐릭터 카드에서 숨기기",
958 "Delete tag": "태그 삭제",959 "Delete tag": "태그 삭제",
959 "Entry Title/Memo": "항목 제목/메모",960 "Entry Title/Memo": "항목 제목/메모",
960 "WI Entry Status:🔵 Constant🟢 Normal🔗 Vectorized❌ Disabled": "WI 입국 상태:\r🔵 상시\r🟢 조건 만족시\r🔗 벡터화됨\r❌ 비활성화",961 "WI Entry Status:🔵 Constant🟢 Normal🔗 Vectorized❌ Disabled": "WI 입국 상태:\r🔵 상시\r🟢 조건 만족시\r🔗 벡터화됨\r❌ 비활성화",
public/locales/nl-nl.json+1 -0
@@ -939,6 +939,7 @@
939 "Download chat as plain text document": "Download chat als plat tekstbestand",939 "Download chat as plain text document": "Download chat als plat tekstbestand",
940 "Delete chat file": "Chatbestand verwijderen",940 "Delete chat file": "Chatbestand verwijderen",
941 "Use tag as folder": "Taggen als map",941 "Use tag as folder": "Taggen als map",
942 "Hide on character card": "Verbergen op karakterkaart",
942 "Delete tag": "Tag verwijderen",943 "Delete tag": "Tag verwijderen",
943 "Entry Title/Memo": "Titel/Memo",944 "Entry Title/Memo": "Titel/Memo",
944 "WI Entry Status:🔵 Constant🟢 Normal🔗 Vectorized❌ Disabled": "WI-invoerstatus:\r🔵Constant\r🟢 Normaal\r🔗 Gevectoriseerd\r❌ Uitgeschakeld",945 "WI Entry Status:🔵 Constant🟢 Normal🔗 Vectorized❌ Disabled": "WI-invoerstatus:\r🔵Constant\r🟢 Normaal\r🔗 Gevectoriseerd\r❌ Uitgeschakeld",
public/locales/pt-pt.json+1 -0
@@ -939,6 +939,7 @@
939 "Download chat as plain text document": "Baixar bate-papo como documento de texto simples",939 "Download chat as plain text document": "Baixar bate-papo como documento de texto simples",
940 "Delete chat file": "Excluir arquivo de bate-papo",940 "Delete chat file": "Excluir arquivo de bate-papo",
941 "Use tag as folder": "Marcar como pasta",941 "Use tag as folder": "Marcar como pasta",
942 "Hide on character card": "Ocultar no cartão do personagem",
942 "Delete tag": "Excluir tag",943 "Delete tag": "Excluir tag",
943 "Entry Title/Memo": "Título da Entrada/Memo",944 "Entry Title/Memo": "Título da Entrada/Memo",
944 "WI Entry Status:🔵 Constant🟢 Normal🔗 Vectorized❌ Disabled": "Status de entrada WI:\r🔵 Constante\r🟢 Normais\r🔗 Vetorizado\r❌ Desativado",945 "WI Entry Status:🔵 Constant🟢 Normal🔗 Vectorized❌ Disabled": "Status de entrada WI:\r🔵 Constante\r🟢 Normais\r🔗 Vetorizado\r❌ Desativado",
public/locales/ru-ru.json+1 -0
@@ -2255,6 +2255,7 @@
2255 "Manual": "Когда вы скажете",2255 "Manual": "Когда вы скажете",
2256 "Auto Mode delay": "Задержка авто-режима",2256 "Auto Mode delay": "Задержка авто-режима",
2257 "Use tag as folder": "Тег-папка",2257 "Use tag as folder": "Тег-папка",
2258 "Hide on character card": "Скрыть на карточке персонажа",
2258 "All connections to ${0} have been removed.": "Все связи с персонажем ${0} были удалены.",2259 "All connections to ${0} have been removed.": "Все связи с персонажем ${0} были удалены.",
2259 "Personas Unlocked": "Персоны отвязаны",2260 "Personas Unlocked": "Персоны отвязаны",
2260 "Remove All Connections": "Удалить все связи",2261 "Remove All Connections": "Удалить все связи",
public/locales/uk-ua.json+1 -0
@@ -939,6 +939,7 @@
939 "Download chat as plain text document": "Завантажити чат як документ у форматі простого тексту",939 "Download chat as plain text document": "Завантажити чат як документ у форматі простого тексту",
940 "Delete chat file": "Видалити файл чату",940 "Delete chat file": "Видалити файл чату",
941 "Use tag as folder": "Позначити як папку",941 "Use tag as folder": "Позначити як папку",
942 "Hide on character card": "Сховати на картці персонажа",
942 "Delete tag": "Видалити тег",943 "Delete tag": "Видалити тег",
943 "Entry Title/Memo": "Заголовок запису",944 "Entry Title/Memo": "Заголовок запису",
944 "WI Entry Status:🔵 Constant🟢 Normal🔗 Vectorized❌ Disabled": "Статус вступу до WI:\r🔵 Постійно\r🟢 Нормально\r🔗 Векторизовано\r❌ Вимкнено",945 "WI Entry Status:🔵 Constant🟢 Normal🔗 Vectorized❌ Disabled": "Статус вступу до WI:\r🔵 Постійно\r🟢 Нормально\r🔗 Векторизовано\r❌ Вимкнено",
public/locales/vi-vn.json+1 -0
@@ -939,6 +939,7 @@
939 "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",939 "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",
940 "Delete chat file": "Xóa tệp trò chuyện",940 "Delete chat file": "Xóa tệp trò chuyện",
941 "Use tag as folder": "Gắn thẻ dưới dạng thư mục",941 "Use tag as folder": "Gắn thẻ dưới dạng thư mục",
942 "Hide on character card": "Ẩn trên thẻ nhân vật",
942 "Delete tag": "Xóa tag",943 "Delete tag": "Xóa tag",
943 "Entry Title/Memo": "Tiêu đề Đăng nhập/Ghi chú",944 "Entry Title/Memo": "Tiêu đề Đăng nhập/Ghi chú",
944 "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",945 "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",
public/locales/zh-cn.json+1 -0
@@ -1082,6 +1082,7 @@
1082 "Delete chat file": "删除聊天文件",1082 "Delete chat file": "删除聊天文件",
1083 "Drag to reorder tag": "拖动以排序",1083 "Drag to reorder tag": "拖动以排序",
1084 "Use tag as folder": "标记为文件夹",1084 "Use tag as folder": "标记为文件夹",
1085 "Hide on character card": "在角色卡上隐藏",
1085 "Delete tag": "删除标签",1086 "Delete tag": "删除标签",
1086 "Toggle entry's active state.": "切换条目激活状态。",1087 "Toggle entry's active state.": "切换条目激活状态。",
1087 "Entry Title/Memo": "条目标题/备忘录",1088 "Entry Title/Memo": "条目标题/备忘录",
public/locales/zh-tw.json+1 -0
@@ -940,6 +940,7 @@
940 "Delete chat file": "刪除聊天檔案",940 "Delete chat file": "刪除聊天檔案",
941 "Drag to reorder tag": "拖動以重新排序標籤",941 "Drag to reorder tag": "拖動以重新排序標籤",
942 "Use tag as folder": "將標籤作為資料夾",942 "Use tag as folder": "將標籤作為資料夾",
943 "Hide on character card": "在角色卡上隱藏標籤",
943 "Delete tag": "刪除標籤",944 "Delete tag": "刪除標籤",
944 "Entry Title/Memo": "條目標題/備註",945 "Entry Title/Memo": "條目標題/備註",
945 "WI Entry Status:🔵 Constant🟢 Normal🔗 Vectorized❌ Disabled": "世界資訊條目狀態:🔵常數 🟢正常 🔗向量 ❌停用",946 "WI Entry Status:🔵 Constant🟢 Normal🔗 Vectorized❌ Disabled": "世界資訊條目狀態:🔵常數 🟢正常 🔗向量 ❌停用",
public/script.js+1 -1
@@ -1499,7 +1499,7 @@ function getCharacterBlock(item, id) {
14991499
1500 // Display inline tags1500 // Display inline tags
1501 const tagsElement = template.find('.tags');1501 const tagsElement = template.find('.tags');
1502 printTagList(tagsElement, { forEntityOrKey: id });1502 printTagList(tagsElement, { forEntityOrKey: id, tagOptions: { isCharacterList: true } });
15031503
1504 // Add to the list1504 // Add to the list
1505 return template;1505 return template;
public/scripts/tags.js+20 -1
@@ -136,6 +136,7 @@ const TAG_FOLDER_DEFAULT_TYPE = 'NONE';
136 * @property {string} [color] - The background color of the tag136 * @property {string} [color] - The background color of the tag
137 * @property {string} [color2] - The foreground color of the tag137 * @property {string} [color2] - The foreground color of the tag
138 * @property {number} [create_date] - A number representing the date when this tag was created138 * @property {number} [create_date] - A number representing the date when this tag was created
139 * @property {boolean} is_hidden_on_character_card - Whether this tag is hidden on the character card
139 *140 *
140 * @property {function} [action] - An optional function that gets executed when this tag is an actionable tag and is clicked on.141 * @property {function} [action] - An optional function that gets executed when this tag is an actionable tag and is clicked on.
141 * @property {string} [class] - An optional css class added to the control representing this tag when printed. Used for custom tags in the filters.142 * @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) {
895 folder_type: TAG_FOLDER_DEFAULT_TYPE,896 folder_type: TAG_FOLDER_DEFAULT_TYPE,
896 filter_state: DEFAULT_FILTER_STATE,897 filter_state: DEFAULT_FILTER_STATE,
897 sort_order: Math.max(0, ...tags.map(t => t.sort_order)) + 1,898 sort_order: Math.max(0, ...tags.map(t => t.sort_order)) + 1,
899 is_hidden_on_character_card: false,
898 color: '',900 color: '',
899 color2: '',901 color2: '',
900 create_date: Date.now(),902 create_date: Date.now(),
@@ -909,6 +911,7 @@ function newTag(tagName) {
909 * @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.911 * @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.
910 * @property {boolean} [isGeneralList=false] - If true, indicates that this is the general list of tags.912 * @property {boolean} [isGeneralList=false] - If true, indicates that this is the general list of tags.
911 * @property {boolean} [skipExistsCheck=false] - If true, the tag gets added even if a tag with the same id already exists.913 * @property {boolean} [skipExistsCheck=false] - If true, the tag gets added even if a tag with the same id already exists.
914 * @property {boolean} [isCharacterList=false] - If true, indicates that this is the character's list of tags.
912 */915 */
913916
914/**917/**
@@ -934,6 +937,10 @@ function printTagList(element, { tags = undefined, addTag = undefined, forEntity
934 const key = forEntityOrKey !== undefined ? getTagKeyForEntity(forEntityOrKey) : getTagKey();937 const key = forEntityOrKey !== undefined ? getTagKeyForEntity(forEntityOrKey) : getTagKey();
935 let printableTags = tags ? (typeof tags === 'function' ? tags() : tags) : getTagsList(key, sort);938 let printableTags = tags ? (typeof tags === 'function' ? tags() : tags) : getTagsList(key, sort);
936939
940 if (tagOptions.isCharacterList) {
941 printableTags = printableTags.filter(tag => !tag.is_hidden_on_character_card);
942 }
943
937 if (empty === 'always' || (empty && (printableTags?.length > 0 || key))) {944 if (empty === 'always' || (empty && (printableTags?.length > 0 || key))) {
938 $element.empty();945 $element.empty();
939 }946 }
@@ -1308,7 +1315,7 @@ async function onViewTagsListClick() {
1308 printViewTagList(tagContainer);1315 printViewTagList(tagContainer);
1309 makeTagListDraggable(tagContainer);1316 makeTagListDraggable(tagContainer);
13101317
1311 await callGenericPopup(html, POPUP_TYPE.TEXT, null, { allowVerticalScrolling: true });1318 await callGenericPopup(html, POPUP_TYPE.TEXT, null, { allowVerticalScrolling: true, wide: true });
1312}1319}
13131320
1314/**1321/**
@@ -1594,6 +1601,18 @@ function appendViewTagToList(list, tag, everything) {
1594 colorPicker[0].color = defaultColor;1601 colorPicker[0].color = defaultColor;
1595 });1602 });
15961603
1604 const hideToggle = template.find('.eye-toggle');
1605 hideToggle.toggleClass('fa-eye-slash', tag.is_hidden_on_character_card);
1606 hideToggle.toggleClass('fa-eye', !tag.is_hidden_on_character_card);
1607
1608 hideToggle.on('click', () => {
1609 tag.is_hidden_on_character_card = !tag.is_hidden_on_character_card;
1610 hideToggle.toggleClass('fa-eye-slash', tag.is_hidden_on_character_card);
1611 hideToggle.toggleClass('fa-eye', !tag.is_hidden_on_character_card);
1612 printCharactersDebounced();
1613 saveSettingsDebounced();
1614 });
1615
1597 list.append(template);1616 list.append(template);
15981617
1599 // We prevent the popup from auto-close on Escape press on the color pickups. If the user really wants to, he can hit it again1618 // 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