Grammalecte  Check-in [f8cceefa3c]

Overview
Comment:[fx] Oups it's not necessary to have sUrl in panel or msgbox
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | fx | shadowdom
Files: files | file ages | folders
SHA3-256: f8cceefa3c1ea7aea50d933f10b27a968278f76f90b8ad52edcc95f4f02e23fe
User & Date: IllusionPerdu on 2018-10-19 14:57:41
Other Links: branch diff | manifest | tags
Context
2018-10-19
15:07
[fx] We can expose the css in webpage check-in: 3da397c601 user: IllusionPerdu tags: fx, shadowdom
14:57
[fx] Oups it's not necessary to have sUrl in panel or msgbox check-in: f8cceefa3c user: IllusionPerdu tags: fx, shadowdom
14:45
[fx] Use Shadow DOM in messagebox when avaible check-in: 91852523ef user: IllusionPerdu tags: fx, shadowdom
Changes

Modified gc_lang/fr/webext/content_scripts/init.js from [8652e4ede8] to [b02978e970].

135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
        this.lMenu.length = 0; // to clear an array
        this.listenRightClick();
        this.createMenus();
    },

    createTFPanel: function () {
        if (this.oTFPanel === null) {
            this.oTFPanel = new GrammalecteTextFormatter(this.sExtensionUrl, "grammalecte_tf_panel", "Formateur de texte", 760, 600, false);
            //this.oTFPanel.logInnerHTML();
            this.oTFPanel.insertIntoPage();
            this.oTFPanel.adjustHeight();
        }
    },

    createLxgPanel: function () {
        if (this.oLxgPanel === null) {
            this.oLxgPanel = new GrammalecteLexicographer(this.sExtensionUrl, "grammalecte_lxg_panel", "Lexicographe", 500, 700);
            this.oLxgPanel.insertIntoPage();
        }
    },

    createGCPanel: function () {
        if (this.oGCPanel === null) {
            this.oGCPanel = new GrammalecteGrammarChecker(this.sExtensionUrl, "grammalecte_gc_panel", "Grammalecte", 500, 700);
            this.oGCPanel.insertIntoPage();
        }
    },

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

    startGCPanel: function (xNode=null) {
        this.createGCPanel();
        this.oGCPanel.clear();







|








|






|






|







135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
        this.lMenu.length = 0; // to clear an array
        this.listenRightClick();
        this.createMenus();
    },

    createTFPanel: function () {
        if (this.oTFPanel === null) {
            this.oTFPanel = new GrammalecteTextFormatter("grammalecte_tf_panel", "Formateur de texte", 760, 600, false);
            //this.oTFPanel.logInnerHTML();
            this.oTFPanel.insertIntoPage();
            this.oTFPanel.adjustHeight();
        }
    },

    createLxgPanel: function () {
        if (this.oLxgPanel === null) {
            this.oLxgPanel = new GrammalecteLexicographer("grammalecte_lxg_panel", "Lexicographe", 500, 700);
            this.oLxgPanel.insertIntoPage();
        }
    },

    createGCPanel: function () {
        if (this.oGCPanel === null) {
            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");
            this.oMessageBox.insertIntoPage();
        }
    },

    startGCPanel: function (xNode=null) {
        this.createGCPanel();
        this.oGCPanel.clear();

Modified gc_lang/fr/webext/content_scripts/message_box.js from [1ad982bafb] to [570e256791].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// JavaScript
// Panel creator

/* jshint esversion:6, -W097 */
/* jslint esversion:6 */
/* global oGrammalecte, xGrammalectePort, showError, window, document, console */

"use strict";


class GrammalecteMessageBox {

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

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












|

<







1
2
3
4
5
6
7
8
9
10
11
12
13
14

15
16
17
18
19
20
21
// JavaScript
// Panel creator

/* jshint esversion:6, -W097 */
/* jslint esversion:6 */
/* global oGrammalecte, xGrammalectePort, showError, window, document, console */

"use strict";


class GrammalecteMessageBox {

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


        this.bShadow = document.body.createShadowRoot || document.body.attachShadow;
        if (this.bShadow){
            this.oShadowPanel = oGrammalecte.createNode("div", {id: this.sId+"_shadow", style: "width:0;height:0;"});
            this.oShadow = this.oShadowPanel.attachShadow({mode: "open"});
            this.oParent = this.oShadow;
        } else {
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
        xButton.onclick = function () { this.hide(); }.bind(this);  // better than writing “let that = this;” before the function?
        return xButton;
    }

    insertIntoPage () {
        if (this.bShadow){
            this.oShadow.appendChild(
                oGrammalecte.createNode("link", {rel: "stylesheet", type: "text/css", media: "all", href: this.sUrl+"content_scripts/panel.css"})
            );
            this.oShadow.appendChild(
                oGrammalecte.createNode("link", {rel: "stylesheet", type: "text/css", media: "all", href: this.sUrl+"content_scripts/message_box.css"})
            );
            this.oShadow.appendChild(this.xMessageBox);
            document.body.appendChild(this.oShadowPanel);
        } else {
            document.body.appendChild(this.xMessageBox);
        }
    }







|


|







62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
        xButton.onclick = function () { this.hide(); }.bind(this);  // better than writing “let that = this;” before the function?
        return xButton;
    }

    insertIntoPage () {
        if (this.bShadow){
            this.oShadow.appendChild(
                oGrammalecte.createNode("link", {rel: "stylesheet", type: "text/css", media: "all", href: oGrammalecte.sExtensionUrl + "content_scripts/panel.css"})
            );
            this.oShadow.appendChild(
                oGrammalecte.createNode("link", {rel: "stylesheet", type: "text/css", media: "all", href: oGrammalecte.sExtensionUrl + "content_scripts/message_box.css"})
            );
            this.oShadow.appendChild(this.xMessageBox);
            document.body.appendChild(this.oShadowPanel);
        } else {
            document.body.appendChild(this.xMessageBox);
        }
    }

Modified gc_lang/fr/webext/content_scripts/panel.js from [c0643e0a2c] to [c76d6fb8d0].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// JavaScript
// Panel creator

/* jshint esversion:6, -W097 */
/* jslint esversion:6 */
/* global GrammalectePanel, oGrammalecte, xGrammalectePort, showError, window, document, console */

"use strict";


class GrammalectePanel {

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

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












|

<







1
2
3
4
5
6
7
8
9
10
11
12
13
14

15
16
17
18
19
20
21
// JavaScript
// Panel creator

/* jshint esversion:6, -W097 */
/* jslint esversion:6 */
/* global GrammalectePanel, oGrammalecte, xGrammalectePort, showError, window, document, console */

"use strict";


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.oShadowPanel = oGrammalecte.createNode("div", {id: this.sId+"_shadow", style: "width:0;height:0;"});
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
        xButton.onclick = function () { this.hide(); }.bind(this);  // better than writing “let that = this;” before the function?
        return xButton;
    }

    insertIntoPage () {
        if (this.bShadow){
            this.oShadow.appendChild(
                oGrammalecte.createNode("link", {rel: "stylesheet", type: "text/css", media: "all", href: this.sUrl+"content_scripts/panel.css"})
            );
            this.oShadow.appendChild(
                oGrammalecte.createNode("link", {rel: "stylesheet", type: "text/css", media: "all", href: this.sUrl+"content_scripts/panel_gc.css"})
            );
            this.oShadow.appendChild(
                oGrammalecte.createNode("link", {rel: "stylesheet", type: "text/css", media: "all", href: this.sUrl+"content_scripts/panel_lxg.css"})
            );
            this.oShadow.appendChild(
                oGrammalecte.createNode("link", {rel: "stylesheet", type: "text/css", media: "all", href: this.sUrl+"content_scripts/panel_tf.css"})
            );
            this.oShadow.appendChild(this.xPanel);
            document.body.appendChild(this.oShadowPanel);
        } else {
            document.body.appendChild(this.xPanel);
        }
    }







|


|


|


|







95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
        xButton.onclick = function () { this.hide(); }.bind(this);  // better than writing “let that = this;” before the function?
        return xButton;
    }

    insertIntoPage () {
        if (this.bShadow){
            this.oShadow.appendChild(
                oGrammalecte.createNode("link", {rel: "stylesheet", type: "text/css", media: "all", href: oGrammalecte.sExtensionUrl + "content_scripts/panel.css"})
            );
            this.oShadow.appendChild(
                oGrammalecte.createNode("link", {rel: "stylesheet", type: "text/css", media: "all", href: oGrammalecte.sExtensionUrl + "content_scripts/panel_gc.css"})
            );
            this.oShadow.appendChild(
                oGrammalecte.createNode("link", {rel: "stylesheet", type: "text/css", media: "all", href: oGrammalecte.sExtensionUrl + "content_scripts/panel_lxg.css"})
            );
            this.oShadow.appendChild(
                oGrammalecte.createNode("link", {rel: "stylesheet", type: "text/css", media: "all", href: oGrammalecte.sExtensionUrl + "content_scripts/panel_tf.css"})
            );
            this.oShadow.appendChild(this.xPanel);
            document.body.appendChild(this.oShadowPanel);
        } else {
            document.body.appendChild(this.xPanel);
        }
    }