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
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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
|
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
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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
|
-
+
-
+
-
+
-
-
+
+
-
+
-
+
-
+
-
+
-
+
-
-
+
+
-
-
+
+
|
xColumn2.appendChild(xTypo);
xColumn2.appendChild(xMisc);
xColumn2.appendChild(xStruct);
xOptions.appendChild(xColumn1);
xOptions.appendChild(xColumn2);
// Actions
let xActions = createNode("div", {id: "grammalecte_tf_actions"});
let xDefaultButton = createNode("div", {id: "grammalecte_tf_reset", textContent: "Par défaut", className: "grammalecte_button"});
let xDefaultButton = createNode("div", {id: "grammalecte_tf_reset", textContent: "Par défaut", className: "grammalecte_tf_button"});
xDefaultButton.addEventListener("click", () => { this.reset(); });
let xApplyButton = createNode("div", {id: "grammalecte_tf_apply", textContent: "Appliquer", className: "grammalecte_button"});
let xApplyButton = createNode("div", {id: "grammalecte_tf_apply", textContent: "Appliquer", className: "grammalecte_tf_button"});
xApplyButton.addEventListener("click", () => { this.saveOptions(); this.apply(); });
xActions.appendChild(xDefaultButton);
xActions.appendChild(createNode("progress", {id: "grammalecte_tf_progressbar"}));
xActions.appendChild(createNode("span", {id: "grammalecte_tf_time_res", textContent: "…"}));
xActions.appendChild(xApplyButton);
//xActions.appendChild(createNode("div", {id: "grammalecte_infomsg", textContent: "blabla"}));
// create result
xTFNode.appendChild(xOptions);
xTFNode.appendChild(xActions);
}
catch (e) {
showError(e);
}
return xTFNode;
}
// Common options
_createFieldset (sId, bDefault, sLabel) {
let xFieldset = createNode("fieldset", {id: sId, className: "groupblock"});
let xLegend = document.createElement("legend");
let xGroupOption = createNode("input", {type: "checkbox", id: "o_"+sId, className: "option"}, {default: bDefault});
let xGroupOption = createNode("input", {type: "checkbox", id: "o_"+sId, className: "grammalecte_tf_option"}, {default: bDefault});
xGroupOption.addEventListener("click", (xEvent) => { this.switchGroup(xEvent.target.id); });
xLegend.appendChild(xGroupOption);
xLegend.appendChild(createNode("label", {htmlFor: "o_"+sId, textContent: sLabel}));
xFieldset.appendChild(xLegend);
return xFieldset;
}
_createSimpleOption (sId, bDefault, sLabel) {
let xLine = createNode("div", {className: "blockopt underline"});
xLine.appendChild(createNode("input", {type: "checkbox", id: sId, className: "option"}, {default: bDefault}));
let xLine = createNode("div", {className: "grammalecte_tf_blockopt grammalecte_tf_underline"});
xLine.appendChild(createNode("input", {type: "checkbox", id: sId, className: "grammalecte_tf_option"}, {default: bDefault}));
xLine.appendChild(createNode("label", {htmlFor: sId, textContent: sLabel, className: "opt_lbl largew"}));
xLine.appendChild(createNode("div", {id: "res_"+sId, className: "grammalecte_tf_result", textContent: "·"}));
return xLine;
}
// Hyphens
_createRadioBoxHyphens (sName, sIdEmDash, sIdEnDash, bDefaultEmDash) {
let xLine = createNode("div", {className: "blockopt indent"});
let xLine = createNode("div", {className: "grammalecte_tf_blockopt grammalecte_tf_indent"});
xLine.appendChild(this._createInlineRadioOption(sName, sIdEmDash, "cadratin (—)", bDefaultEmDash));
xLine.appendChild(this._createInlineRadioOption(sName, sIdEnDash, "demi-cadratin (—)", !bDefaultEmDash));
return xLine;
}
// Ligatures
_createRadioBoxLigatures () {
let xLine = createNode("div", {className: "blockopt underline"});
let xLine = createNode("div", {className: "grammalecte_tf_blockopt grammalecte_tf_underline"});
xLine.appendChild(createNode("div", {id: "res_"+"o_ts_ligature", className: "grammalecte_tf_result", textContent: "·"}));
xLine.appendChild(this._createInlineCheckboxOption("o_ts_ligature", "Ligatures", true));
xLine.appendChild(this._createInlineRadioOption("liga", "o_ts_ligature_do", "faire", false));
xLine.appendChild(this._createInlineRadioOption("liga", "o_ts_ligature_undo", "défaire", true));
return xLine;
}
_createLigaturesSelection () {
let xLine = createNode("div", {className: "blockopt indent"});
let xLine = createNode("div", {className: "grammalecte_tf_blockopt grammalecte_tf_indent"});
xLine.appendChild(this._createInlineCheckboxOption("o_ts_ligature_ff", "ff", true));
xLine.appendChild(this._createInlineCheckboxOption("o_ts_ligature_fi", "fi", true));
xLine.appendChild(this._createInlineCheckboxOption("o_ts_ligature_ffi", "ffi", true));
xLine.appendChild(this._createInlineCheckboxOption("o_ts_ligature_fl", "fl", true));
xLine.appendChild(this._createInlineCheckboxOption("o_ts_ligature_ffl", "ffl", true));
xLine.appendChild(this._createInlineCheckboxOption("o_ts_ligature_ft", "ft", true));
xLine.appendChild(this._createInlineCheckboxOption("o_ts_ligature_st", "st", false));
return xLine;
}
// Apostrophes
_createSingleLetterOptions () {
let xLine = createNode("div", {className: "blockopt indent"});
let xLine = createNode("div", {className: "grammalecte_tf_blockopt grammalecte_tf_indent"});
xLine.appendChild(this._createInlineCheckboxOption("o_ma_1letter_lowercase", "lettres isolées (j’ n’ m’ t’ s’ c’ d’ l’)", false));
xLine.appendChild(this._createInlineCheckboxOption("o_ma_1letter_uppercase", "Maj.", false));
return xLine;
}
// Ordinals
_createOrdinalOptions () {
let xLine = createNode("div", {className: "blockopt underline"});
let xLine = createNode("div", {className: "grammalecte_tf_blockopt grammalecte_tf_underline"});
xLine.appendChild(createNode("div", {id: "res_"+"o_ordinals_no_exponant", className: "grammalecte_tf_result", textContent: "·"}));
xLine.appendChild(this._createInlineCheckboxOption("o_ordinals_no_exponant", "Ordinaux (15e, XXIe…)", true));
xLine.appendChild(this._createInlineCheckboxOption("o_ordinals_exponant", "e → ᵉ", true));
return xLine;
}
// Inline option block
_createInlineCheckboxOption (sId, sLabel, bDefault) {
let xInlineBlock = createNode("div", {className: "inlineblock"});
xInlineBlock.appendChild(createNode("input", {type: "checkbox", id: sId, className: "option"}, {default: bDefault}));
let xInlineBlock = createNode("div", {className: "grammalecte_tf_inlineblock"});
xInlineBlock.appendChild(createNode("input", {type: "checkbox", id: sId, className: "grammalecte_tf_option"}, {default: bDefault}));
xInlineBlock.appendChild(createNode("label", {htmlFor: sId, textContent: sLabel, className: "opt_lbl"}));
return xInlineBlock;
}
_createInlineRadioOption (sName, sId, sLabel, bDefault) {
let xInlineBlock = createNode("div", {className: "inlineblock"});
xInlineBlock.appendChild(createNode("input", {type: "radio", id: sId, name: sName, className:"option"}, {default: bDefault}));
let xInlineBlock = createNode("div", {className: "grammalecte_tf_inlineblock"});
xInlineBlock.appendChild(createNode("input", {type: "radio", id: sId, name: sName, className:"grammalecte_tf_option"}, {default: bDefault}));
xInlineBlock.appendChild(createNode("label", {htmlFor: sId, className: "opt_lbl", textContent: sLabel}));
return xInlineBlock;
}
/*
Actions
|