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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
-
+
+
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
+
+
+
+
+
+
|
// JavaScript
// Text formatter
"use strict";
function createTextFormatter (xTextArea) {
let xTFNode = document.createElement("div");
try {
// Options
let xOptions = createNode("div", {id: "tf_options"});
let xOptions = createNode("div", {id: "grammalecte_tf_options"});
let xColumn1 = createNode("div", {className: "grammalecte_tf_column"});
let xSSP = createFieldset("group_ssp", true, "Espaces surnuméraires");
xSSP.appendChild(createOptionInputAndLabel("o_start_of_paragraph", true, "En début de paragraphe"));
xSSP.appendChild(createOptionInputAndLabel("o_end_of_paragraph", true, "En fin de paragraphe"));
xSSP.appendChild(createOptionInputAndLabel("o_between_words", true, "Entre les mots"));
xSSP.appendChild(createOptionInputAndLabel("o_before_punctuation", true, "Avant les points (.), les virgules (,)"));
xSSP.appendChild(createOptionInputAndLabel("o_within_parenthesis", true, "À l’intérieur des parenthèses"));
xSSP.appendChild(createOptionInputAndLabel("o_within_square_brackets", true, "À l’intérieur des crochets"));
xSSP.appendChild(createOptionInputAndLabel("o_within_quotation_marks", true, "À l’intérieur des guillemets “ et ”"));
let xSpace = createFieldset("group_space", true, "Espaces manquants");
xSpace.appendChild(createOptionInputAndLabel("o_add_space_after_punctuation", true, "Après , ; : ? ! . …"));
xSpace.appendChild(createOptionInputAndLabel("o_add_space_around_hyphens", true, "Autour des tirets d’incise"));
let xNBSP = createFieldset("group_nbsp", true, "Espaces insécables");
xNBSP.appendChild(createOptionInputAndLabel("o_nbsp_before_punctuation", true, "Avant : ; ? et !"));
xNBSP.appendChild(createOptionInputAndLabel("o_nbsp_within_quotation_marks", true, "Avec les guillemets « et »"));
xNBSP.appendChild(createOptionInputAndLabel("o_nbsp_before_symbol", true, "Avant % ‰ € $ £ ¥ ˚C"));
xNBSP.appendChild(createOptionInputAndLabel("o_nbsp_within_numbers", true, "À l’intérieur des nombres"));
xNBSP.appendChild(createOptionInputAndLabel("o_nbsp_before_units", true, "Avant les unités de mesure"));
let xDelete = createFieldset("group_delete", true, "Suppressions");
xDelete.appendChild(createOptionInputAndLabel("o_erase_non_breaking_hyphens", true, "Tirets conditionnels"));
let xColumn2 = createNode("div", {className: "grammalecte_tf_column"});
let xTypo = createFieldset("group_typo", true, "Signes typographiques");
xTypo.appendChild(createOptionInputAndLabel("o_ts_apostrophe", true, "Apostrophe (’)"));
xTypo.appendChild(createOptionInputAndLabel("o_ts_ellipsis", true, "Points de suspension (…)"));
xTypo.appendChild(createOptionInputAndLabel("o_ts_dash_middle", true, "Tirets d’incise :"));
xTypo.appendChild(createOptionInputAndLabel("o_ts_dash_start", true, "Tirets en début de paragraphe :"));
xTypo.appendChild(createOptionInputAndLabel("o_ts_quotation_marks", true, "Modifier les guillemets droits (\" et ')"));
xTypo.appendChild(createOptionInputAndLabel("o_ts_units", true, "Points médians des unités (N·m, Ω·m…)"));
xTypo.appendChild(createOptionInputAndLabel("o_ts_spell", true, "Ligatures (cœur…) et diacritiques (ça, État…)"));
xTypo.appendChild(createOptionInputAndLabel("o_ts_ligature", true, "Ligatures"));
let xMisc = createFieldset("group_misc", true, "Divers");
xMisc.appendChild(createOptionInputAndLabel("o_ordinals_no_exponant", true, "Ordinaux (15e, XXIe…)"));
xMisc.appendChild(createOptionInputAndLabel("o_etc", true, "Et cætera, etc."));
xMisc.appendChild(createOptionInputAndLabel("o_missing_hyphens", true, "Traits d’union manquants"));
xMisc.appendChild(createOptionInputAndLabel("o_ma_word", true, "Apostrophes manquantes"));
let xStruct = createFieldset("group_struct", false, "Restructuration [!]");
xStruct.appendChild(createOptionInputAndLabel("o_remove_hyphens_at_end_of_paragraphs", false, "Enlever césures en fin de ligne/paragraphe [!]"));
xStruct.appendChild(createOptionInputAndLabel("o_merge_contiguous_paragraphs", false, "Fusionner les paragraphes contigus [!]"));
xOptions.appendChild(xSSP);
xOptions.appendChild(xSpace);
xOptions.appendChild(xNBSP);
xOptions.appendChild(xDelete);
xOptions.appendChild(xTypo);
xOptions.appendChild(xMisc);
xOptions.appendChild(xStruct);
xColumn1.appendChild(xSSP);
xColumn1.appendChild(xSpace);
xColumn1.appendChild(xNBSP);
xColumn1.appendChild(xDelete);
xColumn2.appendChild(xTypo);
xColumn2.appendChild(xMisc);
xColumn2.appendChild(xStruct);
xOptions.appendChild(xColumn1);
xOptions.appendChild(xColumn2);
// Actions
let xActions = createNode("div", {id: "tf_actions"});
xActions.appendChild(createNode("div", {id: "tf_reset", textContent: "Par défaut", className: "button blue"}));
xActions.appendChild(createNode("progress", {id: "progressbar", style: "width: 25px"}));
xActions.appendChild(createNode("span", {id: "time_res"}));
xActions.appendChild(createNode("div", {id: "tf_apply", textContent: "Appliquer", className: "button green"}));
xActions.appendChild(createNode("div", {id: "infomsg", textContent: "blabla"}));
let xActions = createNode("div", {id: "grammalecte_tf_actions"});
xActions.appendChild(createNode("div", {id: "grammalecte_tf_reset", textContent: "Par défaut", className: "grammalecte_button", style: "background-color: hsl(210, 50%, 50%)"}));
xActions.appendChild(createNode("progress", {id: "grammalecte_progressbar", style: "width: 25px"}));
xActions.appendChild(createNode("span", {id: "grammalecte_time_res"}));
xActions.appendChild(createNode("div", {id: "grammalecte_tf_apply", textContent: "Appliquer", className: "grammalecte_button", style: "background-color: hsl(180, 50%, 50%)"}));
//xActions.appendChild(createNode("div", {id: "grammalecte_infomsg", textContent: "blabla"}));
// create result
xTFNode.appendChild(xOptions);
xTFNode.appendChild(xActions);
}
catch (e) {
//console.error(e);
showError(e);
|