Grammalecte  Check-in [96618e5b78]

Overview
Comment:[fx] WebExt: exclude panels content from GC and lexicographer analysis
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | fx | webext3
Files: files | file ages | folders
SHA3-256: 96618e5b78814ab43b2f875a1fc90c3cabacecd88f4d38a4300548cad019d751
User & Date: olr on 2017-10-12 10:01:13
Other Links: branch diff | manifest | tags
Context
2017-10-12
10:19
[fx] WebExt: useless node id check-in: a1ae783d64 user: olr tags: fx, webext3
10:01
[fx] WebExt: exclude panels content from GC and lexicographer analysis check-in: 96618e5b78 user: olr tags: fx, webext3
2017-10-11
18:07
[fx] WebExt: tab id (bug) + parse full page check-in: 94ae41b9ee user: olr tags: fx, webext3
Changes

Modified gc_lang/fr/webext/content_scripts/init.js from [37c7ef1ed2] to [be5aff6344].

109
110
111
112
113
114
115









116
117
118
119
120
121
122
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131







+
+
+
+
+
+
+
+
+








    startLxgPanel: function () {
        oGrammalecte.createLxgPanel();
        oGrammalecte.oLxgPanel.clear();
        oGrammalecte.oLxgPanel.show();
        oGrammalecte.oLxgPanel.startWaitIcon();
    },

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

    createNode: function (sType, oAttr, oDataset=null) {
        try {
            let xNode = document.createElement(sType);
            Object.assign(xNode, oAttr);
            if (oDataset) {
                Object.assign(xNode.dataset, oDataset);
183
184
185
186
187
188
189
190

191
192
193
194
195
196
197
192
193
194
195
196
197
198

199
200
201
202
203
204
205
206







-
+







                dInfo: {sTextAreaId: xRightClickedNode.id}
            });
            break;
        case "rightClickGCPage":
            oGrammalecte.startGCPanel();
            xGrammalectePort.postMessage({
                sCommand: "parseAndSpellcheck",
                dParam: {sText: document.body.textContent, sCountry: "FR", bDebug: false, bContext: false},
                dParam: {sText: oGrammalecte.getPageText(), sCountry: "FR", bDebug: false, bContext: false},
                dInfo: {sTextAreaId: xRightClickedNode.id}
            });
            break;
        case "rightClickGCSelectedText":
            oGrammalecte.startGCPanel();
            // selected text is sent to the GC worker in the background script.
            break;
205
206
207
208
209
210
211
212

213
214
215
216
217
218
219
214
215
216
217
218
219
220

221
222
223
224
225
226
227
228







-
+







                dInfo: {sTextAreaId: xRightClickedNode.id}
            });
            break;
        case "rightClickLxgPage":
            oGrammalecte.startLxgPanel();
            xGrammalectePort.postMessage({
                sCommand: "getListOfTokens",
                dParam: {sText: document.body.textContent},
                dParam: {sText: oGrammalecte.getPageText()},
                dInfo: {sTextAreaId: xRightClickedNode.id}
            });
            break;
        case "rightClickLxgSelectedText":
            oGrammalecte.startLxgPanel();
            // selected text is sent to the GC worker in the background script.
            break;

Modified gc_lang/fr/webext/content_scripts/panel.css from [16626ac74c] to [1284de6bee].

36
37
38
39
40
41
42





43
44
45
46
47
48
49
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54







+
+
+
+
+







}
.grammalecte_panel_title {
    padding: 10px 20px;
}
.grammalecte_panel_label {
    display: inline-block;
    padding: 0 10px;
}
.grammalecte_panel_invisible_marker {
    font-size: 1px;
    position: absolute;
    visibility: hidden;
}

.grammalecte_panel_commands {
    float: right;
}
.grammalecte_copy_button {
    display: inline-block;

Modified gc_lang/fr/webext/content_scripts/panel.js from [8cea12fb98] to [18e69bae0d].

17
18
19
20
21
22
23

24
25
26
27
28
29
30
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31







+







        this.xPanel = this._createPanel(sTitle);
        this.center();
    }

    _createPanel (sTitle) {
        try {
            let xPanel = oGrammalecte.createNode("div", {id: this.sId, className: "grammalecte_panel"});
            this.xPanelBar.appendChild(oGrammalecte.createNode("div", {className: "grammalecte_panel_invisible_marker", textContent: "__grammalecte_panel__"}));
            this.xPanelBar.appendChild(this._createButtons());
            let xTitle = oGrammalecte.createNode("div", {className: "grammalecte_panel_title"});
            xTitle.appendChild(this._createLogo());
            xTitle.appendChild(oGrammalecte.createNode("div", {className: "grammalecte_panel_label", textContent: sTitle}));
            this.xPanelBar.appendChild(xTitle);
            xPanel.appendChild(this.xPanelBar);
            xPanel.appendChild(this.xPanelContent);