<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">//------------------------------------------------------------
// base object
//------------------------------------------------------------
class object {
    constructor(id,name,title,instance,section) {
        this.id       = id;
        this.name     = name;
        this.title    = title;
        this.instance = instance;
        this.section  = section;

        this.element  = document.getElementById(this.section);

        // console.log("----------------------------------------------------------------------");
        // console.log("id:    "+this.id);
        // console.log("name:  "+this.name);
        // console.log("title: "+this.title);
        // console.log("instance: "+this.instance);
        // console.log("section:  "+this.section);
        // console.log("element:");
        // console.log(this.element);
    }

    init() {
    }

    create() {
        return this.element;
    }

    destroy() {
        if(this.element.parentNode) {
            this.element.parentNode.removeChild(this.element);
        }
    }

    destroy_children() {
        if(this.element) {
            while(this.element.lastChild) {
                this.element.removeChild(this.element.lastChild);
            }
        }
    }

    dim(level) {
        if(this.element) {
            this.element.style.opacity = level;
        }
    }

    hide() {
        if(this.element) {
            this.element.style.display = "none";
        }
    }

    show() {
        if(this.element) {
            this.element.style.display = "block"; // was "" - which is correct?
        }
    }

    enable() {
        if(this.element) {
            this.element.disabled = false;
        }
    }

    disable() {
        if(this.element) {
            this.element.disabled = true;
        }
    }

    is_enabled() {
        return (this.element.disabled == true) ? false : true;
    }

    is_disabled() {
        return this.element.disabled;
    }

    set_onclick(onclick) {
        if(onclick)
            this.element.setAttribute("onclick", onclick);
    }

    set_onchange(onchange) {
        if(onchange)
            this.element.setAttribute("onchange", onchange);
    }

    debug() {
        console.log(this);
    }
}
</pre></body></html>