From 3f0fb053b9b45322c020c0b4d8eb327248064e54 Mon Sep 17 00:00:00 2001 From: fin444 Date: Tue, 19 Jul 2022 13:06:06 -0700 Subject: [PATCH] make numbers in tooltip descriptions pop --- js/atree.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/js/atree.js b/js/atree.js index 4421b61..601bb96 100644 --- a/js/atree.js +++ b/js/atree.js @@ -1075,8 +1075,9 @@ function generateTooltip(UI_elem, node_elem, ability, atree_map) { container.innerHTML += "

"; // description - let description = make_elem("p", ["scaled-font-sm", "my-0", "mx-1", "text-wrap"], {}); - description.innerHTML = ability.desc; + let description = make_elem("p", ["scaled-font-sm", "my-0", "mx-1", "text-wrap", "mc-gray"], {}); + let numberRegex = /[+-]?\d+(\.\d+)?[%+s]?/g; // +/- (optional), 1 or more digits, period followed by 1 or more digits (optional), %/+/s (optional) + description.innerHTML = ability.desc.replaceAll(numberRegex, (m) => { return "" + m + "" }); container.appendChild(description); container.appendChild(document.createElement("br"));