|
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 = "";
},
getTimeRes: function (n) {
// returns duration in seconds as string
if (n < 10) {
return n.toFixed(3).toString() + " s";
}
if (n < 100) {
|
|
|
| 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('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
| 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;
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;
|
|
|
| 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('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
| 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;
// 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;
|
|
| 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('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
| 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;
// 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;
}
|
|
| 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('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
| 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;
// 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;
// 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;
}
|
|
|
| 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('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('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
| }
}
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;
// 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 {
|
|
| 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('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
| }
}
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;
// end of processing
//window.setCursor("auto"); // restore pointer
const t1 = Date.now();
document.getElementById('time_res').textContent = this.getTimeRes((t1-t0)/1000);
}
catch (e) {
console.error(e);
}
return sText;
},
formatText: function (sText, sOptName) {
|
|
>
|
| 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('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('textformatter-timer').textContent = this.getTimeRes((t1-t0)/1000);
}
catch (e) {
console.error(e);
}
return sText;
},
formatText: function (sText, sOptName) {
|
|