make numbers in tooltip descriptions pop

This commit is contained in:
fin444 2022-07-19 13:06:06 -07:00
parent 5b94564e86
commit 3f0fb053b9

View file

@ -1075,8 +1075,9 @@ function generateTooltip(UI_elem, node_elem, ability, atree_map) {
container.innerHTML += "<br/><br/>"; container.innerHTML += "<br/><br/>";
// description // description
let description = make_elem("p", ["scaled-font-sm", "my-0", "mx-1", "text-wrap"], {}); let description = make_elem("p", ["scaled-font-sm", "my-0", "mx-1", "text-wrap", "mc-gray"], {});
description.innerHTML = ability.desc; 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 "<span class = 'mc-white'>" + m + "</span>" });
container.appendChild(description); container.appendChild(description);
container.appendChild(document.createElement("br")); container.appendChild(document.createElement("br"));