82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
-
-
+
+
|
if (xElem.id) {
if (xElem.id.startsWith("sugg")) {
applySuggestion(xElem.id);
} else if (xElem.id.endsWith("_ignore")) {
ignoreError(xElem.id);
} else if (xElem.id.startsWith("check")) {
sendBackAndCheck(xElem.id);
} else if (xElem.id.startsWith("edit")) {
switchEdition(xElem.id);
/*} else if (xElem.id.startsWith("edit")) {
switchEdition(xElem.id);*/
} else if (xElem.id.startsWith("end")) {
document.getElementById(xElem.id).parentNode.parentNode.style.display = "none";
} else if (xElem.tagName === "U" && xElem.id.startsWith("err")
&& xElem.className !== "corrected" && xElem.className !== "ignored") {
showTooltip(xElem.id);
} else if (xElem.id.startsWith("resize")) {
self.port.emit("resize", xElem.id, 10);
|
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
|
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
|
-
-
-
-
-
-
-
-
-
-
+
-
+
-
+
+
+
+
+
+
+
+
+
+
+
|
document.getElementById("errorlist").appendChild(xNode);
}
function addParagraph (sText, iParagraph, sJSON) {
try {
let xNodeDiv = document.createElement("div");
xNodeDiv.className = "paragraph_block";
// paragraph
let xParagraph = document.createElement("p");
xParagraph.id = "paragr" + iParagraph.toString();
xParagraph.lang = "fr";
xParagraph.setAttribute("spellcheck", false);
let oErrors = JSON.parse(sJSON);
xParagraph.className = (oErrors.aGrammErr.length || oErrors.aSpellErr.length) ? "paragraph softred" : "paragraph";
_tagParagraph(sText, xParagraph, iParagraph, oErrors.aGrammErr, oErrors.aSpellErr);
xNodeDiv.appendChild(xParagraph);
// actions
let xDivActions = document.createElement("div");
xDivActions.className = "actions";
let xDivClose = document.createElement("div");
xDivClose.id = "end" + iParagraph.toString();
xDivClose.className = "button red";
xDivClose.textContent = "×";
let xDivEdit = document.createElement("div");
/*let xDivEdit = document.createElement("div");
xDivEdit.id = "edit" + iParagraph.toString();
xDivEdit.className = "button";
xDivEdit.textContent = "Éditer";
xDivEdit.textContent = "Éditer";*/
let xDivCheck = document.createElement("div");
xDivCheck.id = "check" + iParagraph.toString();
xDivCheck.className = "button green";
xDivCheck.textContent = "Réanalyser";
xDivActions.appendChild(xDivClose);
xDivActions.appendChild(xDivEdit);
//xDivActions.appendChild(xDivEdit);
xDivActions.appendChild(xDivCheck);
xNodeDiv.appendChild(xDivActions);
// paragraph
let xParagraph = document.createElement("p");
xParagraph.id = "paragr" + iParagraph.toString();
xParagraph.lang = "fr";
xParagraph.setAttribute("spellcheck", false);
xParagraph.setAttribute("contenteditable", true);
let oErrors = JSON.parse(sJSON);
xParagraph.className = (oErrors.aGrammErr.length || oErrors.aSpellErr.length) ? "paragraph softred" : "paragraph";
_tagParagraph(sText, xParagraph, iParagraph, oErrors.aGrammErr, oErrors.aSpellErr);
xNodeDiv.appendChild(xParagraph);
document.getElementById("errorlist").appendChild(xNodeDiv);
}
catch (e) {
showError(e);
}
}
|
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
|
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
|
-
+
-
+
|
xNodeSugg.setAttribute("href", "#");
xNodeSugg.setAttribute("onclick", "return false;");
xNodeSugg.dataset.error_id = sErrId;
xNodeSugg.textContent = sSugg;
return xNodeSugg;
}
function switchEdition (sEditButtonId) { // edit
/*function switchEdition (sEditButtonId) { // edit
let xParagraph = document.getElementById("paragr" + sEditButtonId.slice(4));
if (xParagraph.hasAttribute("contenteditable") === false
|| xParagraph.getAttribute("contenteditable") === "false") {
xParagraph.setAttribute("contenteditable", true);
document.getElementById(sEditButtonId).className = "button orange";
xParagraph.focus();
} else {
xParagraph.setAttribute("contenteditable", false);
document.getElementById(sEditButtonId).className = "button";
}
}
}*/
function sendBackAndCheck (sCheckButtonId) { // check
startWaitIcon();
let sIdParagr = sCheckButtonId.slice(5);
self.port.emit("modifyAndCheck", sIdParagr, document.getElementById("paragr"+sIdParagr).textContent);
stopWaitIcon();
}
|