Grammalecte  Check-in [4622bc10d8]

Overview
Comment:[fx] gc panel: prevent switching tabs when working, to avoid overload
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | fx
Files: files | file ages | folders
SHA3-256: 4622bc10d8216bc306f699d569e9bc6697babcee912d6543bfce501b31b7f4fb
User & Date: olr on 2019-05-08 11:26:37
Original Comment: [fx] prevent switching tabs when working, to avoid overload
Other Links: manifest | tags
Context
2019-05-08
15:20
[fr] faux positif check-in: e32f2a207a user: olr tags: trunk, fr
11:26
[fx] gc panel: prevent switching tabs when working, to avoid overload check-in: 4622bc10d8 user: olr tags: trunk, fx
08:32
[fx] gc panel: fix conjugueur check-in: 385da73cc1 user: olr tags: trunk, fx
Changes

Modified gc_lang/fr/webext/content_scripts/panel.js from [7d3ce52a64] to [e0aa55a645].

11
12
13
14
15
16
17

18
19
20
21
22
23
24
class GrammalectePanel {

    constructor (sId, sTitle, nWidth, nHeight, bFlexible=true) {
        this.sId = sId;
        this.nWidth = nWidth;
        this.nHeight = nHeight;
        this.bFlexible = bFlexible;


        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 {







>







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

    constructor (sId, sTitle, nWidth, nHeight, bFlexible=true) {
        this.sId = sId;
        this.nWidth = nWidth;
        this.nHeight = nHeight;
        this.bFlexible = bFlexible;
        this.bWorking = false;

        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 {
179
180
181
182
183
184
185

186
187
188
189

190
191
192
193
194
195
196
197
198
199
200

    logInnerHTML () {
        // for debugging
        console.log(this.xPanel.innerHTML);
    }

    startWaitIcon () {

        this.xWaitIcon.style.visibility = "visible";
    }

    stopWaitIcon () {

        this.xWaitIcon.style.visibility = "hidden";
    }

    openURL (sURL) {
        xGrammalectePort.postMessage({
            sCommand: "openURL",
            dParam: {"sURL": sURL},
            dInfo: {}
        });
    }
}







>




>











180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203

    logInnerHTML () {
        // for debugging
        console.log(this.xPanel.innerHTML);
    }

    startWaitIcon () {
        this.bWorking = true;
        this.xWaitIcon.style.visibility = "visible";
    }

    stopWaitIcon () {
        this.bWorking = false;
        this.xWaitIcon.style.visibility = "hidden";
    }

    openURL (sURL) {
        xGrammalectePort.postMessage({
            sCommand: "openURL",
            dParam: {"sURL": sURL},
            dInfo: {}
        });
    }
}

Modified gc_lang/fr/webext/content_scripts/panel_gc.js from [f6257cdef8] to [ac0e21ecd2].

76
77
78
79
80
81
82

83
84
85
86
87
88

89
90
91

92

93
94

95
96
97
98
99
100
101
102
103
104
105
106

107

108
109
110
111
112
113
114
115
116
117
118
119
120
121
122

123
124
125
126
127
128
129
        this.xMenu = oGrammalecte.createNode("div", {className: "grammalecte_panel_menu"});
        this.xTFButton = oGrammalecte.createNode("div", {className: "grammalecte_menu_button", textContent: "Formateur de texte"});
        this.xEditorButton = oGrammalecte.createNode("div", {className: "grammalecte_menu_button", textContent: "Éditeur"});
        this.xLxgButton = oGrammalecte.createNode("div", {className: "grammalecte_menu_button", textContent: "Lexicographe"});
        this.xConjButton = oGrammalecte.createNode("div", {className: "grammalecte_menu_button", textContent: "Conjugueur"});
        this.xLEButton = oGrammalecte.createNode("div", {className: "grammalecte_menu_button", textContent: "•Éditeur lexical•"});
        this.xTFButton.onclick = () => {

            if (this.xNode  && (this.xNode.tagName == "TEXTAREA" || this.xNode.tagName == "INPUT" || this.xNode.isContentEditable)) {
                oGrammalecte.createTFPanel();
                oGrammalecte.oTFPanel.start(this);
                oGrammalecte.oTFPanel.show();
            } else {
                oGrammalecte.showMessage("Aucune zone de texte éditable sur laquelle appliquer le formatage de texte.")

            }
        };
        this.xEditorButton.onclick = () => {

            this.showEditor();

        };
        this.xLxgButton.onclick = () => {

            this.showLexicographer();
            if (true) {
                this.clearLexicographer();
                this.startWaitIcon();
                xGrammalectePort.postMessage({
                    sCommand: "getListOfTokens",
                    dParam: {sText: this.getParsedText()},
                    dInfo: ((this.xNode) ? {sTextAreaId: this.xNode.id} : {})
                });
            }
        };
        this.xConjButton.onclick = () => {

            this.showConjugueur();

        };
        this.xLEButton.onclick = () => {
            xGrammalectePort.postMessage({sCommand: "openLexiconEditor", dParam: null, dInfo: null});
        };
        this.xMenu.appendChild(this.xTFButton)
        this.xMenu.appendChild(this.xEditorButton)
        this.xMenu.appendChild(this.xLxgButton)
        this.xMenu.appendChild(this.xConjButton)
        this.xMenu.appendChild(this.xLEButton)
        this.xPanelBar.appendChild(this.xMenu);
    }

    start (xNode=null) {
        this.xNode = xNode;
        this.oTooltip.hide();

        this.clear();
        if (xNode) {
            this.oNodeControl.setNode(xNode);
            if (!(xNode.tagName == "TEXTAREA" || xNode.tagName == "INPUT")) {
                this.addMessage("Note : cette zone de texte n’est pas un champ de formulaire “textarea” mais un node HTML éditable. Une telle zone de texte est susceptible de contenir des éléments non textuels qui seront effacés lors de la correction.");
            }
        }







>
|
|
|
|
|
|
>



>
|
>


>
|
<










>
|
>















>







76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100

101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
        this.xMenu = oGrammalecte.createNode("div", {className: "grammalecte_panel_menu"});
        this.xTFButton = oGrammalecte.createNode("div", {className: "grammalecte_menu_button", textContent: "Formateur de texte"});
        this.xEditorButton = oGrammalecte.createNode("div", {className: "grammalecte_menu_button", textContent: "Éditeur"});
        this.xLxgButton = oGrammalecte.createNode("div", {className: "grammalecte_menu_button", textContent: "Lexicographe"});
        this.xConjButton = oGrammalecte.createNode("div", {className: "grammalecte_menu_button", textContent: "Conjugueur"});
        this.xLEButton = oGrammalecte.createNode("div", {className: "grammalecte_menu_button", textContent: "•Éditeur lexical•"});
        this.xTFButton.onclick = () => {
            if (!this.bWorking) {
                if (this.xNode && (this.xNode.tagName == "TEXTAREA" || this.xNode.tagName == "INPUT" || this.xNode.isContentEditable)) {
                    oGrammalecte.createTFPanel();
                    oGrammalecte.oTFPanel.start(this);
                    oGrammalecte.oTFPanel.show();
                } else {
                    oGrammalecte.showMessage("Aucune zone de texte éditable sur laquelle appliquer le formatage de texte.")
                }
            }
        };
        this.xEditorButton.onclick = () => {
            if (!this.bWorking) {
                this.showEditor();
            }
        };
        this.xLxgButton.onclick = () => {
            if (!this.bWorking) {
                this.showLexicographer();

                this.clearLexicographer();
                this.startWaitIcon();
                xGrammalectePort.postMessage({
                    sCommand: "getListOfTokens",
                    dParam: {sText: this.getParsedText()},
                    dInfo: ((this.xNode) ? {sTextAreaId: this.xNode.id} : {})
                });
            }
        };
        this.xConjButton.onclick = () => {
            if (!this.bWorking) {
                this.showConjugueur();
            }
        };
        this.xLEButton.onclick = () => {
            xGrammalectePort.postMessage({sCommand: "openLexiconEditor", dParam: null, dInfo: null});
        };
        this.xMenu.appendChild(this.xTFButton)
        this.xMenu.appendChild(this.xEditorButton)
        this.xMenu.appendChild(this.xLxgButton)
        this.xMenu.appendChild(this.xConjButton)
        this.xMenu.appendChild(this.xLEButton)
        this.xPanelBar.appendChild(this.xMenu);
    }

    start (xNode=null) {
        this.xNode = xNode;
        this.oTooltip.hide();
        this.bWorking = false;
        this.clear();
        if (xNode) {
            this.oNodeControl.setNode(xNode);
            if (!(xNode.tagName == "TEXTAREA" || xNode.tagName == "INPUT")) {
                this.addMessage("Note : cette zone de texte n’est pas un champ de formulaire “textarea” mais un node HTML éditable. Une telle zone de texte est susceptible de contenir des éléments non textuels qui seront effacés lors de la correction.");
            }
        }