Grammalecte  Check-in [8058c7ee7c]

Overview
Comment:[fx] gc panel: ajustements
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | fx
Files: files | file ages | folders
SHA3-256: 8058c7ee7ca330610b6a1c299f0f810e5974e4cefc938cf53f14d7291b20c1e9
User & Date: olr on 2019-05-07 20:04:34
Other Links: manifest | tags
Context
2019-05-08
08:32
[fx] gc panel: fix conjugueur check-in: 385da73cc1 user: olr tags: trunk, fx
2019-05-07
20:04
[fx] gc panel: ajustements check-in: 8058c7ee7c user: olr tags: trunk, fx
16:01
[fx] gc panel: update ui, better signs check-in: db3f9c82ad user: olr tags: trunk, fx
Changes

Modified gc_lang/fr/webext/content_scripts/init.js from [cd70530a11] to [7c92c88614].

143
144
145
146
147
148
149
150

151
152
153
154
155
156
157
143
144
145
146
147
148
149

150
151
152
153
154
155
156
157







-
+







            this.oTFPanel.insertIntoPage();
            window.setTimeout( () => { this.oTFPanel.adjustHeight(); }, 50);
        }
    },

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

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

Modified gc_lang/fr/webext/content_scripts/panel.css from [bf95844ca5] to [ec430696b6].

64
65
66
67
68
69
70
71

72
73
74
75


76
77
78
79
80
81
82
64
65
66
67
68
69
70

71
72
73


74
75
76
77
78
79
80
81
82







-
+


