Viewing old revision of Module:Tooltip_Builder
You are viewing an old revision of this page from 2/26/2026, 9:03:28 PM.
View latest versionclass TooltipBuilder {
constructor(id = null) {
this.id = id || TooltipBuilder._generateId();
this.lines = [];
}
static _generateId() {
if (typeof crypto !== "undefined" && crypto.randomUUID) {
return `tt-${crypto.randomUUID()}`;
}
// Fallback random generator
return "tt-" + Math.random().toString(36).slice(2, 10) +
Math.random().toString(36).slice(2, 10);
}
addLine(line) {
this.lines.push(line);
return this;
}
build() {
return `<div id="${this.id}" class="lgws-tooltip">` +
this.lines.map(line =>
`<div class="lgws-tooltip-line">${line}</div>`
).join("") +
`</div>`;
}
}
exports = { TooltipBuilder };