Grammalecte  Check-in [53f7b50983]

Overview
Comment:[tb][fx] adapt conjugueur to MailExtension -> no input allowed in compose scripts
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | tb | fx | mailext
Files: files | file ages | folders
SHA3-256: 53f7b50983e4a12b9916c3a76fec84df5fdd6320df27cc2ff38b2b6bf2e7df9c
User & Date: olr on 2020-07-09 13:07:46
Other Links: branch diff | manifest | tags
Context
2020-07-09
14:56
[tb][fx] editor & text formatter: update for MailExtension check-in: 4553dac0b4 user: olr tags: fx, mailext, tb
13:07
[tb][fx] adapt conjugueur to MailExtension -> no input allowed in compose scripts check-in: 53f7b50983 user: olr tags: fx, mailext, tb
2020-07-08
17:26
[tb][fx] adjustement for Mail Extension: no event for input -> no autorefresh check-in: 081fa7f8ca user: olr tags: fx, mailext, tb
Changes

Modified gc_lang/fr/webext/content_scripts/html_src.js from [33c5ac1d61] to [32b2f1f9e8].

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
35
36
37
    @Reviewers:
    This file only defines HTML nodes in const values
*/


const sGrammalecteConjugueurHTML = `
    <div class="centered_bar">
        <input type="text" id="grammalecte_conj_verb" maxlength="40" value="" placeholder="entrez un verbe" autofocus />
        <div id="grammalecte_conj_button">Conjuguer</div>
    </div>

    <div class="grammalecte_clearer"></div>

    <h1 class="grammalecte_conj_title" id="grammalecte_conj_verb_title" class="center">&nbsp;</h1>
    <div id="grammalecte_conj_verb_info" class="center">&nbsp;</div>

    <div id="grammalecte_conj_options">
        <label for="grammalecte_conj_oneg">Négative</label> <input type="checkbox" id="grammalecte_conj_oneg" value="ON"  />
        · <label for="grammalecte_conj_oint">Interrogative</label> <input type="checkbox" id="grammalecte_conj_oint" value="ON"  />
        · <label for="grammalecte_conj_ofem">Féminin</label> <input type="checkbox" id="grammalecte_conj_ofem" value="ON"  />
        <br/><label id="grammalecte_conj_opro_lbl" for="grammalecte_conj_opro">Pronominal</label> <input type="checkbox" id="grammalecte_conj_opro" value="ON"  />
        · <label id="grammalecte_conj_otco_lbl" for="grammalecte_conj_otco">Temps composés</label> <input type="checkbox" id="grammalecte_conj_otco" value="ON"  />

    </div>
    <div id="grammalecte_conj_note">❦</div>

    <!-- section 1 -->
    <div class="grammalecte_conj_container">
        <div class="grammalecte_conj_column">
            <div id="infinitif">







|









|
|
|
|
|
>







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
35
36
37
38
    @Reviewers:
    This file only defines HTML nodes in const values
*/


const sGrammalecteConjugueurHTML = `
    <div class="centered_bar">
        <div contenteditable="true" id="grammalecte_conj_verb" autofocus >entrez un verbe</div>
        <div id="grammalecte_conj_button">Conjuguer</div>
    </div>

    <div class="grammalecte_clearer"></div>

    <h1 class="grammalecte_conj_title" id="grammalecte_conj_verb_title" class="center">&nbsp;</h1>
    <div id="grammalecte_conj_verb_info" class="center">&nbsp;</div>

    <div id="grammalecte_conj_options">
        <div id="grammalecte_conj_oneg" class="grammalecte_conj_option_off" data-selected="off">Négation</div>
        · <div id="grammalecte_conj_oint" class="grammalecte_conj_option_off" data-selected="off">Interrogatif</div>
        · <div id="grammalecte_conj_ofem" class="grammalecte_conj_option_off" data-selected="off">Féminin</div>
        <br/>
        <div id="grammalecte_conj_opro" class="grammalecte_conj_option_off" data-selected="off">Pronominal</div>
        · <div id="grammalecte_conj_otco" class="grammalecte_conj_option_off" data-selected="off">Temps composés</div>
    </div>
    <div id="grammalecte_conj_note">❦</div>

    <!-- section 1 -->
    <div class="grammalecte_conj_container">
        <div class="grammalecte_conj_column">
            <div id="infinitif">

Modified gc_lang/fr/webext/content_scripts/panel.js from [647c8a603c] to [d95f7c1664].

191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
    setSizeAndPosition () {
        // size
        if (this.xWidthButton && this.xHeightButton) {
            this.xWidthButton.style.opacity = (this.bHorizStrech) ? ".9" : "";
            this.xHeightButton.style.opacity = (this.bVertStrech) ? ".9" : "";
        }
        let nWidth = Math.min(this.nWidth, window.innerWidth-200);
        let nHeight = Math.min(this.nHeight, window.innerHeight-100);
        if (this.bFlexible) {
            // width
            if (this.bHorizStrech) {
                nWidth = Math.min(this.nWidth*1.33, window.innerWidth-200);
            }
            // height
            nHeight = ([4, 5, 6].includes(this.nPosition)) ? nHeight : Math.floor(window.innerHeight*0.45);
            if (this.bVertStrech) {
                nHeight = ([4, 5, 6].includes(this.nPosition)) ? (window.innerHeight-100) : Math.floor(window.innerHeight*0.67);
            }
        }
        this.xPanel.style.width = `${nWidth}px`;
        this.xPanel.style.height = `${nHeight}px`;
        // position
        let oPos = null;
        switch (this.nPosition) {







|








|







191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
    setSizeAndPosition () {
        // size
        if (this.xWidthButton && this.xHeightButton) {
            this.xWidthButton.style.opacity = (this.bHorizStrech) ? ".9" : "";
            this.xHeightButton.style.opacity = (this.bVertStrech) ? ".9" : "";
        }
        let nWidth = Math.min(this.nWidth, window.innerWidth-200);
        let nHeight = Math.min(this.nHeight, window.innerHeight-50);
        if (this.bFlexible) {
            // width
            if (this.bHorizStrech) {
                nWidth = Math.min(this.nWidth*1.33, window.innerWidth-200);
            }
            // height
            nHeight = ([4, 5, 6].includes(this.nPosition)) ? nHeight : Math.floor(window.innerHeight*0.45);
            if (this.bVertStrech) {
                nHeight = ([4, 5, 6].includes(this.nPosition)) ? (window.innerHeight-50) : Math.floor(window.innerHeight*0.67);
            }
        }
        this.xPanel.style.width = `${nWidth}px`;
        this.xPanel.style.height = `${nHeight}px`;
        // position
        let oPos = null;
        switch (this.nPosition) {

Modified gc_lang/fr/webext/content_scripts/panel_conj.css from [e61b4b58d2] to [ec0b4594f9].

56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
..
95
96
97
98
99
100
101



















102
103
104
105
106
107
108
div.grammalecte_conj_column {
    width: 50%;
    padding: 0 10px;
    font-size: 12px;
}


input#grammalecte_conj_verb {
    display: inline-block;
    width: 230px;
    margin-left: 5px;
    padding: 5px 10px;
    border: 2px solid hsl(0, 0%, 80%);
    border-radius: 3px;
    height: 20px;
    background: transparent;
    font: normal 18px Tahoma, "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", sans-serif;
    color: hsl(0, 0%, 30%);
}
input[placeholder]#grammalecte_conj_verb {
    color: hsl(0, 0%, 70%);
}

div#grammalecte_conj_button {
    display: inline-block;
    padding: 7px 10px;
    font-size: 18px;
................................................................................
}

div#grammalecte_conj_options {
    margin: 10px 0 0 5px;
    font-size: 16px;
    text-align: center;
}




















div#grammalecte_conj_note {
    margin: 10px 20px;
    font-size: 11px;
    color: hsl(0, 0%, 60%);
    text-align: center;
}







|











|







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
..
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
div.grammalecte_conj_column {
    width: 50%;
    padding: 0 10px;
    font-size: 12px;
}


div#grammalecte_conj_verb {
    display: inline-block;
    width: 230px;
    margin-left: 5px;
    padding: 5px 10px;
    border: 2px solid hsl(0, 0%, 80%);
    border-radius: 3px;
    height: 20px;
    background: transparent;
    font: normal 18px Tahoma, "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", sans-serif;
    color: hsl(0, 0%, 30%);
}
div#grammalecte_conj_verb {
    color: hsl(0, 0%, 70%);
}

div#grammalecte_conj_button {
    display: inline-block;
    padding: 7px 10px;
    font-size: 18px;
................................................................................
}

div#grammalecte_conj_options {
    margin: 10px 0 0 5px;
    font-size: 16px;
    text-align: center;
}

div.grammalecte_conj_option_off {
    display: inline-block;
    margin: 2px;
    background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsIAAA7CARUoSoAAAAAZdEVYdFNvZnR3YXJlAHBhaW50Lm5ldCA0LjAuMTczbp9jAAADGUlEQVQ4T2P4//8/VTFWQUowggEEQJoRiJlB/BfPn6vMbmrp6AqPOdUeGPa4Iyj8cbN/0Kn5HV0db169UoHqA6kF6UGYg8QBSYAw09SKqtoaTYMvtfLq/5t5xf+1MTD9B+FGIZl/ILEaZe2vs5pba0FqkfRhNZChzNx6RYOU0v96Nb3/tWLyH6aVlC8+vHNX8Yn9B4on5RctrpFQ/FCnZfi/hUvsf7W714q3b9/C9YIwsoEMNaERdQ1aRv9rZFX/13r7bH729KkQVA7uirdv3gjVefpsrjez+d8gLPO/PSOzDqoGjOGMnVu3qtcZWryrU9T+3x0Tv+HFy5cMZ44d99+ydm0oTM38SZNDN61e4w9il+qabGgytftfzy34bsGcOeowNXAD8/kl2hpMrP7X8wm/b6mtFQFpbGZg+NfCwPRn5cJFDlPaOxwaROX+tLAL/ls4fYb/vbt3RWo1Dd7XA4Nn87LlbRgGlptbH28QV/o/rbxy6dt37xgak1PqmwQk/zdYO/yrkZD9WCsm/bHO2PIfMJL+d+fk13/79o0hX151aYOS9v8paZnHMQysNDZ/1Cgq939KTW0ZTGxKfUN+rZTy/zoLuz9Aw/7U6Br/7y0uzQfJ/fz5kyFHWKKsUdvof4uX3yOYHkwDa+vgBq5YsNClAeiiekvbP7UGZn/q9Ez+z504yQUk9wNoYJYIHgPBXgaGx+TCkiUg/qye3sgGAalf9daO/4Cu/FOrqgMy9B9IbNnsOZE/fvwAeXlJnYoOdi+DIqXRyPI/MLw+5GdmCk5raSkFJeZmLpH/faVl+eWhkfl1ihqgxP2/JSOr9O6dO4I12kYfcEYKPNnIa/3vT0rdcOnKFYYlU6bVTCwugStuTkppm1hVXfP6zRuGIgMCyQaE4QlbWvl/Q2Dwxtu3bvFB5eAJG5hc+Bp8AzY2ABN2k4A07oQNxGANkKyn8h8YZqAc8356eeXiQzt2Fp/Yt78YlA1rFTXfA9MfLOutxJf1YK6AFw71Mir/m5AKB2C6/AcSAxUOwJKIYOEAM5RqxRdVMFZB8vF/BgAKMNpeW+niqQAAAABJRU5ErkJggg==') no-repeat;
    background-color: none;
    padding: 0 3px 0 22px ;
    border-radius: 3px;
    cursor: pointer;
}
div.grammalecte_conj_option_on {
    display: inline-block;
    margin: 2px;
    background:  url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAOwQAADsEBuJFr7QAAABl0RVh0U29mdHdhcmUAcGFpbnQubmV0IDQuMC4xNzNun2MAAAMnSURBVDhPY/j//z9VMVZBSjC6ACMQM4PYz1+8UGmaPrsjvL7rVGB1++Oguo7H/pXNpzpmz+949eaNClQ9SC1ID9wMOAOIQRIgzFQxYWqtZk7NF/ms2v+8mc3/GAra/oOwUE7jP5CYcnbN1+aps2pBapH0YTWQwTyrbIVUVsN/rdy6/9KZNe8qJk5fsOvQkeL9x04UF/RMWSAPFAPJcWW1/HcvqF7x9u1buF4QRjaQIbS0pk6rsOG/ItAVLgXVG2/duSMOlYO74v7DR+JuBTVbDPPr/wvnNvzPaGqvg6oBYzhj686d6vq59e/Uc2r/B1U1r3v69ClMjgUNg7zJ4JBbsdK8qPE/d079uznzF6iDxEAYbiB/TH6bGdB1LFnNb3smTZaDioMMgKmBuZJtwtyFZcUNLYb62VWPpHLr/y/buLkNpg6mmME8p/y4PDBssjsmLIKKsQIxcqCDY9+/sGIab07Lf9XUssP66SUbFLPq/qf1TDkBkgNhuIHGOZWPhDIa/zdMnl4O4n/89AmUNPig8mCX+hdWz1AGWmpS0PhfOLF0oWZsVo0GMBw9K1oeQ9UhDDTMrHwkmtX4v6pvYv7xkyflGMqaP/oXV6/89esXWD6gsHKmcnbtf1AY+5Q3r9+0aRODXFhaiVYe2MBHGAYaZZUdNyhu+q+ZkD2ZNb6iTqOg4b9MZv3/6KrG2S6ZBRNVgC7Tyav7b5Zdufr3nz9sv4EWySTmLwaJA718HMNA4ficNsOihv8qOVVvI5PTxFNae6eL5jX+18yt/QM06C/IMAugYe8/fAB7//bde/LAxP9WCmgp1kgBJRvDvLp38sBATmzpXbt582aGhMauuaBYBLnCOLNiPTBcQRHFAAoGrZTidXiTDQiDEzYwTMSAhkbVtW6Yt3ART3Rd63xguoTFPMPd+/clPIvrNoKSGN6EDcTgnADKejJAV4EiwCi35iXQlQuXrN9UcuTM2fyCvimLZDNr3iJlvZX4sh4svTFV9E+pBYbdF4mc+v9AL//jym3+z1Dc+l8st46kwgFmKErxFVbXcdqvpv1JQE0nycUXVTBWQfLxfwYA8YUHpiMfZa8AAAAASUVORK5CYII=') no-repeat;
    background-color: hsla(120, 50%, 50%, .2);
    padding: 0 3px 0 22px;
    border-radius: 3px;
    cursor: pointer;
}

div#grammalecte_conj_note {
    margin: 10px 20px;
    font-size: 11px;
    color: hsl(0, 0%, 60%);
    text-align: center;
}

Modified gc_lang/fr/webext/content_scripts/panel_gc.js from [b47d4ce959] to [505aead2d8].

472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
...
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
...
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
615
616
617
618
619
620
621
622
623
624

625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
...
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
...
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
            // Firefox 63+, Chrome 66+
            // Working draft: https://developer.mozilla.org/en-US/docs/Web/API/Clipboard
            navigator.clipboard.writeText(sText)
            .then(
                (res) => { window.setTimeout(() => { this.xClipboardButton.textContent = "📋"; }, 2000); }
            )
            .catch(
                (e) => { console.error(e); this._sendTextToClipboard(sText); }
            );
        } else {
            this._sendTextToClipboardFallback(sText);
        }
    }

    _sendTextToClipboardFallback (sText) {
................................................................................
                xEvent.clipboardData.setData("text/plain", sText);
            }
            document.addEventListener("copy", setClipboardData, true);
            document.execCommand("copy");
            window.setTimeout(() => { this.xClipboardButton.textContent = "📋"; }, 2000);
        }
        catch (e) {
            console.error(e);
        }
    }

    // Lexicographer

    clearLexicographer () {
        this.nLxgCount = 0;
................................................................................
    listenConj () {
        if (!this.bListenConj) {
            // button
            this.xParent.getElementById('grammalecte_conj_button').addEventListener("click", (e) => { this.conjugateVerb(); });
            // text field
            this.xParent.getElementById('grammalecte_conj_verb').addEventListener("change", (e) => { this.conjugateVerb(); });
            // options
            this.xParent.getElementById('grammalecte_conj_oneg').addEventListener("click", (e) => { this.updateConj(); });
            this.xParent.getElementById('grammalecte_conj_opro').addEventListener("click", (e) => { this.updateConj(); });
            this.xParent.getElementById('grammalecte_conj_oint').addEventListener("click", (e) => { this.updateConj(); });
            this.xParent.getElementById('grammalecte_conj_ofem').addEventListener("click", (e) => { this.updateConj(); });
            this.xParent.getElementById('grammalecte_conj_otco').addEventListener("click", (e) => { this.updateConj(); });
            this.bListenConj = true;
        }
    }














































    conjugateVerb (sVerb="") {
        try {
            if (!sVerb) {

                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);
                }
                if (sVerb.startsWith("se ")) {
                    this.xParent.getElementById('grammalecte_conj_opro').checked = true;
                    sVerb = sVerb.slice(3);

                } else if (sVerb.startsWith("s'")) {
                    this.xParent.getElementById('grammalecte_conj_opro').checked = true;
                    sVerb = sVerb.slice(2);
                }
                if (sVerb.endsWith("?")) {
                    this.xParent.getElementById('grammalecte_conj_oint').checked = true;
                    sVerb = sVerb.slice(0,-1).trim();
                }
                if (sVerb) {
                    this.sVerb = sVerb;
                    this.updateConj(true);
                } else {
                    this.xParent.getElementById('grammalecte_conj_verb').value = "";
                }
            }
        }
        catch (e) {
            console.error(e.fileName + "\n" + e.name + "\nline: " + e.lineNumber + "\n" + e.message);
        }
    }

    updateConj (bStart=false) {
        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) {
            oGrammalecteBackgroundPort.getVerb(this.sVerb, bStart, bPro, bNeg, bTpsCo, bInt, bFem);
        }
    }

    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').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_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_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_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";
                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";
                } 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";
                } 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_note').textContent = "❦";
            }
            this.displayConj(oConjTable);
        } else {
            this.xParent.getElementById('grammalecte_conj_verb').style.color = "#BB4411";
        }
................................................................................

    displayConj (oConjTable) {
        // function called when results come from the Worker
        if (oConjTable === null) {
            return;
        }
        try {
            this.xParent.getElementById('grammalecte_conj_verb').Text = "";
            // infinitif
            this.xParent.getElementById('grammalecte_conj_infi').textContent = oConjTable["infi"] || " "; // something or nbsp
            // participe présent
            this.xParent.getElementById('grammalecte_conj_ppre').textContent = oConjTable["ppre"] || " ";
            // participes passés
            this.xParent.getElementById('grammalecte_conj_ppas1').textContent = oConjTable["ppas1"] || " ";
            this.xParent.getElementById('grammalecte_conj_ppas2').textContent = oConjTable["ppas2"] || " ";
................................................................................
            this.xParent.getElementById('grammalecte_conj_simp2').textContent = oConjTable["simp2"] || " ";
            this.xParent.getElementById('grammalecte_conj_simp3').textContent = oConjTable["simp3"] || " ";
            this.xParent.getElementById('grammalecte_conj_simp4').textContent = oConjTable["simp4"] || " ";
            this.xParent.getElementById('grammalecte_conj_simp5').textContent = oConjTable["simp5"] || " ";
            this.xParent.getElementById('grammalecte_conj_simp6').textContent = oConjTable["simp6"] || " ";
        }
        catch (e) {
            console.error(e.fileName + "\n" + e.name + "\nline: " + e.lineNumber + "\n" + e.message);
        }
    }
}


