Grammalecte  Check-in [a44781f918]

Overview
Comment:[fx] WebExt: message box small improvements
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | fx | webext3
Files: files | file ages | folders
SHA3-256: a44781f918758f930b76baa5e4223e371950c8eea56732c9e08cc16fbe86e14d
User & Date: olr on 2017-10-16 20:03:33
Other Links: branch diff | manifest | tags
Context
2017-10-16
20:40
[fx] WebExt: use “this” check-in: 114adc8ee9 user: olr tags: fx, webext3
20:03
[fx] WebExt: message box small improvements check-in: a44781f918 user: olr tags: fx, webext3
19:33
[fx] WebExt: message box + text formatter via context menu check-in: e7fc1e12a3 user: olr tags: fx, webext3
Changes

Modified gc_lang/fr/webext/content_scripts/init.js from [d44995d5ef] to [fd1fa3a31b].

116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
...
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
            this.oGCPanel = new GrammalecteGrammarChecker("grammalecte_gc_panel", "Grammalecte", 500, 700);
            this.oGCPanel.insertIntoPage();
        }
    },

    createMessageBox: function () {
        if (this.oMessageBox === null) {
            this.oMessageBox = new GrammalecteMessageBox("grammalecte_message_box", "Grammalecte", 400, 300);
            this.oMessageBox.insertIntoPage();
        }
    },

    startGCPanel: function (xNode=null) {
        oGrammalecte.createGCPanel();
        oGrammalecte.oGCPanel.clear();
................................................................................
        oGrammalecte.createTFPanel();
        oGrammalecte.oTFPanel.start(xNode);
        oGrammalecte.oTFPanel.show();
    },

    showMessage: function (sMessage) {
        oGrammalecte.createMessageBox();
        oGrammalecte.oMessageBox.setMessage(sMessage);
        oGrammalecte.oMessageBox.show();
    },

    getPageText: function () {
        let sPageText = document.body.innerText;
        let nPos = sPageText.indexOf("__grammalecte_panel__");
        if (nPos >= 0) {
            sPageText = sPageText.slice(0, nPos);







|







 







|
|







116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
...
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
            this.oGCPanel = new GrammalecteGrammarChecker("grammalecte_gc_panel", "Grammalecte", 500, 700);
            this.oGCPanel.insertIntoPage();
        }
    },

    createMessageBox: function () {
        if (this.oMessageBox === null) {
            this.oMessageBox = new GrammalecteMessageBox("grammalecte_message_box", "Grammalecte", 400, 250);
            this.oMessageBox.insertIntoPage();
        }
    },

    startGCPanel: function (xNode=null) {
        oGrammalecte.createGCPanel();
        oGrammalecte.oGCPanel.clear();
................................................................................
        oGrammalecte.createTFPanel();
        oGrammalecte.oTFPanel.start(xNode);
        oGrammalecte.oTFPanel.show();
    },

    showMessage: function (sMessage) {
        oGrammalecte.createMessageBox();
        oGrammalecte.oMessageBox.show();
        oGrammalecte.oMessageBox.addMessage(sMessage);
    },

    getPageText: function () {
        let sPageText = document.body.innerText;
        let nPos = sPageText.indexOf("__grammalecte_panel__");
        if (nPos >= 0) {
            sPageText = sPageText.slice(0, nPos);

Modified gc_lang/fr/webext/content_scripts/message_box.js from [4a05d3c991] to [26ac188379].

22
23
24
25
26
27
28

29
30
31
32
33
34
35
..
58
59
60
61
62
63
64

65
66
67




68


69
70
71
72
73
74
            this.xMessageBoxBar.appendChild(oGrammalecte.createNode("div", {className: "grammalecte_message_box_invisible_marker", textContent: "__grammalecte_panel__"}));
            this.xMessageBoxBar.appendChild(this._createButtons());
            let xTitle = oGrammalecte.createNode("div", {className: "grammalecte_panel_title"});
            xTitle.appendChild(this._createLogo());
            xTitle.appendChild(oGrammalecte.createNode("div", {className: "grammalecte_message_box_label", textContent: sTitle}));
            this.xMessageBoxBar.appendChild(xTitle);
            xMessageBox.appendChild(this.xMessageBoxBar);

            xMessageBox.appendChild(this.xMessageBoxContent);
            return xMessageBox;
        }
        catch (e) {
            showError(e);
        }
    }
................................................................................

    show () {
        this.xMessageBox.style.display = "block";
    }

    hide () {
        this.xMessageBox.style.display = "none";

    }

    setMessage (sMessage) {




    	this.xMessageBoxContent.textContent = sMessage;


    }

    center () {
        this.xMessageBox.style = `top: 50%; left: 50%; width: ${this.nWidth}px; height: ${this.nHeight}px; margin-top: -${this.nHeight/2}px; margin-left: -${this.nWidth/2}px;`;
    }
}







>







 







>


|
>
>
>
>
|
>
>






22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
..
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
            this.xMessageBoxBar.appendChild(oGrammalecte.createNode("div", {className: "grammalecte_message_box_invisible_marker", textContent: "__grammalecte_panel__"}));
            this.xMessageBoxBar.appendChild(this._createButtons());
            let xTitle = oGrammalecte.createNode("div", {className: "grammalecte_panel_title"});
            xTitle.appendChild(this._createLogo());
            xTitle.appendChild(oGrammalecte.createNode("div", {className: "grammalecte_message_box_label", textContent: sTitle}));
            this.xMessageBoxBar.appendChild(xTitle);
            xMessageBox.appendChild(this.xMessageBoxBar);

            xMessageBox.appendChild(this.xMessageBoxContent);
            return xMessageBox;
        }
        catch (e) {
            showError(e);
        }
    }
................................................................................

    show () {
        this.xMessageBox.style.display = "block";
    }

    hide () {
        this.xMessageBox.style.display = "none";
        this.clear();
    }

    addMessage (sMessage) {
    	this.xMessageBoxContent.appendChild(oGrammalecte.createNode("div", {className: "grammalecte_message_box_message", textContent: sMessage}));
    }

    clear () {
        while (this.xMessageBoxContent.firstChild) {
            this.xMessageBoxContent.removeChild(this.xMessageBoxContent.firstChild);
        }
    }

    center () {
        this.xMessageBox.style = `top: 50%; left: 50%; width: ${this.nWidth}px; height: ${this.nHeight}px; margin-top: -${this.nHeight/2}px; margin-left: -${this.nWidth/2}px;`;
    }
}