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 -2Showing whitespace changes
public/index.html+1 -0
@@ -6008,6 +6008,7 @@
60086008 <div title="Tag as folder" class="tag_as_folder fa-solid fa-folder-open right_menu_button" data-i18n="[title]Use tag as folder">
60096009 <span class="tag_folder_indicator"></span>
60106010 </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>
60116012 <div class="tag_view_color_picker" data-value="color"></div>
60126013 <div class="tag_view_color_picker" data-value="color2"></div>
60136014 <div class="tag_view_name" contenteditable="true"></div>
public/locales/ar-sa.json+1 -0
@@ -939,6 +939,7 @@
939939 "Download chat as plain text document": "تنزيل الدردشة كمستند نصي عادي",
940940 "Delete chat file": "حذف ملف الدردشة",
941941 "Use tag as folder": "وضع علامة كمجلد",
942+ "Hide on character card": "إخفاء في بطاقة الشخصية",
942943 "Delete tag": "حذف العلامة",
943944 "Entry Title/Memo": "عنوان الإدخال/المذكرة",
944945 "WI Entry Status:🔵 Constant🟢 Normal🔗 Vectorized❌ Disabled": "حالة دخول وي:\r🔵 ثابت\r🟢 عادي\r🔗 ناقل\r❌ معطل",
public/locales/de-de.json+1 -0
@@ -939,6 +939,7 @@
939939 "Download chat as plain text document": "Chat als einfaches Textdokument herunterladen",
940940 "Delete chat file": "Chatdatei löschen",
941941 "Use tag as folder": "Als Ordner markieren",
942+ "Hide on character card": "Auf Charakterkarte ausblenden",
942943 "Delete tag": "Tag löschen",
943944 "Entry Title/Memo": "Eintragstitel/Memo",
944945 "WI Entry Status:🔵 Constant🟢 Normal🔗 Vectorized❌ Disabled": "WI-Eintragstatus: 🔵 Konstant 🟢 Normal 🔗 Vektorisiert ❌ Deaktiviert",
public/locales/es-es.json+1 -0
@@ -939,6 +939,7 @@
939939 "Download chat as plain text document": "Descargar chat como documento de texto sin formato",
940940 "Delete chat file": "Eliminar archivo de chat",
941941 "Use tag as folder": "Etiquetar como carpeta",
942+ "Hide on character card": "Ocultar en la tarjeta del personaje",
942943 "Delete tag": "Eliminar etiqueta",
943944 "Entry Title/Memo": "Título/Memo",
944945 "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 @@
884884 "Download chat as plain text document": "Télécharger la discussion sous forme de document texte brut",
885885 "Delete chat file": "Supprimer le fichier de discussion",
886886 "Use tag as folder": "Utiliser les tags comme dossier",
887+ "Hide on character card": "Masquer sur la fiche du personnage",
887888 "Delete tag": "Supprimer le tag'",
888889 "Entry Title/Memo": "Titre de l'entrée/Mémo",
889890 "WI_Entry_Status_Constant": "Constante",
public/locales/is-is.json+1 -0
@@ -939,6 +939,7 @@
939939 "Download chat as plain text document": "Niðurhala spjalli sem einfaldan textaskjal",
940940 "Delete chat file": "Eyða spjallaskrá",
941941 "Use tag as folder": "Merktu sem mappa",
942+ "Hide on character card": "Fela á persónukorti",
942943 "Delete tag": "Eyða merki",
943944 "Entry Title/Memo": "Titill færslu/Minnisblað",
944945 "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 @@
939939 "Download chat as plain text document": "Scarica la chat come documento di testo semplice",
940940 "Delete chat file": "Elimina il file di chat",
941941 "Use tag as folder": "Contrassegna come cartella",
942+ "Hide on character card": "Nascondi sulla scheda del personaggio",
942943 "Delete tag": "Elimina il tag",
943944 "Entry Title/Memo": "Titolo/Memo dell'Ingresso",
944945 "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 @@
939939 "Download chat as plain text document": "プレーンテキストドキュメントとしてチャットをダウンロード",
940940 "Delete chat file": "チャットファイルを削除",
941941 "Use tag as folder": "フォルダとしてタグ付け",
942+ "Hide on character card": "キャラクターカードで非表示",
942943 "Delete tag": "タグを削除",
943944 "Entry Title/Memo": "エントリータイトル/メモ",
944945 "WI Entry Status:🔵 Constant🟢 Normal🔗 Vectorized❌ Disabled": "WI エントリ ステータス: 🔵 定数 🟢 通常 🔗 ベクトル化 ❌ 無効",
public/locales/ko-kr.json+1 -0
@@ -955,6 +955,7 @@
955955 "Download chat as plain text document": "일반 텍스트 문서로 채팅 다운로드",
956956 "Delete chat file": "채팅 파일 삭제",
957957 "Use tag as folder": "폴더로 태그 지정",
958+ "Hide on character card": "캐릭터 카드에서 숨기기",
958959 "Delete tag": "태그 삭제",
959960 "Entry Title/Memo": "항목 제목/메모",
960961 "WI Entry Status:🔵 Constant🟢 Normal🔗 Vectorized❌ Disabled": "WI 입국 상태:\r🔵 상시\r🟢 조건 만족시\r🔗 벡터화됨\r❌ 비활성화",
public/locales/nl-nl.json+1 -0
@@ -939,6 +939,7 @@
939939 "Download chat as plain text document": "Download chat als plat tekstbestand",
940940 "Delete chat file": "Chatbestand verwijderen",
941941 "Use tag as folder": "Taggen als map",
942+ "Hide on character card": "Verbergen op karakterkaart",
942943 "Delete tag": "Tag verwijderen",
943944 "Entry Title/Memo": "Titel/Memo",
944945 "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 @@
939939 "Download chat as plain text document": "Baixar bate-papo como documento de texto simples",
940940 "Delete chat file": "Excluir arquivo de bate-papo",
941941 "Use tag as folder": "Marcar como pasta",
942+ "Hide on character card": "Ocultar no cartão do personagem",
942943 "Delete tag": "Excluir tag",
943944 "Entry Title/Memo": "Título da Entrada/Memo",
944945 "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 @@
22552255 "Manual": "Когда вы скажете",
22562256 "Auto Mode delay": "Задержка авто-режима",
22572257 "Use tag as folder": "Тег-папка",
2258+ "Hide on character card": "Скрыть на карточке персонажа",
22582259 "All connections to ${0} have been removed.": "Все связи с персонажем ${0} были удалены.",
22592260 "Personas Unlocked": "Персоны отвязаны",
22602261 "Remove All Connections": "Удалить все связи",
public/locales/uk-ua.json+1 -0
@@ -939,6 +939,7 @@
939939 "Download chat as plain text document": "Завантажити чат як документ у форматі простого тексту",
940940 "Delete chat file": "Видалити файл чату",
941941 "Use tag as folder": "Позначити як папку",
942+ "Hide on character card": "Сховати на картці персонажа",
942943 "Delete tag": "Видалити тег",
943944 "Entry Title/Memo": "Заголовок запису",
944945 "WI Entry Status:🔵 Constant🟢 Normal🔗 Vectorized❌ Disabled": "Статус вступу до WI:\r🔵 Постійно\r🟢 Нормально\r🔗 Векторизовано\r❌ Вимкнено",
public/locales/vi-vn.json+1 -0
@@ -939,6 +939,7 @@
939939 "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",
940940 "Delete chat file": "Xóa tệp trò chuyện",
941941 "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",
942943 "Delete tag": "Xóa tag",
943944 "Entry Title/Memo": "Tiêu đề Đăng nhập/Ghi chú",
944945 "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 @@
10821082 "Delete chat file": "删除聊天文件",
10831083 "Drag to reorder tag": "拖动以排序",
10841084 "Use tag as folder": "标记为文件夹",
1085+ "Hide on character card": "在角色卡上隐藏",
10851086 "Delete tag": "删除标签",
10861087 "Toggle entry's active state.": "切换条目激活状态。",
10871088 "Entry Title/Memo": "条目标题/备忘录",
public/locales/zh-tw.json+1 -0
@@ -940,6 +940,7 @@
940940 "Delete chat file": "刪除聊天檔案",
941941 "Drag to reorder tag": "拖動以重新排序標籤",
942942 "Use tag as folder": "將標籤作為資料夾",
943+ "Hide on character card": "在角色卡上隱藏標籤",
943944 "Delete tag": "刪除標籤",
944945 "Entry Title/Memo": "條目標題/備註",
945946 "WI Entry Status:🔵 Constant🟢 Normal🔗 Vectorized❌ Disabled": "世界資訊條目狀態:🔵常數 🟢正常 🔗向量 ❌停用",
public/script.js+1 -1
@@ -1499,7 +1499,7 @@ function getCharacterBlock(item, id) {
14991499
15001500 // Display inline tags
15011501 const tagsElement = template.find('.tags');
15021502 printTagList(tagsElement, { forEntityOrKey: id, tagOptions: { isCharacterList: true } });
15031503
15041504 // Add to the list
15051505 return template;
public/scripts/tags.js+20 -1
@@ -136,6 +136,7 @@ const TAG_FOLDER_DEFAULT_TYPE = 'NONE';
136136 * @property {string} [color] - The background color of the tag
137137 * @property {string} [color2] - The foreground color of the tag
138138 * @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
139140 *
140141 * @property {function} [action] - An optional function that gets executed when this tag is an actionable tag and is clicked on.
141142 * @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) {
895896 folder_type: TAG_FOLDER_DEFAULT_TYPE,
896897 filter_state: DEFAULT_FILTER_STATE,
897898 sort_order: Math.max(0, ...tags.map(t => t.sort_order)) + 1,
899+ is_hidden_on_character_card: false,
898900 color: '',
899901 color2: '',
900902 create_date: Date.now(),
@@ -909,6 +911,7 @@ function newTag(tagName) {
909911 * @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.
910912 * @property {boolean} [isGeneralList=false] - If true, indicates that this is the general list of tags.
911913 * @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.
912915 */
913916
914917/**
@@ -934,6 +937,10 @@ function printTagList(element, { tags = undefined, addTag = undefined, forEntity
934937 const key = forEntityOrKey !== undefined ? getTagKeyForEntity(forEntityOrKey) : getTagKey();
935938 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+
937944 if (empty === 'always' || (empty && (printableTags?.length > 0 || key))) {
938945 $element.empty();
939946 }
@@ -1308,7 +1315,7 @@ async function onViewTagsListClick() {
13081315 printViewTagList(tagContainer);
13091316 makeTagListDraggable(tagContainer);
13101317
13111318 await callGenericPopup(html, POPUP_TYPE.TEXT, null, { allowVerticalScrolling: true, wide: true });
13121319}
13131320
13141321/**
@@ -1594,6 +1601,18 @@ function appendViewTagToList(list, tag, everything) {
15941601 colorPicker[0].color = defaultColor;
15951602 });
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+
15971616 list.append(template);
15981617
15991618 // 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