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">${this.lines.map(line => `<div class="lgws-tooltip-line">${line}</div>`).join('')}</div>`;
        
        return frame.tooltipsCache[this.id];
    }
}

exports = { TooltipBuilder }
Last Edited by LiveGobe on 3/30/2026, 4:35:46 PM

This page categories: