Index: compile_rules.py ================================================================== --- compile_rules.py +++ compile_rules.py @@ -449,11 +449,11 @@ del lRule[-1] # tGroups positioning codes are useless for Python # error messages for aAction in lRuleJS[6]: if aAction[1] == "-": aAction[2] = aAction[2].replace(" ", " ") # nbsp --> nnbsp - aAction[4] = aAction[4].replace("« ", "« ").replace(" »", " »") + aAction[4] = aAction[4].replace("« ", "« ").replace(" »", " »").replace(" :", " :").replace(" :", " :") # js regexes lRuleJS[1], lNegLookBehindRegex = regex2js( dJSREGEXES.get(lRuleJS[3], lRuleJS[1]) ) lRuleJS.append(lNegLookBehindRegex) return lRuleJS Index: gc_lang/fr/xpi/data/gc_panel.css ================================================================== --- gc_lang/fr/xpi/data/gc_panel.css +++ gc_lang/fr/xpi/data/gc_panel.css @@ -8,12 +8,10 @@ border-bottom: 1px solid hsl(0, 0%, 90%); color: hsl(0, 0%, 0%); z-index: 99; } - - body { background-color: hsl(0, 0%, 98%); font-family: Tahoma, "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", sans-serif; overflow-x: hidden; color: hsl(0, 0%, 0%); @@ -69,10 +67,11 @@ font-size: 18px; color: hsla(240, 0%, 96%, 1); border-radius: 3px; text-align: center; } + #errorlist p.green { background-color: hsla(120, 10%, 50%, 1); color: hsla(120, 0%, 96%, 1); } @@ -107,38 +106,10 @@ background-color: hsla(210, 60%, 40%, 1); color: hsla(0, 0%, 100%, 1); text-shadow: 0 0 3px hsl(210, 30%, 60%); } -.paragraph a.sugg { - padding: 1px 6px; - background-color: hsla(150, 50%, 40%, 1); - color: hsla(150, 0%, 96%, 1); - border-radius: 2px; - cursor: pointer; - text-decoration: none; -} -.paragraph a.sugg:hover { - background-color: hsla(150, 70%, 30%, 1); - color: hsla(0, 0%, 100%, 1); - text-shadow: 0 0 3px hsl(150, 30%, 60%); -} - -.paragraph a.ignore { - padding: 0 2px; - background-color: hsla(30, 20%, 60%, 1); - color: hsla(30, 0%, 96%, 1); - border-radius: 2px; - cursor: pointer; - text-decoration: none; -} -.paragraph a.ignore:hover { - background-color: hsla(30, 20%, 50%, 1); - color: hsla(0, 0%, 100%, 1); - text-shadow: 0 0 3px hsl(30, 30%, 60%); -} - .paragraph u.corrected, .paragraph u.ignored { background-color: hsla(120, 50%, 70%, 1); color: hsla(0, 0%, 4%, 1); border-radius: 2px; @@ -156,58 +127,139 @@ } .paragraph u.error:hover { cursor: pointer; } -.paragraph u.error .tooltip, .paragraph u.error .tooltip_on { - position: absolute; - background-color: hsla(210, 10%, 90%, 1); - font-family: Tahoma, "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", sans-serif; - top: 90%; - left: 0; - width: 250px; - font-size: 12px; - line-height: 18px; - color: hsla(0, 10%, 20%, 1); - cursor: default; - /*visibility: hidden;*/ - display: none; - padding: 10px; - box-shadow: 0 0 6px hsla(0, 0%, 0%, 0.3); - z-index: 10; - border: 2px solid hsl(0, 0%, 0%); - border-radius: 3px; - text-decoration: none; -} -.paragraph u.error .tooltip_on { - display: block; -} - -.tooltip_on s { - color: hsla(0, 0%, 66%, 1); - font-weight: bold; - font-size: 8px; - line-height: 16px; - text-transform: uppercase; - text-decoration: none; -} - -.debug { - float: right; + +/* + TOOLTIPS +*/ +.tooltip { + position: absolute; + display: none; + width: 300px; + border-radius: 5px; + box-shadow: 0 0 6px hsla(0, 0%, 0%, 0.3); + font-family: Tahoma, "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", sans-serif; + font-size: 12px; + line-height: 18px; + cursor: default; + z-index: 10; + text-decoration: none; +} +#gc_tooltip { + border: 3px solid hsl(210, 50%, 30%); + color: hsla(210, 10%, 20%, 1); +} +#sc_tooltip { + border: 3px solid hsl(0, 50%, 30%); + color: hsla(0, 10%, 20%, 1); +} +#gc_tooltip #gc_rule_id { + display: none; background-color: hsla(0, 5%, 35%, 1); padding: 2px 5px; margin-left: 5px; border-radius: 2px; color: hsla(0, 0%, 96%, 1); font-size: 11px; font-style: normal; } - -.data { - font-style: normal; +#gc_message_block { + padding: 5px 10px 10px 10px; + background-color: hsl(210, 50%, 30%); + color: hsl(210, 50%, 96%); +} +#sc_message_block { + padding: 5px 10px 10px 10px; + background-color: hsl(0, 50%, 30%); + color: hsl(0, 50%, 96%); +} +#gc_message, #sc_message { + font-size: 15px; + margin-bottom: 5px; +} +a#gc_ignore, a#sc_ignore { + padding: 0 2px; + background-color: hsla(30, 30%, 40%, 1); + color: hsla(30, 0%, 96%, 1); + border-radius: 2px; + cursor: pointer; + text-decoration: none; +} +a#gc_ignore:hover, a#sc_ignore:hover { + background-color: hsla(30, 30%, 50%, 1); + color: hsla(0, 0%, 100%, 1); + text-shadow: 0 0 3px hsl(30, 30%, 60%); +} +a#gc_url { + padding: 0 2px; + background-color: hsla(210, 50%, 50%, 1); + color: hsla(210, 0%, 96%, 1); + border-radius: 2px; + cursor: pointer; + text-decoration: none; +} +a#gc_url:hover { + background-color: hsla(210, 50%, 60%, 1); + color: hsla(0, 0%, 100%, 1); + text-shadow: 0 0 3px hsl(210, 30%, 60%); +} +#gc_sugg_title { + padding: 0 10px; + background-color: hsl(210, 10%, 90%); + color: hsl(210, 50%, 30%); + font-size: 10px; + font-weight: bold; +} +#sc_sugg_title { + padding: 0 10px; + background-color: hsl(0, 10%, 90%); + color: hsl(0, 50%, 30%); + font-size: 9px; + font-weight: bold; +} +#gc_sugg_block { + padding: 10px; + background-color: hsl(210, 10%, 96%); + border-radius: 0 0 2px 2px; +} +#sc_sugg_block { + padding: 10px; + background-color: hsl(0, 10%, 96%); + border-radius: 0 0 2px 2px; +} +#gc_sugg_block a.sugg { + padding: 1px 6px; + background-color: hsla(180, 50%, 40%, 1); + color: hsla(180, 0%, 96%, 1); + border-radius: 2px; + cursor: pointer; + text-decoration: none; +} +#gc_sugg_block a.sugg:hover { + background-color: hsla(180, 70%, 50%, 1); + color: hsla(0, 0%, 100%, 1); + text-shadow: 0 0 3px hsl(180, 30%, 60%); +} +#sc_sugg_block a.sugg { + padding: 1px 6px; + background-color: hsla(30, 80%, 40%, 1); + color: hsla(30, 0%, 96%, 1); + border-radius: 2px; + cursor: pointer; + text-decoration: none; +} +#sc_sugg_block a.sugg:hover { + background-color: hsla(30, 100%, 50%, 1); + color: hsla(0, 0%, 100%, 1); + text-shadow: 0 0 3px hsl(30, 30%, 60%); } +/* + Action buttons +*/ .actions { margin-top: -10px; margin-bottom: 10px; } Index: gc_lang/fr/xpi/data/gc_panel.html ================================================================== --- gc_lang/fr/xpi/data/gc_panel.html +++ gc_lang/fr/xpi/data/gc_panel.html @@ -49,10 +49,31 @@
+
+ +
+

