Grammalecte  Check-in [5c343989d1]

Overview
Comment:[fx] WebExt: wrap only the bottom of textarea (unsatifying but good enough for now)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | fx
Files: files | file ages | folders
SHA3-256: 5c343989d1133e3ee64c724f2fa193d1120b9e0f087373337bb9036a72a3649c
User & Date: olr on 2017-09-05 08:32:53
Other Links: manifest | tags
Context
2017-09-05
16:26
[fx] WebExt: try to protect elements from CSS inheritance (text formatter) check-in: 7013921cad user: olr tags: trunk, fx
08:32
[fx] WebExt: wrap only the bottom of textarea (unsatifying but good enough for now) check-in: 5c343989d1 user: olr tags: trunk, fx
2017-09-04
10:05
[build] compile_rules: separate js conversion from main code check-in: 7595474b17 user: olr tags: trunk, build
Changes

Modified gc_lang/fr/webext/content_scripts/wrapper.css from [b62a23721a] to [bbf425edb7].

1
2
3
4
5
6
7
8
9
10




11


12
13


14
15
16
17

18
19


20
21

22

23
24
25
26
27
28
29
1
2
3
4
5
6
7



8
9
10
11
12
13
14


15
16
17
18
19
20
21


22
23
24
25
26

27
28
29
30
31
32
33
34







-
-
-
+
+
+
+

+
+
-
-
+
+




+
-
-
+
+


+
-
+







/*
    CSS
    Wrappen for Grammalecte
*/


.grammalecte_wrapper {
    margin: 3px;
    padding: 5px;
    border-radius: 3px;
    margin: 0 0 5px 0;
    padding: 2px 5px 5px 5px;
    box-sizing: border-box;
    border-radius: 0 0 3px 3px;
    background-color: hsla(210, 100%, 96%, .2);
    border-left:   1px solid hsla(210, 100%, 92%, .2);
    border-right:  1px solid hsla(210, 100%, 92%, .2);
    border: 1px solid hsla(210, 100%, 92%, .2);
    box-shadow: 0 0 2px hsla(210, 100%, 0%, .2);
    border-bottom: 1px solid hsla(210, 100%, 92%, .2);
    /*box-shadow: 0 0 2px hsla(210, 100%, 0%, .2);*/
    font-family: "Trebuchet MS", "Liberation Sans", sans-serif;
}

.grammalecte_wrapper_title {
    display: inline-block;
    padding: 5px 0;
    font-size: 12px;
    padding: 2px 5px;
    font-size: 14px;
    font-weight: bold;
    font-variant: small-caps;
    text-shadow: 0px 1px 0px hsla(210, 10%, 10%, .8);
    color: hsla(210, 100%, 50%, .5);
    color: hsla(210, 100%, 90%, .5);
}

.grammalecte_wrapper_toolbar {
    display: flex;
    justify-content: flex-end;
    margin-top: 5px;
    padding: 5px 10px;

Modified gc_lang/fr/webext/content_scripts/wrapper.js from [01e5972759] to [41723fc48c].

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





16
17
18
19


20
21
22
23
24
25
26
1
2
3
4
5
6
7
8
9

10




11
12
13
14
15
16
17


18
19
20
21
22
23
24
25
26









-

-
-
-
-
+
+
+
+
+


-
-
+
+







// JavaScript

"use strict";


class GrammalecteWrapper {

    constructor (nWrapper, xTextArea) {
        this.nWrapper = nWrapper;
        let xParentElement = xTextArea.parentElement;
        let xWrapper = createNode("div", {id: "grammalecte_wrapper" + nWrapper, className: "grammalecte_wrapper"});
        xParentElement.insertBefore(xWrapper, xTextArea);
        xWrapper.appendChild(this._createTitle());
        xWrapper.appendChild(xTextArea); // move textarea in wrapper
        xWrapper.appendChild(this._createWrapperToolbar(xTextArea));
        xWrapper.appendChild(this._createWrapperToolbar(xTextArea));
        this._insertAfter(xWrapper, xTextArea);
        xWrapper.style.marginBottom = xTextArea.style.marginBottom;
        xTextArea.style.marginBottom = "0px";
        xWrapper.style.width = xTextArea.style.width;
    }

    _createTitle () {
        return createNode("div", {className: "grammalecte_wrapper_title", textContent: "Grammalecte"});
    _insertAfter (xNewNode, xReferenceNode) {
        xReferenceNode.parentNode.insertBefore(xNewNode, xReferenceNode.nextSibling);
    }

    _createWrapperToolbar (xTextArea) {
        try {
            let xToolbar = createNode("div", {className: "grammalecte_wrapper_toolbar"});
            let xConjButton = createNode("div", {className: "grammalecte_wrapper_button", textContent: "Conjuguer"});
            xConjButton.onclick = () => { this.showConjButtons(); };
64
65
66
67
68
69
70
71

72
73
74
75
76
77
78
64
65
66
67
68
69
70

71
72
73
74
75
76
77
78







-
+







                    dParam: {sText: xTextArea.value, sCountry: "FR", bDebug: false, bContext: false},
                    dInfo: {sTextAreaId: xTextArea.id}
                });
            };
            // Create
            //xToolbar.appendChild(createNode("img", {scr: browser.extension.getURL("img/logo-16.png")}));
            // can’t work, due to content-script policy: https://bugzilla.mozilla.org/show_bug.cgi?id=1267027
            //xToolbar.appendChild(createLogo());
            xToolbar.appendChild(createNode("div", {className: "grammalecte_wrapper_title", textContent: "Grammalecte"}))
            xToolbar.appendChild(xConjButton);
            xConjSection.appendChild(xConjButtonTab);
            xConjSection.appendChild(xConjButtonWin);
            xToolbar.appendChild(xConjSection);
            xToolbar.appendChild(xTFButton);
            xToolbar.appendChild(xLxgButton);
            xToolbar.appendChild(xGCButton);