Add tooltip for all items
This commit is contained in:
@@ -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 () {
|
||||
|
||||
Reference in New Issue
Block a user