class GrammalecteTooltip {








|







 







|







 







|
|
|
|
|




>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>



>
|

|
|
|
|
|




|
|


|
|
>
|
|
|


|






|




|




|
|
|
|
|









|


|

|
|
<
|
|
<


|
<

|
<
<

|
|
<
|
|
|
<







 







|







 







|







472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
...
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
...
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
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714

715
716

717
718
719

720
721


722
723
724

725
726
727

728
729
730
731
732
733
734
...
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
...
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
            // Firefox 63+, Chrome 66+
            // Working draft: https://developer.mozilla.org/en-US/docs/Web/API/Clipboard
            navigator.clipboard.writeText(sText)
            .then(
                (res) => { window.setTimeout(() => { this.xClipboardButton.textContent = "📋"; }, 2000); }
            )
            .catch(
                (e) => { showError(e); this._sendTextToClipboard(sText); }
            );
        } else {
            this._sendTextToClipboardFallback(sText);
        }
    }

    _sendTextToClipboardFallback (sText) {
................................................................................
                xEvent.clipboardData.setData("text/plain", sText);
            }
            document.addEventListener("copy", setClipboardData, true);
            document.execCommand("copy");
            window.setTimeout(() => { this.xClipboardButton.textContent = "📋"; }, 2000);
        }
        catch (e) {
            showError(e);
        }
    }

    // Lexicographer

    clearLexicographer () {
        this.nLxgCount = 0;
................................................................................
    listenConj () {
        if (!this.bListenConj) {
            // button
            this.xParent.getElementById('grammalecte_conj_button').addEventListener("click", (e) => { this.conjugateVerb(); });
            // text field
            this.xParent.getElementById('grammalecte_conj_verb').addEventListener("change", (e) => { this.conjugateVerb(); });
            // options
            this.xParent.getElementById('grammalecte_conj_oneg').addEventListener("click", (e) => { this.switchOption('grammalecte_conj_oneg'); this.updateConj(); });
            this.xParent.getElementById('grammalecte_conj_opro').addEventListener("click", (e) => { this.switchOption('grammalecte_conj_opro'); this.updateConj(); });
            this.xParent.getElementById('grammalecte_conj_oint').addEventListener("click", (e) => { this.switchOption('grammalecte_conj_oint'); this.updateConj(); });
            this.xParent.getElementById('grammalecte_conj_ofem').addEventListener("click", (e) => { this.switchOption('grammalecte_conj_ofem'); this.updateConj(); });
            this.xParent.getElementById('grammalecte_conj_otco').addEventListener("click", (e) => { this.switchOption('grammalecte_conj_otco'); this.updateConj(); });
            this.bListenConj = true;
        }
    }

    purgeInputText () {
        // Thunderbird don’t accept input fields
        // So we use editable node and we purge it
        let sVerb = this.xParent.getElementById('grammalecte_conj_verb').innerText;
        let nIndexCut = sVerb.indexOf("\n");
        if (nIndexCut != -1) {
            sVerb = sVerb.slice(0, nIndexCut);
        };
        this.xParent.getElementById('grammalecte_conj_verb').textContent = sVerb.trim();
    }

    switchOption (sOption) {
        if (this.xParent.getElementById(sOption).dataset.disabled == "off") {
            this.xParent.getElementById(sOption).dataset.selected = (this.xParent.getElementById(sOption).dataset.selected == "off") ? "on" : "off";
            this.xParent.getElementById(sOption).className = (this.xParent.getElementById(sOption).dataset.selected == "on") ? "grammalecte_conj_option_on" : "grammalecte_conj_option_off";
        }
    }

    resetOption (sOption) {
        this.xParent.getElementById(sOption).dataset.selected = "off";
        this.xParent.getElementById(sOption).dataset.disabled = "off";
        this.xParent.getElementById(sOption).style.color = "";
        this.xParent.getElementById(sOption).className = "grammalecte_conj_option_off";
    }

    selectOption (sOption) {
        this.xParent.getElementById(sOption).dataset.selected = "on";
        this.xParent.getElementById(sOption).className = "grammalecte_conj_option_on";
    }

    unselectOption (sOption) {
        this.xParent.getElementById(sOption).dataset.selected = "off";
        this.xParent.getElementById(sOption).className = "grammalecte_conj_option_off";
    }

    enableOption (sOption) {
        this.xParent.getElementById(sOption).dataset.disabled = "off";
        this.xParent.getElementById(sOption).style.color = "";
    }

    disableOption (sOption) {
        this.xParent.getElementById(sOption).dataset.disabled = "on";
        this.xParent.getElementById(sOption).style.color = "#CCC";
    }

    conjugateVerb (sVerb="") {
        try {
            if (!sVerb) {
                this.purgeInputText();
                sVerb = this.xParent.getElementById('grammalecte_conj_verb').textContent;
            }
            this.resetOption('grammalecte_conj_oneg');
            this.resetOption('grammalecte_conj_opro');
            this.resetOption('grammalecte_conj_oint');
            this.resetOption('grammalecte_conj_otco');
            this.resetOption('grammalecte_conj_ofem');
            // request analyzing
            sVerb = sVerb.trim().toLowerCase().replace(/’/g, "'").replace(/  +/g, " ");
            if (sVerb) {
                if (sVerb.startsWith("ne pas ")) {
                    this.selectOption('grammalecte_conj_oneg');
                    sVerb = sVerb.slice(7).trim();
                }
                if (sVerb.startsWith("se ")) {
                    this.selectOption('grammalecte_conj_opro');
                    sVerb = sVerb.slice(3).trim();
                }
                else if (sVerb.startsWith("s'")) {
                    this.selectOption('grammalecte_conj_opro');
                    sVerb = sVerb.slice(2).trim();
                }
                if (sVerb.endsWith("?")) {
                    this.selectOption('grammalecte_conj_oint');
                    sVerb = sVerb.slice(0,-1).trim();
                }
                if (sVerb) {
                    this.sVerb = sVerb;
                    this.updateConj(true);
                } else {
                    this.xParent.getElementById('grammalecte_conj_verb').textContent = "";
                }
            }
        }
        catch (e) {
            showError(e);
        }
    }

    updateConj (bStart=false) {
        let bPro = this.xParent.getElementById('grammalecte_conj_opro').dataset.selected == "on";
        let bNeg = this.xParent.getElementById('grammalecte_conj_oneg').dataset.selected == "on";
        let bTpsCo = this.xParent.getElementById('grammalecte_conj_otco').dataset.selected == "on";
        let bInt = this.xParent.getElementById('grammalecte_conj_oint').dataset.selected == "on";
        let bFem = this.xParent.getElementById('grammalecte_conj_ofem').dataset.selected == "on";
        if (this.sVerb) {
            oGrammalecteBackgroundPort.getVerb(this.sVerb, bStart, bPro, bNeg, bTpsCo, bInt, bFem);
        }
    }

    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').textContent = "";
            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;
            if (oVerb.bUncomplete) {
                this.unselectOption('grammalecte_conj_opro');
                this.disableOption('grammalecte_conj_opro');

                this.unselectOption('grammalecte_conj_otco');
                this.disableOption('grammalecte_conj_otco');

                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.enableOption('grammalecte_conj_otco');

                if (oVerb.nPronominable == 0) {
                    this.enableOption('grammalecte_conj_opro');


                } else if (oVerb.nPronominable == 1) {
                    this.selectOption('grammalecte_conj_opro');
                    this.disableOption('grammalecte_conj_opro');

                } else { // -1 or error
                    this.unselectOption('grammalecte_conj_opro');
                    this.disableOption('grammalecte_conj_opro');

                }
                this.xParent.getElementById('grammalecte_conj_note').textContent = "❦";
            }
            this.displayConj(oConjTable);
        } else {
            this.xParent.getElementById('grammalecte_conj_verb').style.color = "#BB4411";
        }
