Overview
| Comment: | [fx] grammar checking ui |
|---|---|
| Downloads: | Tarball | ZIP archive | SQL archive |
| Timelines: | family | ancestors | descendants | both | fx | webext2 |
| Files: | files | file ages | folders |
| SHA3-256: |
bd4b42b289716d2775194b45a598eb96 |
| User & Date: | olr on 2017-08-16 09:49:05 |
| Other Links: | branch diff | manifest | tags |
Context
|
2017-08-16
| ||
| 12:25 | [fx] grammar checking ui check-in: 11aef9ec2a user: olr tags: fx, webext2 | |
| 09:49 | [fx] grammar checking ui check-in: bd4b42b289 user: olr tags: fx, webext2 | |
| 08:41 | [fx] grammar checking ui check-in: 21a09f0c1a user: olr tags: fx, webext2 | |
Changes
Modified gc_lang/fr/webext/content_scripts/gc_content.js from [09f007d27d] to [6218bb1d3d].
1 2 3 4 5 6 7 8 9 10 11 12 |
// JavaScript
"use strict";
function onGrammalecteGCPanelClick (xEvent) {
try {
let xElem = xEvent.target;
if (xElem.id) {
if (xElem.id.startsWith("sugg")) {
oGCPanelContent.applySuggestion(xElem.id);
} else if (xElem.id.endsWith("_ignore")) {
oGCPanelContent.ignoreError(xElem.id);
| | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
// JavaScript
"use strict";
function onGrammalecteGCPanelClick (xEvent) {
try {
let xElem = xEvent.target;
if (xElem.id) {
if (xElem.id.startsWith("sugg")) {
oGCPanelContent.applySuggestion(xElem.id);
} else if (xElem.id.endsWith("_ignore")) {
oGCPanelContent.ignoreError(xElem.id);
} else if (xElem.id.startsWith("grammalecte_check")) {
oGCPanelContent.recheckParagraph(xElem.id);
} else if (xElem.id.startsWith("grammalecte_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") {
oGrammalecteTooltip.show(xElem.id);
} else if (xElem.id === "gc_url") {
oGCPanelContent.openURL(xElem.getAttribute("href"));
} else {
oGrammalecteTooltip.hide();
|
| ︙ | ︙ | |||
56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
clear: function () {
while (this.xParagraphList.firstChild) {
this.xParagraphList.removeChild(this.xParagraphList.firstChild);
}
this.aIgnoredErrors.clear();
},
addParagraphResult: function (oResult) {
try {
if (oResult) {
let xNodeDiv = createNode("div", {className: "grammalecte_paragraph_block"});
// actions
let xActionsBar = createNode("div", {className: "grammalecte_actions"});
| > > > > > > > < | > | 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 |
clear: function () {
while (this.xParagraphList.firstChild) {
this.xParagraphList.removeChild(this.xParagraphList.firstChild);
}
this.aIgnoredErrors.clear();
},
recheckParagraph: function (sCheckButtonId) { // check
//startWaitIcon();
let sIdParagr = sCheckButtonId.slice(5);
self.port.emit("modifyAndCheck", sIdParagr, getPurgedTextOfParagraph("paragr"+sIdParagr));
//stopWaitIcon();
},
addParagraphResult: function (oResult) {
try {
if (oResult) {
let xNodeDiv = createNode("div", {className: "grammalecte_paragraph_block"});
// actions
let xActionsBar = createNode("div", {className: "grammalecte_actions"});
let xAnalyseButton = createNode("div", {id: "grammalecte_check" + oResult.sParaNum, className: "button green", textContent: "Réanalyser"});
let xCloseButton = createNode("div", {id: "grammalecte_end" + oResult.sParaNum, className: "button red blod", textContent: "×"});
xActionsBar.appendChild(xAnalyseButton);
xActionsBar.appendChild(xCloseButton);
// paragraph
let xParagraph = createNode("p", {id: "paragr"+oResult.sParaNum, lang: "fr", spellcheck: "false", contenteditable: "true"});
xParagraph.className = (oResult.aGrammErr.length || oResult.aSpellErr.length) ? "grammalecte_paragraph softred" : "grammalecte_paragraph";
this._tagParagraph(xParagraph, oResult.sParagraph, oResult.sParaNum, oResult.aGrammErr, oResult.aSpellErr);
// creation
|
| ︙ | ︙ | |||
214 215 216 217 218 219 220 |
console.log(e.lineNumber + ": " +e.message);
}
stopWaitIcon();
}
}
| < < < < < < < < | 221 222 223 224 225 226 227 228 229 230 231 232 233 234 |
console.log(e.lineNumber + ": " +e.message);
}
stopWaitIcon();
}
}
function getPurgedTextOfParagraph (sNodeParagrId) {
let sText = document.getElementById(sNodeParagrId).textContent;
sText = sText.replace(/ /g, " ").replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&");
return sText;
}
|
| ︙ | ︙ |