Grammalecte  Check-in [6ccbd8eea2]

Overview
Comment:[tb] ui: text formatter adjustments (bugs workaround)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | tb | tbme
Files: files | file ages | folders
SHA3-256: 6ccbd8eea228215f85d8d458364ad22203bfab4117c07e497e90f2e2b5e26b0c
User & Date: olr on 2019-09-06 11:49:56
Other Links: branch diff | manifest | tags
Context
2019-09-06
13:25
[tb] don’t use background for now, useless now check-in: 1811000cdc user: olr tags: tb, tbme
11:49
[tb] ui: text formatter adjustments (bugs workaround) check-in: 6ccbd8eea2 user: olr tags: tb, tbme
10:31
[tb] fix variables check-in: 80dc97c22d user: olr tags: tb, tbme
Changes

Modified gc_lang/fr/mailext/content/overlay.css from [1f81711662] to [7766f680c2].

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
48
49
50
51
52







+
+
+
+
+
+







    padding: 5px;
    font-size: 10px;
}
.optiongroup {
    color: hsl(210, 50%, 40%);
    font-size: 14px;
    font-weight: bold;
}
#textformatter-progressbar {
    padding: 5px;
}
#textformatter-timer {
    padding: 5px;
}


#grammarchecker-panel {
    overflow: auto;
    margin-left: 0.5em;
    height: 400px;

Modified gc_lang/fr/mailext/content/overlay.js from [ab8ea58f8a] to [3152c4204d].

557
558
559
560
561
562
563
564
565


566
567
568
569
570
571
572
557
558
559
560
561
562
563


564
565
566
567
568
569
570
571
572







