Viewing old revision of Module:Tooltip_Builder
You are viewing an old revision of this page from 2/26/2026, 11:21:50 PM.
View latest version// A tooltip builder class for LGWS (HTML) tooltips
class TooltipBuilder {
constructor(id) {
this.id = id;
this.lines = [];
}
addLine(line) {
this.lines.push(line);
return this;
}
build() {
if (frame.tooltipsCache?.[this.id]) return "";
frame.tooltipsCache ||= {};
frame.tooltipsCache[this.id] = `<div id="${this.id}" class="lgws-tooltip">${this.lines.map(line => `<div class="lgws-tooltip-line">${line}</div>`).join('')}</div>`;
return frame.tooltipsCache[this.id];
}
}
exports = { TooltipBuilder }