Add tooltip for all items

This commit is contained in:
2026-04-29 16:33:51 +02:00
parent b19ba64a39
commit c2811c9eb9
5 changed files with 90 additions and 59 deletions
+7
View File
@@ -98,6 +98,13 @@ Hooks.once("init", async function () {
const key = (traitName ?? "").toLowerCase()
return SYSTEM.TRAIT_DESCRIPTIONS[key] ?? ""
})
/** Strip HTML tags and truncate item description for use as a data-tooltip value. */
Handlebars.registerHelper("itemTooltip", (item) => {
const raw = item?.system?.description ?? ""
if (!raw) return ""
const plain = raw.replace(/<[^>]*>/g, " ").replace(/\s+/g, " ").trim()
return plain.length > 250 ? plain.slice(0, 247) + "…" : plain
})
})
Hooks.once("ready", function () {