Overview
| Comment: | [fx][js] gc_panel revamping (part 2) |
|---|---|
| Downloads: | Tarball | ZIP archive | SQL archive |
| Timelines: | family | ancestors | descendants | both | fx | kill_innerHTML |
| Files: | files | file ages | folders |
| SHA3-256: |
96809cd8cd69b244da98e8492c6a5192 |
| User & Date: | olr on 2017-07-13 17:30:18 |
| Other Links: | branch diff | manifest | tags |
Context
|
2017-07-14
| ||
| 06:47 | [fx][js] test_panel: remove innerHTML check-in: acf176c4b5 user: olr tags: fx, kill_innerHTML | |
|
2017-07-13
| ||
| 17:30 | [fx][js] gc_panel revamping (part 2) check-in: 96809cd8cd user: olr tags: fx, kill_innerHTML | |
| 16:44 | [fx][js] gc_panel revamping (part 1) check-in: a83903f529 user: olr tags: fx, kill_innerHTML | |
Changes
Modified gc_lang/fr/xpi/data/gc_panel.js from [6a9e1bc61d] to [1ad4be13a8].
| ︙ | ︙ | |||
41 42 43 44 45 46 47 |
addMessage(sClass, sText);
});
self.port.on("addParagraph", function (sText, iParagraph, sJSON) {
addParagraph(sText, iParagraph, sJSON);
});
| | | < < | 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
addMessage(sClass, sText);
});
self.port.on("addParagraph", function (sText, iParagraph, sJSON) {
addParagraph(sText, iParagraph, sJSON);
});
self.port.on("refreshParagraph", function (sText, sIdParagr, sJSON) {
refreshParagraph(sText, sIdParagr, sJSON);
});
self.port.on("showMessage", function (sText) {
document.getElementById("message").textContent = sText;
document.getElementById("messagebox").style.display = "block";
window.setTimeout(closeMessageBox, 20000);
});
|
| ︙ | ︙ | |||
125 126 127 128 129 130 131 |
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();
| < | < | | | 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 |
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";
|
| ︙ | ︙ | |||
154 155 156 157 158 159 160 161 162 163 164 165 166 167 |
xDivCheck.textContent = "Réanalyser";
xDivActions.appendChild(xDivClose);
xDivActions.appendChild(xDivEdit);
xDivActions.appendChild(xDivCheck);
xNodeDiv.appendChild(xDivActions);
document.getElementById("errorlist").appendChild(xNodeDiv);
}
catch (e) {
showError(e);
}
}
function _tagParagraph (sParagraph, xParagraph, iParagraph, aSpellErr, aGrammErr) {
try {
| > > > > > > > > > > > > > | 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 |
xDivCheck.textContent = "Réanalyser";
xDivActions.appendChild(xDivClose);
xDivActions.appendChild(xDivEdit);
xDivActions.appendChild(xDivCheck);
xNodeDiv.appendChild(xDivActions);
document.getElementById("errorlist").appendChild(xNodeDiv);
}
catch (e) {
showError(e);
}
}
function refreshParagraph (sText, sIdParagr, sJSON) {
try {
let xParagraph = document.getElementById("paragr"+sIdParagr);
let oErrors = JSON.parse(sJSON);
xParagraph.className = (oErrors.aGrammErr.length || oErrors.aSpellErr.length) ? "paragraph softred" : "paragraph softgreen";
xParagraph.textContent = "";
_tagParagraph(sText, xParagraph, sIdParagr, oErrors.aGrammErr, oErrors.aSpellErr);
}
catch (e) {
showError(e);
}
}
function _tagParagraph (sParagraph, xParagraph, iParagraph, aSpellErr, aGrammErr) {
try {
|
| ︙ | ︙ | |||
215 216 217 218 219 220 221 |
return xNodeErr;
}
function _getGrammarTooltip (oErr) {
let xSpan = document.createElement("span");
xSpan.id = "tooltip" + oErr['sId'];
xSpan.className = "tooltip";
| | | 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 |
return xNodeErr;
}
function _getGrammarTooltip (oErr) {
let xSpan = document.createElement("span");
xSpan.id = "tooltip" + oErr['sId'];
xSpan.className = "tooltip";
xSpan.setAttribute("contenteditable", false);
xSpan.appendChild(document.createTextNode(oErr["sMessage"]+" "));
xSpan.appendChild(_createIgnoreButton(oErr["sId"]));
if (oErr["URL"] !== "") {
xSpan.appendChild(_createInfoLink(oErr["URL"]));
}
if (oErr["aSuggestions"].length > 0) {
xSpan.appendChild(document.createElement("br"));
|
| ︙ | ︙ |
Modified gc_lang/fr/xpi/gce_worker.js from [b9ee777056] to [ca6bb30dca].
| ︙ | ︙ | |||
86 87 88 89 90 91 92 |
function parseAndSpellcheck (sText, sLang, bDebug, bContext) {
let aGrammErr = gce.parse(sText, sLang, bDebug, bContext);
let aSpellErr = oTokenizer.getSpellingErrors(sText, oDict);
return JSON.stringify({ aGrammErr: aGrammErr, aSpellErr: aSpellErr });
}
| < < < < < < < < < < < < | 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
function parseAndSpellcheck (sText, sLang, bDebug, bContext) {
let aGrammErr = gce.parse(sText, sLang, bDebug, bContext);
let aSpellErr = oTokenizer.getSpellingErrors(sText, oDict);
return JSON.stringify({ aGrammErr: aGrammErr, aSpellErr: aSpellErr });
}
function getOptions () {
return gce.getOptions()._toString();
}
function getDefaultOptions () {
return gce.getDefaultOptions()._toString();
}
|
| ︙ | ︙ |
Modified gc_lang/fr/xpi/ui.js from [f61d089690] to [14a4e0411e].
| ︙ | ︙ | |||
345 346 347 348 349 350 351 |
if (sText.includes("<!-- err_end -->") || sText.includes('<span id="tooltip') || sText.includes('<u id="err')) {
return false;
}
return true;
}
function checkAndSendToPanel (sIdParagraph, sText) {
| | > | | 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 |
if (sText.includes("<!-- err_end -->") || sText.includes('<span id="tooltip') || sText.includes('<u id="err')) {
return false;
}
return true;
}
function checkAndSendToPanel (sIdParagraph, sText) {
let xPromise = xGCEWorker.post('parseAndSpellcheck', [sText, "FR", false, false]);
xPromise.then(
function (aVal) {
sText = text.addHtmlEntities(sText);
xGCPanel.port.emit("refreshParagraph", sText, sIdParagraph, aVal);
},
function (aReason) {
console.error('Promise rejected - ', aReason);
}
).catch(
function (aCaught) {
console.error('Promise Error - ', aCaught);
|
| ︙ | ︙ |