-
-
+
+







    font-size: 14px;
    font-weight: bold;
    text-align: center;
    cursor: pointer;
}
div.grammalecte_copy_button {
    border-radius: 2px;
    color: hsla(150, 0%, 100%, .5);
    color: hsla(210, 0%, 100%, .5);
}
div.grammalecte_copy_button:hover {
    background-color: hsl(150, 90%, 35%);
    color: hsla(150, 0%, 100%, 1);
    background-color: hsl(210, 90%, 35%, .5);
    color: hsla(210, 0%, 100%, 1);
}
div.grammalecte_move_button {
    padding: 1px 5px;
    border-radius: 16px;
    color: hsla(180, 0%, 100%, .5);
}
div.grammalecte_move_button:hover {

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

75
76
77
78
79
80
81
82

83
84
85
86
87
88
89
75
76
77
78
79
80
81

82
83
84
85
86
87
88
89







-
+








    _createWaitIcon () {
        let xWaitIcon = oGrammalecte.createNode("div", {className: "grammalecte_spinner"});
        return xWaitIcon;
    }

    _createCopyButton () {
        let xButton = oGrammalecte.createNode("div", {id: "grammalecte_clipboard_button", className: "grammalecte_panel_button grammalecte_copy_button", textContent: "📋", title: "Copier dans le presse-papiers"});
        let xButton = oGrammalecte.createNode("div", {id: "grammalecte_clipboard_button", className: "grammalecte_panel_button grammalecte_copy_button", textContent: "📋", title: "Copier le contenu de l’éditeur dans le presse-papiers"});
        xButton.onclick = () => { this.copyTextToClipboard(); };
        return xButton;
    }

    _createMoveButton (sAction, sLabel, sTitle) {
        let xButton = oGrammalecte.createNode("div", {className: "grammalecte_panel_button grammalecte_move_button", textContent: sLabel, title: sTitle});
        xButton.onclick = () => { this[sAction](); };

Modified gc_lang/fr/webext/content_scripts/panel_conj.css from [4adfee4314] to [eca306ed4b].

33
34
35
36
37
38
39

40
41
42
43
44
45
46
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47







+








div.grammalecte_conj_container {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: center;
    align-items: flex-start;
    padding: 0 10px;
}

div.grammalecte_conj_column {
    width: 50%;
    padding: 0 10px;
    font-size: 12px;
}

Modified gc_lang/fr/webext/content_scripts/panel_gc.js from [349ae0830b] to [96169a3c96].

74
75
76
77
78
79
80
81

82
83
84
85
86
87
88
74
75
76
77
78
79
80

81
82
83
84
85
86
87
88







-
+








    createMenu () {
        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.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.")
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
317
318
319
320
321
322
323

324
325
326
327
328
329
330







-








    blockParagraph (xParagraph) {
        xParagraph.contentEditable = "false";
        this.xParent.getElementById("grammalecte_check"+xParagraph.dataset.para_num).textContent = "!!";
        this.xParent.getElementById("grammalecte_check"+xParagraph.dataset.para_num).style.backgroundColor = "hsl(0, 50%, 50%)";
        this.xParent.getElementById("grammalecte_check"+xParagraph.dataset.para_num).style.boxShadow = "0 0 0 3px hsla(0, 0%, 50%, .2)";
        this.xParent.getElementById("grammalecte_check"+xParagraph.dataset.para_num).style.animation = "grammalecte-pulse 1s linear infinite";

    }

    freeParagraph (xParagraph) {
        xParagraph.contentEditable = "true";
        let nStart = parseInt(xParagraph.dataset.caret_position_start);
        let nEnd = parseInt(xParagraph.dataset.caret_position_end);
        oGrammalecte.setCaretPosition(xParagraph, nStart, nEnd);
389
390
391
392
393
394
395
396

397
398
399
400
401
402
403
404
405

406
407
408
409
410
411
412
388
389
390
391
392
393
394

395
396
397
398
399
400
401
402


403
404
405
406
407
408
409
410







-
+







-
-
+







        document.execCommand("copy");
    }

    copyTextToClipboard () {
        this.startWaitIcon();
        try {
            let xClipboardButton = this.xParent.getElementById("grammalecte_clipboard_button");
            xClipboardButton.textContent = "->>";
            xClipboardButton.textContent = "⇒ presse-papiers";
            let sText = "";
            // Quand c'est dans un shadow "this.xParent.getElementsByClassName" n'existe pas.
            let xElem = this.xParent.getElementById("grammalecte_gc_panel");
            for (let xNode of xElem.getElementsByClassName("grammalecte_paragraph")) {
                sText += xNode.textContent + "\n";
            }
            this._copyToClipboard(sText);
            xClipboardButton.textContent = "⇒ presse-papiers";
            window.setTimeout(function() { xClipboardButton.textContent = "📋"; } , 2000);
            window.setTimeout(() => { xClipboardButton.textContent = "📋"; }, 2000);
        }
        catch (e) {
            showError(e);
        }
        this.stopWaitIcon();
    }

516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
514
515
516
517
518
519
520

521
522
523
524
525
526
527







-







                sVerb = this.xParent.getElementById('grammalecte_conj_verb').value;
            }
            this.xParent.getElementById('grammalecte_conj_oneg').checked = false;
            this.xParent.getElementById('grammalecte_conj_opro').checked = false;
            this.xParent.getElementById('grammalecte_conj_oint').checked = false;
            this.xParent.getElementById('grammalecte_conj_otco').checked = false;
            this.xParent.getElementById('grammalecte_conj_ofem').checked = false;

            // request analyzing
            sVerb = sVerb.trim().toLowerCase().replace(/’/g, "'").replace(/  +/g, " ");
            if (sVerb) {
                if (sVerb.startsWith("ne pas ")) {
                    this.xParent.getElementById('grammalecte_conj_oneg').checked = true;
                    sVerb = sVerb.slice(7);
                }
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574

575
576
577
578

579
580
581
582

583
584
585

586
587
588
589

590
591
592
593

594
595
596
597

598
599
600
601

602
603
604
605
606
607

608
609
610
611
612
613
614
552
553
554
555
556
557
558

559
560
561
562
563
564
565
566
567
568
569

570
571
572
573

574
575
576
577

578
579
580

581
582
583
584

585
586
587
588

589
590
591
592

593
594
595
596

597
598
599
600
601
602

603
604
605
606
607
608
609
610







-











-
+



-
+



-
+


-
+



-
+



-
+



-
+



-
+





-
+







    updateConj () {
        let bPro = this.xParent.getElementById('grammalecte_conj_opro').checked;
        let bNeg = this.xParent.getElementById('grammalecte_conj_oneg').checked;
        let bTpsCo = this.xParent.getElementById('grammalecte_conj_otco').checked;
        let bInt = this.xParent.getElementById('grammalecte_conj_oint').checked;
        let bFem = this.xParent.getElementById('grammalecte_conj_ofem').checked;
        if (this.sVerb) {
            console.log("updateConj send");
            xGrammalectePort.postMessage({
                sCommand: "getVerb",
                dParam: {sVerb: this.sVerb, bPro: bPro, bNeg: bNeg, bTpsCo: bTpsCo, bInt: bInt, bFem: bFem},
                dInfo: {}
            });
        }
    }

    conjugateWith (oVerb, oConjTable) {
        // function called when results come from the Worker
        if (oVerb) {
            this.xParent.getElementById('grammalecte_conj_verb').style = "color: #999999;";
            this.xParent.getElementById('grammalecte_conj_verb').style.color = "#999999";
            this.xParent.getElementById('grammalecte_conj_verb').value = "";
            this.xParent.getElementById('grammalecte_conj_verb_title').textContent = oVerb.sVerb;
            this.xParent.getElementById('grammalecte_conj_verb_info').textContent = oVerb.sInfo;
            this.xParent.getElementById('grammalecte_conj_opro').textContent = oVerb.sProLabel;
            this.xParent.getElementById('grammalecte_conj_opro_lbl').textContent = oVerb.sProLabel;
            if (oVerb.bUncomplete) {
                this.xParent.getElementById('grammalecte_conj_opro').checked = false;
                this.xParent.getElementById('grammalecte_conj_opro').disabled = true;
                this.xParent.getElementById('grammalecte_conj_opro_lbl').style = "color: #CCC;";
                this.xParent.getElementById('grammalecte_conj_opro_lbl').style.color = "#CCC";
                this.xParent.getElementById('grammalecte_conj_otco').checked = false;
                this.xParent.getElementById('grammalecte_conj_otco').disabled = true;
                this.xParent.getElementById('grammalecte_conj_otco_lbl').style = "color: #CCC;";
                this.xParent.getElementById('grammalecte_conj_otco_lbl').style.color = "#CCC";
                this.xParent.getElementById('grammalecte_conj_note').textContent = "Ce verbe n’a pas encore été vérifié. C’est pourquoi les options “pronominal” et “temps composés” sont désactivées.";
            } else {
                this.xParent.getElementById('grammalecte_conj_otco').disabled = false;
                this.xParent.getElementById('grammalecte_conj_otco_lbl').style = "color: #000;";
                this.xParent.getElementById('grammalecte_conj_otco_lbl').style.color = "#000";
                if (oVerb.nPronominable == 0) {
                    this.xParent.getElementById('grammalecte_conj_opro').checked = false;
                    this.xParent.getElementById('grammalecte_conj_opro').disabled = false;
                    this.xParent.getElementById('grammalecte_conj_opro_lbl').style = "color: #000;";
                    this.xParent.getElementById('grammalecte_conj_opro_lbl').style.color = "#000";
                } else if (oVerb.nPronominable == 1) {
                    this.xParent.getElementById('grammalecte_conj_opro').checked = true;
                    this.xParent.getElementById('grammalecte_conj_opro').disabled = true;
                    this.xParent.getElementById('grammalecte_conj_opro_lbl').style = "color: #CCC;";
                    this.xParent.getElementById('grammalecte_conj_opro_lbl').style.color = "#CCC";
                } else { // -1 or 1 or error
                    this.xParent.getElementById('grammalecte_conj_opro').checked = false;
                    this.xParent.getElementById('grammalecte_conj_opro').disabled = true;
                    this.xParent.getElementById('grammalecte_conj_opro_lbl').style = "color: #CCC;";
                    this.xParent.getElementById('grammalecte_conj_opro_lbl').style.color = "#CCC";
                }
                this.xParent.getElementById('grammalecte_conj_note').textContent = "❦";
            }
            this._displayConj(oConjTable);
        } else {
            this.xParent.getElementById('grammalecte_conj_verb').style = "color: #BB4411;";
            this.xParent.getElementById('grammalecte_conj_verb').style.color = "#BB4411";
        }
    }

    _displayConj (oConjTable) {
        if (oConjTable === null) {
            return;
        }