Grammalecte  Diff

Differences From Artifact [bb68749e64]:

To Artifact [8958174d47]:


11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
class GrammalecteMessageBox {

    constructor (sId, sTitle) {
        this.sId = sId;

        this.bShadow = document.body.createShadowRoot || document.body.attachShadow;
        if (this.bShadow) {
            this.xShadowPanel = oGrammalecte.createNode("div", {id: this.sId+"_shadow", style: "width:0;height:0;"});
            this.xShadow = this.xShadowPanel.attachShadow({mode: "open"});
            this.xParent = this.xShadow;
        } else {
            this.xParent = document;
        }

        this.xMessageBoxBar = oGrammalecte.createNode("div", {className: "grammalecte_message_box_bar"});
        this.xMessageBoxContent = oGrammalecte.createNode("div", {className: "grammalecte_message_box_content"});
        this.xMessageBox = this._createPanel(sTitle);







|
|
|







11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
class GrammalecteMessageBox {

    constructor (sId, sTitle) {
        this.sId = sId;

        this.bShadow = document.body.createShadowRoot || document.body.attachShadow;
        if (this.bShadow) {
            this.xShadowHost = oGrammalecte.createNode("div", {id: this.sId+"_shadow", style: "width:0;height:0;"});
            this.xShadowRoot = this.xShadowHost.attachShadow({mode: "open"});
            this.xParent = this.xShadowRoot;
        } else {
            this.xParent = document;
        }

        this.xMessageBoxBar = oGrammalecte.createNode("div", {className: "grammalecte_message_box_bar"});
        this.xMessageBoxContent = oGrammalecte.createNode("div", {className: "grammalecte_message_box_content"});
        this.xMessageBox = this._createPanel(sTitle);
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
        let xButton = oGrammalecte.createNode("div", {className: "grammalecte_panel_button grammalecte_close_button", textContent: "×", title: "Fermer la fenêtre"});
        xButton.onclick = function () { this.hide(); }.bind(this);  // better than writing “let that = this;” before the function?
        return xButton;
    }

    insertIntoPage () {
        if (this.bShadow){
            oGrammalecte.createStyle("content_scripts/panel.css", null, this.xShadow);
            oGrammalecte.createStyle("content_scripts/message_box.css", null, this.xShadow);
            this.xShadow.appendChild(this.xMessageBox);
            document.body.appendChild(this.xShadowPanel);
        } else {
            if (!document.getElementById("grammalecte_cssmsg")){
                oGrammalecte.createStyle("content_scripts/panel.css", null, document.head);
                oGrammalecte.createStyle("content_scripts/message_box.css", "grammalecte_cssmsg", document.head);
            }
            document.body.appendChild(this.xMessageBox);
        }







|
|
|
|







61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
        let xButton = oGrammalecte.createNode("div", {className: "grammalecte_panel_button grammalecte_close_button", textContent: "×", title: "Fermer la fenêtre"});
        xButton.onclick = function () { this.hide(); }.bind(this);  // better than writing “let that = this;” before the function?
        return xButton;
    }

    insertIntoPage () {
        if (this.bShadow){
            oGrammalecte.createStyle("content_scripts/panel.css", null, this.xShadowRoot);
            oGrammalecte.createStyle("content_scripts/message_box.css", null, this.xShadowRoot);
            this.xShadowRoot.appendChild(this.xMessageBox);
            document.body.appendChild(this.xShadowHost);
        } else {
            if (!document.getElementById("grammalecte_cssmsg")){
                oGrammalecte.createStyle("content_scripts/panel.css", null, document.head);
                oGrammalecte.createStyle("content_scripts/message_box.css", "grammalecte_cssmsg", document.head);
            }
            document.body.appendChild(this.xMessageBox);
        }