................................................................................

    displayConj (oConjTable) {
        // function called when results come from the Worker
        if (oConjTable === null) {
            return;
        }
        try {
            this.xParent.getElementById('grammalecte_conj_verb').textContent = "";
            // infinitif
            this.xParent.getElementById('grammalecte_conj_infi').textContent = oConjTable["infi"] || " "; // something or nbsp
            // participe présent
            this.xParent.getElementById('grammalecte_conj_ppre').textContent = oConjTable["ppre"] || " ";
            // participes passés
            this.xParent.getElementById('grammalecte_conj_ppas1').textContent = oConjTable["ppas1"] || " ";
            this.xParent.getElementById('grammalecte_conj_ppas2').textContent = oConjTable["ppas2"] || " ";
................................................................................
            this.xParent.getElementById('grammalecte_conj_simp2').textContent = oConjTable["simp2"] || " ";
            this.xParent.getElementById('grammalecte_conj_simp3').textContent = oConjTable["simp3"] || " ";
            this.xParent.getElementById('grammalecte_conj_simp4').textContent = oConjTable["simp4"] || " ";
            this.xParent.getElementById('grammalecte_conj_simp5').textContent = oConjTable["simp5"] || " ";
            this.xParent.getElementById('grammalecte_conj_simp6').textContent = oConjTable["simp6"] || " ";
        }
        catch (e) {
            showError(e);
        }
    }
}


class GrammalecteTooltip {

Modified gc_lang/fr/webext/panel/conjugueur.html from [78627e28af] to [9eb29a89d3].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
..
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
..
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
...
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
...
167
168
169
170
171
172
173
174
175
<!DOCTYPE HTML>
<html>
    <head>
        <link rel="stylesheet" type="text/css" href="conjugueur.css" />
        <title>Grammalecte · Conjugueur</title>
        <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
    </head>
    
    <body>
        <header>
            <div class="mainflow">
                <div class="logo" style="margin: -10px 0 0 0;">
                    <img src="../img/logo-96.png" alt="" />
                </div>
            </div>
................................................................................
                    <div id="conjugate">Conjuguer</div>
                </div>

                <h1 id="verb_title" class="center">&nbsp;</h1>
                <p id="info" class="center">&nbsp;</p>

                <p id="options">
                    <label for="oneg">Négative</label> <input type="checkbox" id="oneg" name="oneg" value="ON"  /> 
                    · <label for="oint">Interrogative</label> <input type="checkbox" id="oint" name="oint" value="ON"  />
                    · <label for="ofem">Féminin</label> <input type="checkbox" id="ofem" name="ofem" value="ON"  />
                    · <label id="opro_lbl" for="opro">Pronominal</label> <input type="checkbox" id="opro" name="opro" value="ON"  />
                    · <label id="otco_lbl" for="otco">Temps composés</label> <input type="checkbox" id="otco" name="otco" value="ON"  />
                </p>
                <p id="smallnote">❦</p>
                    
                <div class="clearer"></div>

                <!-- section 1 -->
                <div class="container">
                    <div class="colonne">
                        <div id="infinitif" class="box">
                            <h2 id="infinitif_title">Infinitif</h2>
................................................................................
                            <h2 id="imperatif_title">Impératif</h2>
                            <h3 id="impe_temps">Présent</h3>
                            <p id="impe1">&nbsp;</p>
                            <p id="impe2">&nbsp;</p>
                            <p id="impe3">&nbsp;</p>
                        </div>
                    </div>
                    
                    <div class="colonne">
                        <div id="partpre" class="box">
                            <h2 id="partpre_title">Participe présent</h2>
                            <p id="ppre">&nbsp;</p>
                        </div>
                        <div id="partpas" class="box">
                            <h2 id="partpas_title">Participes passés</h2>
................................................................................
                                <p id="ifut3">&nbsp;</p>
                                <p id="ifut4">&nbsp;</p>
                                <p id="ifut5">&nbsp;</p>
                                <p id="ifut6">&nbsp;</p>
                            </div>
                        </div>
                    </div>
                    
                    <div class="colonne">
                        <div id="subjonctif" class="box">
                            <h2 id="subjontif_title">Subjonctif</h2>
                            <div id="spre">
                                <h3 id="spre_temps">Présent</h3>
                                <p id="spre1">&nbsp;</p>
                                <p id="spre2">&nbsp;</p>
................................................................................

        </div>

        <script src="../grammalecte/graphspell/helpers.js"></script>
        <script src="../grammalecte/fr/conj.js"></script>
        <script src="conjugueur.js"></script>
    </body>
    
</html>







|







 







|
|





|







 







|







 







|







 







|

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
..
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
..
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
...
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
...
167
168
169
170
171
172
173
174
175
<!DOCTYPE HTML>
<html>
    <head>
        <link rel="stylesheet" type="text/css" href="conjugueur.css" />
        <title>Grammalecte · Conjugueur</title>
        <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
    </head>

    <body>
        <header>
            <div class="mainflow">
                <div class="logo" style="margin: -10px 0 0 0;">
                    <img src="../img/logo-96.png" alt="" />
                </div>
            </div>
................................................................................
                    <div id="conjugate">Conjuguer</div>
                </div>

                <h1 id="verb_title" class="center">&nbsp;</h1>
                <p id="info" class="center">&nbsp;</p>

                <p id="options">
                    <label for="oneg">Négation</label> <input type="checkbox" id="oneg" name="oneg" value="ON"  />
                    · <label for="oint">Interrogatif</label> <input type="checkbox" id="oint" name="oint" value="ON"  />
                    · <label for="ofem">Féminin</label> <input type="checkbox" id="ofem" name="ofem" value="ON"  />
                    · <label id="opro_lbl" for="opro">Pronominal</label> <input type="checkbox" id="opro" name="opro" value="ON"  />
                    · <label id="otco_lbl" for="otco">Temps composés</label> <input type="checkbox" id="otco" name="otco" value="ON"  />
                </p>
                <p id="smallnote">❦</p>

                <div class="clearer"></div>

                <!-- section 1 -->
                <div class="container">
                    <div class="colonne">
                        <div id="infinitif" class="box">
                            <h2 id="infinitif_title">Infinitif</h2>
................................................................................
                            <h2 id="imperatif_title">Impératif</h2>
                            <h3 id="impe_temps">Présent</h3>
                            <p id="impe1">&nbsp;</p>
                            <p id="impe2">&nbsp;</p>
                            <p id="impe3">&nbsp;</p>
                        </div>
                    </div>

                    <div class="colonne">
                        <div id="partpre" class="box">
                            <h2 id="partpre_title">Participe présent</h2>
                            <p id="ppre">&nbsp;</p>
                        </div>
                        <div id="partpas" class="box">
                            <h2 id="partpas_title">Participes passés</h2>
................................................................................
                                <p id="ifut3">&nbsp;</p>
                                <p id="ifut4">&nbsp;</p>
                                <p id="ifut5">&nbsp;</p>
                                <p id="ifut6">&nbsp;</p>
                            </div>
                        </div>
                    </div>

                    <div class="colonne">
                        <div id="subjonctif" class="box">
                            <h2 id="subjontif_title">Subjonctif</h2>
                            <div id="spre">
                                <h3 id="spre_temps">Présent</h3>
                                <p id="spre1">&nbsp;</p>
                                <p id="spre2">&nbsp;</p>
................................................................................

        </div>

        <script src="../grammalecte/graphspell/helpers.js"></script>
        <script src="../grammalecte/fr/conj.js"></script>
        <script src="conjugueur.js"></script>
    </body>

</html>

Modified gc_lang/fr/webext/panel/conjugueur.js from [d64a44e001] to [bcf093f6ff].

73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
                    document.getElementById('otco').disabled = true;
                    document.getElementById('otco_lbl').style = "color: #CCC;";
                    document.getElementById('smallnote').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 {
                    document.getElementById('otco').disabled = false;
                    document.getElementById('otco_lbl').style = "color: #000;";
                    if (oVerb.nPronominable == 0) {
                        document.getElementById('opro').checked = false;
                        document.getElementById('opro').disabled = false;
                        document.getElementById('opro_lbl').style = "color: #000;";
                    } else if (oVerb.nPronominable == 1) {
                        document.getElementById('opro').checked = true;
                        document.getElementById('opro').disabled = true;
                        document.getElementById('opro_lbl').style = "color: #CCC;";
                    } else { // -1 or 1 or error







<







73
74
75
76
77
78
79

80
81
82
83
84
85
86
                    document.getElementById('otco').disabled = true;
                    document.getElementById('otco_lbl').style = "color: #CCC;";
                    document.getElementById('smallnote').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 {
                    document.getElementById('otco').disabled = false;
                    document.getElementById('otco_lbl').style = "color: #000;";
                    if (oVerb.nPronominable == 0) {

                        document.getElementById('opro').disabled = false;
                        document.getElementById('opro_lbl').style = "color: #000;";
                    } else if (oVerb.nPronominable == 1) {
                        document.getElementById('opro').checked = true;
                        document.getElementById('opro').disabled = true;
                        document.getElementById('opro_lbl').style = "color: #CCC;";
                    } else { // -1 or 1 or error