+

Erreur grammaticale.

+ Ignorer   + Voulez-vous en savoir plus ?… +
+
SUGGESTIONS :
+
+
+ +
+ +
+

Mot inconnu du dictionnaire.

+ Ignorer +
+
SUGGESTIONS :
+
+
Index: gc_lang/fr/xpi/data/gc_panel.js ================================================================== --- gc_lang/fr/xpi/data/gc_panel.js +++ gc_lang/fr/xpi/data/gc_panel.js @@ -66,41 +66,47 @@ self.port.on("end", function() { stopWaitIcon(); document.getElementById("copy_to_clipboard").style.display = "block"; }); -self.port.on("suggestionsFor", function (sWord, sSuggestions, sTooltipId) { - setSpellSuggestionsFor(sWord, sSuggestions, sTooltipId); +self.port.on("suggestionsFor", function (sWord, sSuggestions, sErrId) { + setSpellSuggestionsFor(sWord, sSuggestions, sErrId); }); window.addEventListener( "click", function (xEvent) { - let xElem = xEvent.target; - if (xElem.id) { - if (xElem.id.startsWith("sugg")) { - applySuggestion(xElem.id); - } else if (xElem.id.startsWith("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("end")) { - document.getElementById(xElem.id).parentNode.parentNode.style.display = "none"; - } else if (xElem.tagName === "U" && xElem.id.startsWith("err")) { - showTooltip(xElem.id); - } else if (xElem.id.startsWith("resize")) { - self.port.emit("resize", xElem.id, 10); - } else { - hideAllTooltips(); - } - } else if (xElem.tagName === "A") { - self.port.emit("openURL", xElem.getAttribute("href")); - } else { - hideAllTooltips(); + try { + let xElem = xEvent.target; + 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("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); + } else { + hideAllTooltips(); + } + } else if (xElem.tagName === "A") { + self.port.emit("openURL", xElem.getAttribute("href")); + } else { + hideAllTooltips(); + } + } + catch (e) { + showError(e); } }, false ); @@ -110,10 +116,15 @@ */ function showError (e) { console.error("\n" + e.fileName + "\n" + e.name + "\nline: " + e.lineNumber + "\n" + e.message); } + +function closeMessageBox () { + document.getElementById("messagebox").style.display = "none"; + document.getElementById("message").textContent = ""; +} function addMessage (sClass, sText) { let xNode = document.createElement("p"); xNode.className = sClass; xNode.textContent = sText; @@ -201,11 +212,11 @@ xParagraph.insertAdjacentHTML("beforeend", ""); nEndLastErr = nEnd; } nErr += 1; } - if (nEndLastErr < sParagraph.length) { + if (nEndLastErr <= sParagraph.length) { xParagraph.appendChild(document.createTextNode(sParagraph.slice(nEndLastErr))); } } catch (e) { showError(e); @@ -215,228 +226,171 @@ function _createError (sUnderlined, oErr) { let xNodeErr = document.createElement("u"); xNodeErr.id = "err" + oErr['sId']; xNodeErr.className = "error " + oErr['sType']; xNodeErr.textContent = sUnderlined; + xNodeErr.dataset.error_id = oErr['sId']; + xNodeErr.dataset.error_type = (oErr['sType'] === "WORD") ? "spelling" : "grammar"; xNodeErr.setAttribute("href", "#"); xNodeErr.setAttribute("onclick", "return false;"); - let xTooltip = (oErr['sType'] !== "WORD") ? _getGrammarTooltip(oErr) : _getSpellingTooltip(oErr); - xNodeErr.appendChild(xTooltip); + if (xNodeErr.dataset.error_type === "grammar") { + xNodeErr.dataset.gc_message = oErr['sMessage']; + xNodeErr.dataset.gc_url = oErr['URL']; + if (xNodeErr.dataset.gc_message.includes(" #")) { + xNodeErr.dataset.line_id = oErr['sLineId']; + xNodeErr.dataset.rule_id = oErr['sRuleId']; + } + xNodeErr.dataset.suggestions = oErr["aSuggestions"].join("|"); + } 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")); - xSpan.appendChild(_createSuggestionLabel()); - xSpan.appendChild(document.createElement("br")); - let iSugg = 0; - for (let sSugg of oErr["aSuggestions"]) { - xSpan.appendChild(_createSuggestion(oErr["sId"], iSugg, sSugg)); - xSpan.appendChild(document.createTextNode(" ")); - iSugg += 1; - } - } - return xSpan; -} - -function _getSpellingTooltip (oErr) { - let xSpan = document.createElement("span"); - xSpan.id = "tooltip" + oErr['sId']; - xSpan.className = "tooltip"; - xSpan.setAttribute("contenteditable", "false"); - xSpan.appendChild(document.createTextNode("Mot inconnu du dictionnaire. ")); - xSpan.appendChild(_createIgnoreButton(oErr["sId"])); - xSpan.appendChild(document.createElement("br")); - xSpan.appendChild(_createSuggestionLabel()); - xSpan.appendChild(document.createElement("br")); - return xSpan; -} - -function _createIgnoreButton (sErrorId) { - let xIgnore = document.createElement("a"); - xIgnore.id = "ignore" + sErrorId; - xIgnore.className = "ignore"; - xIgnore.setAttribute("href", "#"); - xIgnore.setAttribute("onclick", "return false;"); - xIgnore.textContent = "IGNORER"; - return xIgnore; -} - -function _createInfoLink (sURL) { - let xInfo = document.createElement("a"); - xInfo.setAttribute("href", sURL); - xInfo.setAttribute("onclick", "return false;"); - xInfo.textContent = "Infos…"; - return xInfo; -} - -function _createSuggestionLabel () { - let xNode = document.createElement("s"); - xNode.textContent = "Suggestions :"; - return xNode; +function applySuggestion (sSuggId) { // sugg + try { + let sErrorId = document.getElementById(sSuggId).dataset.error_id; + let sIdParagr = sErrorId.slice(0, sErrorId.indexOf("_")); + startWaitIcon("paragr"+sIdParagr); + let xNodeErr = document.getElementById("err" + sErrorId); + xNodeErr.textContent = document.getElementById(sSuggId).textContent; + xNodeErr.className = "corrected"; + xNodeErr.removeAttribute("style"); + self.port.emit("correction", sIdParagr, document.getElementById("paragr"+sIdParagr).textContent); + hideAllTooltips(); + stopWaitIcon("paragr"+sIdParagr); + } + catch (e) { + showError(e); + } +} + +function ignoreError (sIgnoreButtonId) { // ignore + try { + console.log("ignore button: " + sIgnoreButtonId + " // error id: " + document.getElementById(sIgnoreButtonId).dataset.error_id); + let xNodeErr = document.getElementById("err"+document.getElementById(sIgnoreButtonId).dataset.error_id); + xNodeErr.className = "ignored"; + xNodeErr.removeAttribute("style"); + hideAllTooltips(); + } + catch (e) { + showError(e); + } +} + +function showTooltip (sNodeErrorId) { // err + try { + hideAllTooltips(); + let xNodeError = document.getElementById(sNodeErrorId); + let sTooltipId = (xNodeError.dataset.error_type === "grammar") ? "gc_tooltip" : "sc_tooltip"; + let xNodeTooltip = document.getElementById(sTooltipId); + let nLimit = nPanelWidth - 320; // paragraph width - tooltip width + xNodeTooltip.style.top = (xNodeError.offsetTop + 16) + "px"; + xNodeTooltip.style.left = (xNodeError.offsetLeft > nLimit) ? nLimit + "px" : xNodeError.offsetLeft + "px"; + if (xNodeError.dataset.error_type === "grammar") { + // grammar error + document.getElementById("gc_message").textContent = xNodeError.dataset.gc_message; + if (xNodeError.dataset.gc_url != "") { + document.getElementById("gc_url").style.display = "inline"; + document.getElementById("gc_url").setAttribute("href", xNodeError.dataset.gc_url); + } else { + document.getElementById("gc_url").style.display = "none"; + } + document.getElementById("gc_ignore").dataset.error_id = xNodeError.dataset.error_id; + let iSugg = 0; + let xGCSugg = document.getElementById("gc_sugg_block"); + xGCSugg.textContent = ""; + for (let sSugg of xNodeError.dataset.suggestions.split("|")) { + xGCSugg.appendChild(_createSuggestion(xNodeError.dataset.error_id, iSugg, sSugg)); + xGCSugg.appendChild(document.createTextNode(" ")); + iSugg += 1; + } + } + xNodeTooltip.style.display = "block"; + if (xNodeError.dataset.error_type === "spelling") { + // spelling mistake + document.getElementById("sc_ignore").dataset.error_id = xNodeError.dataset.error_id; + //console.log("getSuggFor: " + xNodeError.textContent.trim() + " // error_id: " + xNodeError.dataset.error_id); + self.port.emit("getSuggestionsForTo", xNodeError.textContent.trim(), xNodeError.dataset.error_id); + } + } + catch (e) { + showError(e); + } } function _createSuggestion (sErrId, iSugg, sSugg) { let xNodeSugg = document.createElement("a"); xNodeSugg.id = "sugg" + sErrId + "-" + iSugg.toString(); xNodeSugg.className = "sugg"; xNodeSugg.setAttribute("href", "#"); xNodeSugg.setAttribute("onclick", "return false;"); + xNodeSugg.dataset.error_id = sErrId; xNodeSugg.textContent = sSugg; return xNodeSugg; } -function closeMessageBox () { - document.getElementById("messagebox").style.display = "none"; - document.getElementById("message").textContent = ""; -} - -function applySuggestion (sElemId) { // sugg - try { - let sIdParagr = sElemId.slice(4, sElemId.indexOf("_")); - startWaitIcon("paragr"+sIdParagr); - let sIdErr = "err" + sElemId.slice(4, sElemId.indexOf("-")); - document.getElementById(sIdErr).textContent = document.getElementById(sElemId).textContent; - document.getElementById(sIdErr).className = "corrected"; - document.getElementById(sIdErr).removeAttribute("style"); - self.port.emit("correction", sIdParagr, getPurgedTextOfElem("paragr"+sIdParagr)); - stopWaitIcon("paragr"+sIdParagr); +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(); +} + +function hideAllTooltips () { + document.getElementById("gc_tooltip").style.display = "none"; + document.getElementById("sc_tooltip").style.display = "none"; +} + +function setSpellSuggestionsFor (sWord, sSuggestions, sErrId) { + // spell checking suggestions + try { + // console.log("setSuggestionsFor: " + sWord + " > " + sSuggestions + " // " + sErrId); + let xSuggBlock = document.getElementById("sc_sugg_block"); + xSuggBlock.textContent = ""; + if (sSuggestions === "") { + xSuggBlock.appendChild(document.createTextNode("Aucune.")); + } else if (sSuggestions.startsWith("#")) { + xSuggBlock.appendChild(document.createTextNode(sSuggestions)); + } else { + let lSugg = sSuggestions.split("|"); + let iSugg = 0; + for (let sSugg of lSugg) { + xSuggBlock.appendChild(_createSuggestion(sErrId, iSugg, sSugg)); + xSuggBlock.appendChild(document.createTextNode(" ")); + iSugg += 1; + } + } } catch (e) { showError(e); } } -function ignoreError (sElemId) { // ignore - let sIdErr = "err" + sElemId.slice(6); - let xTooltipElem = document.getElementById("tooltip"+sElemId.slice(6)); - document.getElementById(sIdErr).removeChild(xTooltipElem); - document.getElementById(sIdErr).className = "ignored"; - document.getElementById(sIdErr).removeAttribute("style"); -} - -function showTooltip (sElemId) { // err - hideAllTooltips(); - let sTooltipId = "tooltip" + sElemId.slice(3); - let xTooltipElem = document.getElementById(sTooltipId); - let nLimit = nPanelWidth - 300; // paragraph width - tooltip width - if (document.getElementById(sElemId).offsetLeft > nLimit) { - xTooltipElem.style.left = "-" + (document.getElementById(sElemId).offsetLeft - nLimit) + "px"; - } - xTooltipElem.setAttribute("contenteditable", false); - xTooltipElem.className = 'tooltip_on'; - if (document.getElementById(sElemId).className === "error WORD" && xTooltipElem.textContent.endsWith(":")) { - // spelling mistake - self.port.emit("getSuggestionsForTo", document.getElementById(sElemId).innerHTML.replace(/, we also remove style attribute - let xParagraphElem = document.getElementById(sId); - for (xNode of xParagraphElem.getElementsByTagName("u")) { - if (xNode.id.startsWith('err')) { - xNode.innerHTML = xNode.innerHTML.replace(/<\/?u>/g, ""); - xNode.removeAttribute("style"); - } - } - // we remove style attribute on tooltip - for (xNode of xParagraphElem.getElementsByTagName("span")) { - if (xNode.id.startsWith('tooltip')) { - xNode.removeAttribute("style"); - } - } - // now, we remove tooltips, then errors, and we change some html entities - let sText = xParagraphElem.innerHTML; - sText = sText.replace(/ *$/ig, ""); - sText = sText.replace(/(.+?)<\/u>/g, "$1"); - sText = sText.replace(/ /g, " ").replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&"); - return sText; -} - -function getPurgedTextOfElem2 (sId) { - // It is better to remove tooltips via DOM and retrieve textContent, - // but for some reason getElementsByClassName “hazardously” forgets elements. - // Unused. Needs investigation. - let xParagraphElem = document.getElementById(sId).cloneNode(true); - for (let xNode of xParagraphElem.getElementsByClassName("tooltip")) { - xNode.parentNode.removeChild(xNode); - } - return xParagraphElem.textContent; -} - -function hideAllTooltips () { - for (let xElem of document.getElementsByClassName("tooltip_on")) { - xElem.className = "tooltip"; - xElem.removeAttribute("style"); - } -} - -function setSpellSuggestionsFor (sWord, sSuggestions, sTooltipId) { - // spell checking suggestions - //console.log(sWord + ": " + sSuggestions); - let xTooltip = document.getElementById(sTooltipId); - if (sSuggestions === "") { - xTooltip.appendChild(document.createTextNode("Aucune.")); - } else if (sSuggestions.startsWith("#")) { - xTooltip.appendChild(document.createTextNode(sSuggestions)); - } else { - let lSugg = sSuggestions.split("|"); - let iSugg = 0; - let sElemId = sTooltipId.slice(7); - for (let sSugg of lSugg) { - xTooltip.appendChild(_createSuggestion(sElemId, iSugg, sSugg)); - xTooltip.appendChild(document.createTextNode(" ")); - iSugg += 1; - } - } -} - function copyToClipboard () { startWaitIcon(); try { - document.getElementById("clipboard_msg").textContent = "copie en cours…"; + let xClipboardButton = document.getElementById("clipboard_msg"); + xClipboardButton.textContent = "copie en cours…"; let sText = ""; for (let xNode of document.getElementById("errorlist").getElementsByClassName("paragraph")) { - sText += getPurgedTextOfElem(xNode.id); - sText += "\n"; + sText += xNode.textContent + "\n"; } self.port.emit('copyToClipboard', sText); - document.getElementById("clipboard_msg").textContent = "-> presse-papiers"; - window.setTimeout(function() { document.getElementById("clipboard_msg").textContent = "∑"; } , 3000); + xClipboardButton.textContent = "-> presse-papiers"; + window.setTimeout(function() { xClipboardButton.textContent = "∑"; } , 3000); } catch (e) { console.log(e.lineNumber + ": " +e.message); } stopWaitIcon();