-
-
+
+







            }
        }
        catch (e) {
            console.error(e);
        }
    },
    resetProgressBar: function () {
        document.getElementById('progressbar').value = 0;
        document.getElementById('time_res').textContent = "";
        document.getElementById('textformatter-progressbar').value = 0;
        document.getElementById('textformatter-timer').textContent = "";
    },
    getTimeRes: function (n) {
        // returns duration in seconds as string
        if (n < 10) {
            return n.toFixed(3).toString() + " s";
        }
        if (n < 100) {
597
598
599
600
601
602
603
604
605


606
607
608
609
610
611
612
597
598
599
600
601
602
603


604
605
606
607
608
609
610
611
612







-
-
+
+







        this.reset();
    },
    //
    applyOptions: function (sText) {
        try {
            const t0 = Date.now();
            //window.setCursor("wait"); // change pointer
            document.getElementById('progressbar').value = 0;
            document.getElementById('progressbar').max = 6;
            document.getElementById('textformatter-progressbar').value = 0;
            document.getElementById('textformatter-progressbar').max = 6;
            let n1 = 0, n2 = 0, n3 = 0, n4 = 0, n5 = 0, n6 = 0, n7 = 0;

            // espaces surnuméraires
            if (document.getElementById("o_group_ssp").checked) {
                if (document.getElementById("o_end_of_paragraph").checked) {
                    [sText, n1] = this.formatText(sText, "end_of_paragraph");
                    document.getElementById('res_o_end_of_paragraph').textContent = n1;
634
635
636
637
638
639
640
641

642
643
644
645
646
647
648
634
635
636
637
638
639
640

641
642
643
644
645
646
647
648







-
+







                if (document.getElementById("o_within_quotation_marks").checked) {
                    [sText, n1] = this.formatText(sText, "within_quotation_marks");
                    document.getElementById('res_o_within_quotation_marks').textContent = n1;
                }
                document.getElementById("o_group_ssp").checked = false;
                this.switchGroup("o_group_ssp");
            }
            document.getElementById('progressbar').value = 1;
            document.getElementById('textformatter-progressbar').value = 1;

            // espaces insécables
            if (document.getElementById("o_group_nbsp").checked) {
                if (document.getElementById("o_nbsp_before_punctuation").checked) {
                    [sText, n1] = this.formatText(sText, "nbsp_before_punctuation");
                    [sText, n2] = this.formatText(sText, "nbsp_repair");
                    document.getElementById('res_o_nbsp_before_punctuation').textContent = n1 - n2;
666
667
668
669
670
671
672
673

674
675
676
677
678
679
680
666
667
668
669
670
671
672

673
674
675
676
677
678
679
680







-
+







                if (document.getElementById("o_nbsp_titles").checked) {
                    [sText, n1] = this.formatText(sText, "nbsp_titles");
                    document.getElementById('res_o_nbsp_titles').textContent = n1;
                }
                document.getElementById("o_group_nbsp").checked = false;
                this.switchGroup("o_group_nbsp");
            }
            document.getElementById('progressbar').value = 2;
            document.getElementById('textformatter-progressbar').value = 2;

            // espaces manquants
            if (document.getElementById("o_group_typo").checked) {
                if (document.getElementById("o_ts_units").checked) {
                    [sText, n1] = this.formatText(sText, "ts_units");
                    document.getElementById('res_o_ts_units').textContent = n1;
                }
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
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







-
+










-
+







                if (document.getElementById("o_add_space_around_hyphens").checked) {
                    [sText, n1] = this.formatText(sText, "add_space_around_hyphens");
                    document.getElementById('res_o_add_space_around_hyphens').textContent = n1;
                }
                document.getElementById("o_group_space").checked = false;
                this.switchGroup("o_group_space");
            }
            document.getElementById('progressbar').value = 3;
            document.getElementById('textformatter-progressbar').value = 3;

            // suppression
            if (document.getElementById("o_group_delete").checked) {
                if (document.getElementById("o_erase_non_breaking_hyphens").checked) {
                    [sText, n1] = this.formatText(sText, "erase_non_breaking_hyphens");
                    document.getElementById('res_o_erase_non_breaking_hyphens').textContent = n1;
                }
                document.getElementById("o_group_delete").checked = false;
                this.switchGroup("o_group_delete");
            }
            document.getElementById('progressbar').value = 4;
            document.getElementById('textformatter-progressbar').value = 4;

            // signes typographiques
            if (document.getElementById("o_group_typo").checked) {
                if (document.getElementById("o_ts_apostrophe").checked) {
                    [sText, n1] = this.formatText(sText, "ts_apostrophe");
                    document.getElementById('res_o_ts_apostrophe').textContent = n1;
                }
788
789
790
791
792
793
794
795

796
797
798
799
800
801
802
788
789
790
791
792
793
794

795
796
797
798
799
800
801
802







-
+







                        }
                    }
                    document.getElementById('res_o_ts_ligature').textContent = n1 + n2 + n3 + n4 + n5 + n6 + n7;
                }
                document.getElementById("o_group_typo").checked = false;
                this.switchGroup("o_group_typo");
            }
            document.getElementById('progressbar').value = 5;
            document.getElementById('textformatter-progressbar').value = 5;

            // divers
            if (document.getElementById("o_group_misc").checked) {
                if (document.getElementById("o_ordinals_no_exponant").checked) {
                    if (document.getElementById("o_ordinals_exponant").checked) {
                        [sText, n1] = this.formatText(sText, "ordinals_exponant");
                    } else {
821
822
823
824
825
826
827
828


829
830
831
832
833

834
835
836
837
838
839
840
821
822
823
824
825
826
827

828
829
830
831
832
833

834
835
836
837
838
839
840
841







-
+
+




-
+







                        }
                    }
                    document.getElementById('res_o_ma_word').textContent = n1;
                }
                document.getElementById("o_group_misc").checked = false;
                this.switchGroup("o_group_misc");
            }
            document.getElementById('progressbar').value = document.getElementById('progressbar').max;
            document.getElementById('textformatter-progressbar').value = document.getElementById('textformatter-progressbar').max;
            document.getElementById('textformatter-progressbar').value = "Formatage terminé.";
            // end of processing

            //window.setCursor("auto"); // restore pointer
            const t1 = Date.now();
            document.getElementById('time_res').textContent = this.getTimeRes((t1-t0)/1000);
            document.getElementById('textformatter-timer').textContent = this.getTimeRes((t1-t0)/1000);
        }
        catch (e) {
            console.error(e);
        }
        return sText;
    },
    formatText: function (sText, sOptName) {

Modified gc_lang/fr/mailext/content/overlay.xul from [68358d3870] to [f36fdba70a].

341
342
343
344
345
346
347
348
349
350



351
352
353
354
355
356
357
341
342
343
344
345
346
347



348
349
350
351
352
353
354
355
356
357







-
-
-
+
+
+








          <description id="textformatter-infomsg">&tf_infomsg;</description>
        </vbox>
      </hbox>

      <hbox id="textformatter-commands">
        <button id="reset" label="&tf.button.default;" oncommand="oTextFormatter.onReset(event);" />
        <!-- <html:progress id="progressbar" max="470">-->
        <label id="progressbar" width="470">...</label>
        <label id="time_res" width="50"></label>
        <!-- <html:progress id="textformatter-progressbar" max="470">-->
        <label id="textformatter-progressbar" width="470">...</label>
        <label id="textformatter-timer" width="50"></label>
        <button id="apply" label="&tf.button.apply;" oncommand="oTextFormatter.onApply(event);" />
        <button id="close" label="&tf.button.close;" oncommand="oTextFormatter.onClosePanel(event);" />
      </hbox>

    </vbox>