Index: gc_lang/fr/webext/content_scripts/init.js ================================================================== --- gc_lang/fr/webext/content_scripts/init.js +++ gc_lang/fr/webext/content_scripts/init.js @@ -238,11 +238,11 @@ } else { oGrammalecte.oLxgPanel.stopWaitIcon(); } break; case "getSpellSuggestions": - oGrammalecte.oGCPanel.oTooltip.setSpellSuggestionsFor(result.sWord, result.aSugg, dInfo.sErrorId); + oGrammalecte.oGCPanel.oTooltip.setSpellSuggestionsFor(result.sWord, result.aSugg, result.iSuggBlock, dInfo.sErrorId); break; /* Commands received from the context menu (Context menu are initialized in background) */ Index: gc_lang/fr/webext/content_scripts/panel_gc.css ================================================================== --- gc_lang/fr/webext/content_scripts/panel_gc.css +++ gc_lang/fr/webext/content_scripts/panel_gc.css @@ -111,13 +111,14 @@ font-size: 11px; font-style: normal; text-align: center; } #grammalecte_tooltip_message { + margin: 0 0 5px 0; font-family: Tahoma, "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", sans-serif; font-size: 15px; - margin: 0 0 5px 0; + color: hsl(210, 50%, 96%); } #grammalecte_tooltip_ignore { display: inline-block; padding: 1px 5px; background-color: hsl(30, 30%, 40%); @@ -150,10 +151,21 @@ color: hsla(0, 0%, 100%, 1); text-shadow: 0 0 3px hsl(210, 30%, 60%); } #grammalecte_tooltip_sugg_title { padding: 0 10px; + background-color: hsl(210, 10%, 90%); + color: hsl(210, 50%, 30%); + font-family: Tahoma, "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", sans-serif; + font-size: 10px; + font-weight: bold; +} +.grammalecte_tooltip_other_sugg_title { + margin: 5px 0; + padding: 0px 10px; + line-height: normal; + border-radius: 2px; background-color: hsl(210, 10%, 90%); color: hsl(210, 50%, 30%); font-family: Tahoma, "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", sans-serif; font-size: 10px; font-weight: bold; Index: gc_lang/fr/webext/content_scripts/panel_gc.js ================================================================== --- gc_lang/fr/webext/content_scripts/panel_gc.js +++ gc_lang/fr/webext/content_scripts/panel_gc.js @@ -392,19 +392,26 @@ xNodeSugg.dataset.error_id = sErrorId; xNodeSugg.textContent = sSugg; return xNodeSugg; } - setSpellSuggestionsFor (sWord, aSugg, sErrorId) { + setSpellSuggestionsFor (sWord, aSugg, iSuggBlock, sErrorId) { // spell checking suggestions try { if (sErrorId === this.sErrorId) { let xSuggBlock = document.getElementById("grammalecte_tooltip_sugg_block"); - xSuggBlock.textContent = ""; + if (iSuggBlock == 0) { + xSuggBlock.textContent = ""; + } if (!aSugg || aSugg.length == 0) { - xSuggBlock.appendChild(document.createTextNode("Aucune.")); + if (iSuggBlock == 0) { + xSuggBlock.appendChild(document.createTextNode("Aucune.")); + } } else { + if (iSuggBlock > 0) { + xSuggBlock.appendChild(oGrammalecte.createNode("div", {className: "grammalecte_tooltip_other_sugg_title", textContent: "AUTRES SUGGESTIONS :"})); + } let iSugg = 0; for (let sSugg of aSugg) { xSuggBlock.appendChild(this._createSuggestion(sErrorId, iSugg, sSugg)); xSuggBlock.appendChild(document.createTextNode(" ")); iSugg += 1; @@ -411,10 +418,11 @@ } } } } catch (e) { + let xSuggBlock = document.getElementById("grammalecte_tooltip_sugg_block"); xSuggBlock.appendChild(document.createTextNode("# Oups. Le mécanisme de suggestion orthographique a rencontré un bug… (Ce module est encore en phase β.)")); showError(e); } } } Index: gc_lang/fr/webext/gce_worker.js ================================================================== --- gc_lang/fr/webext/gce_worker.js +++ gc_lang/fr/webext/gce_worker.js @@ -323,13 +323,13 @@ function getSpellSuggestions (sWord, dInfo) { if (!oSpellChecker) { postMessage(createResponse("getSpellSuggestions", "# Error. SpellChecker not loaded.", dInfo, true)); return; } - let i = 1; + let i = 0; for (let aSugg of oSpellChecker.suggest(sWord)) { - postMessage(createResponse("getSpellSuggestions", {sWord: sWord, aSugg: aSugg, iSugg: i}, dInfo, true)); + postMessage(createResponse("getSpellSuggestions", {sWord: sWord, aSugg: aSugg, iSuggBlock: i}, dInfo, true)); i += 1; } }