Grammalecte  Diff

Differences From Artifact [ad8781cf55]:

To Artifact [44d0e018ce]:


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// JavaScript
// Text formatter

"use strict";

function createTextFormatter (xTextArea) {
    let xTFNode = document.createElement("div");
    try {
        // Options
        let xOptions = createDiv("tf_options", "");
        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"));









|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// JavaScript
// Text formatter

"use strict";

function createTextFormatter (xTextArea) {
    let xTFNode = document.createElement("div");
    try {
        // Options
        let xOptions = createNode("div", {id: "tf_options"});
        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"));
48
49
50
51
52
53
54
55
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
        xOptions.appendChild(xSpace);
        xOptions.appendChild(xNBSP);
        xOptions.appendChild(xDelete);
        xOptions.appendChild(xTypo);
        xOptions.appendChild(xMisc);
        xOptions.appendChild(xStruct);
        // Actions
        let xActions = createDiv("tf_actions", "");
        let xPgBarBox = createDiv("tf_progressbarbox", "");
        xPgBarBox.innerHTML = '<progress id="progressbar" style="width: 400px;"></progress> <span id="time_res"></span>';
        xActions.appendChild(createDiv("tf_reset", "Par défaut", "button blue"));
        xActions.appendChild(xPgBarBox);
        xActions.appendChild(createDiv("tf_apply", "Appliquer", "button green"));
        xActions.appendChild(createDiv("infomsg", "blabla"));
        // create result
        xTFNode.appendChild(xOptions);
        xTFNode.appendChild(xActions);
    }
    catch (e) {
        //console.error(e);
        showError(e);
    }
    return xTFNode;
}

function createFieldset (sId, bDefault, sLabel) {
    let xFieldset = document.createElement("fieldset");
    xFieldset.id = sId;
    xFieldset.className = "groupblock";
    let xLegend = document.createElement("legend");
    let xInput = createCheckbox("o_"+sId, bDefault, "option");
    let xLabel = createLabel(xInput.id, sLabel);
    // create result
    xLegend.appendChild(xInput);
    xLegend.appendChild(xLabel);
    xFieldset.appendChild(xLegend);
    return xFieldset;
}

function createOptionInputAndLabel (sId, bDefault, sLabel) {
    let xOption = document.createElement("div");
    xOption.className = "blockopt underline";
    let xInput = createCheckbox(sId, bDefault, "option");
    let xLabel = createLabel(sId, sLabel, "opt_lbl largew");
    let xResult = createDiv("res_"+sId, "", "result fright");
    // create result
    xOption.appendChild(xResult);
    xOption.appendChild(xInput);
    xOption.appendChild(xLabel);
    return xOption;
}








|
|
<
|
|
|
|












|
<
<











<
|


|







48
49
50
51
52
53
54
55
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
83
84

85
86
87
88
89
90
91
92
93
94
95
        xOptions.appendChild(xSpace);
        xOptions.appendChild(xNBSP);
        xOptions.appendChild(xDelete);
        xOptions.appendChild(xTypo);
        xOptions.appendChild(xMisc);
        xOptions.appendChild(xStruct);
        // 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"}));
        // create result
        xTFNode.appendChild(xOptions);
        xTFNode.appendChild(xActions);
    }
    catch (e) {
        //console.error(e);
        showError(e);
    }
    return xTFNode;
}

function createFieldset (sId, bDefault, sLabel) {
    let xFieldset = createNode("fieldset", {id: sId, className: "groupblock"});


    let xLegend = document.createElement("legend");
    let xInput = createCheckbox("o_"+sId, bDefault, "option");
    let xLabel = createLabel(xInput.id, sLabel);
    // create result
    xLegend.appendChild(xInput);
    xLegend.appendChild(xLabel);
    xFieldset.appendChild(xLegend);
    return xFieldset;
}

function createOptionInputAndLabel (sId, bDefault, sLabel) {

    let xOption = createNode("div", {className: "blockopt underline"});
    let xInput = createCheckbox(sId, bDefault, "option");
    let xLabel = createLabel(sId, sLabel, "opt_lbl largew");
    let xResult = createNode("div", {id: "res_"+sId, className: "result fright"});
    // create result
    xOption.appendChild(xResult);
    xOption.appendChild(xInput);
    xOption.appendChild(xLabel);
    return xOption;
}