ATLYSS TechPendium

Module:Tooltip Builder

This Module contains Internal Wiki logic and must be loaded using require keyword inside other logic modules.
Note that require supports only static imports.
This module can't be {{#invoke}}-ed.
// 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] != undefined) return "";
    
        frame.tooltipsCache = frame.tooltipsCache || {};
        frame.tooltipsCache[this.id] = `<div id="${this.id}" class="lgws-tooltip" aria-hidden="true">${this.lines.map(line => `<div class="lgws-tooltip-line" aria-hidden="true">${line}</div>`).join('')}</div>`;
        
        return frame.tooltipsCache[this.id];
    }
}

exports = { TooltipBuilder }
Last Edited by LiveGobe on 5/19/2026, 2:54:33 PM

This page categories: