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