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 @@ -102,10 +102,12 @@ padding: 5px 10px 5px 10px; background-color: hsl(210, 50%, 30%); color: hsl(210, 50%, 96%); } div#grammalecte_tooltip_actions { + display: flex; + justify-content: space-between; margin: 0; padding: 7px 10px 5px 10px; background-color: hsl(210, 50%, 30%); color: hsl(210, 50%, 96%); } @@ -142,11 +144,11 @@ div#grammalecte_tooltip_ignore:hover { background-color: hsl(30, 30%, 50%); color: hsla(0, 0%, 100%, 1); text-shadow: 0 0 3px hsl(30, 30%, 60%); } -div#grammalecte_tooltip_url, div#grammalecte_tooltip_db_search { +div#grammalecte_tooltip_url { display: inline-block; margin-left: 10px; padding: 1px 5px; background-color: hsl(210, 50%, 50%); color: hsla(210, 0%, 96%, 1); @@ -154,15 +156,32 @@ cursor: pointer; font-family: Tahoma, "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", sans-serif; font-size: 12px; text-decoration: none; } -div#grammalecte_tooltip_url:hover, div#grammalecte_tooltip_db_search:hover { +div#grammalecte_tooltip_url:hover { background-color: hsl(210, 50%, 60%); color: hsla(0, 0%, 100%, 1); text-shadow: 0 0 3px hsl(210, 30%, 60%); } +div#grammalecte_tooltip_db_search { + display: inline-block; + margin-left: 10px; + padding: 1px 5px; + /*background-color: hsl(210, 50%, 50%);*/ + color: hsla(210, 0%, 96%, .1); + border-radius: 2px; + cursor: pointer; + font-family: Tahoma, "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", sans-serif; + font-size: 12px; + text-decoration: none; +} +div#grammalecte_tooltip_db_search:hover { + background-color: hsla(210, 50%, 50%, .1); + color: hsla(0, 0%, 100%, .2); + text-shadow: 0 0 3px hsla(210, 30%, 60%, .2); +} div#grammalecte_tooltip_sugg_title { padding: 0 10px; background-color: hsl(210, 10%, 90%); color: hsl(210, 50%, 30%); 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 @@ -792,11 +792,10 @@ class GrammalecteTooltip { constructor (xParent, xGCPanelContent) { this.xParent = xParent; this.sErrorId = null; - this.bDebug = false; this.xTooltip = oGrammalecte.createNode("div", {id: "grammalecte_tooltip"}); this.xTooltipArrow = oGrammalecte.createNode("img", { id: "grammalecte_tooltip_arrow", src: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAOwAAADsABataJCQAAABl0RVh0U29mdHdhcmUAcGFpbnQubmV0IDQuMC4xNzNun2MAAAAnSURBVChTY/j//z8cq/kW/wdhZDEMSXRFWCVhGKwAmwQyHngFxf8B5fOGYfeFpYoAAAAASUVORK5CYII=", alt: "^", @@ -812,11 +811,11 @@ this.xTooltip.appendChild(this.xTooltipSuggBlock); // actions let xActions = oGrammalecte.createNode("div", {id: "grammalecte_tooltip_actions"}); xActions.appendChild(oGrammalecte.createNode("div", {id: "grammalecte_tooltip_ignore", textContent: "Ignorer"})); xActions.appendChild(oGrammalecte.createNode("div", {id: "grammalecte_tooltip_url", textContent: "Voulez-vous en savoir plus ?…"}, {url: ""})); - xActions.appendChild(oGrammalecte.createNode("div", {id: "grammalecte_tooltip_db_search", textContent: " ››› base de données"}, {url: ""})); + xActions.appendChild(oGrammalecte.createNode("div", {id: "grammalecte_tooltip_db_search", textContent: "››"}, {url: ""})); this.xTooltip.appendChild(xActions); // add tooltip to the page xGCPanelContent.appendChild(this.xTooltip); xGCPanelContent.appendChild(this.xTooltipArrow); } @@ -835,20 +834,17 @@ this.xTooltipArrow.style.left = (xNodeErr.offsetLeft + Math.floor((nUsefulErrorWidth / 2)) - 4) + "px"; // 4 is half the width of the arrow. this.xTooltip.style.top = (xNodeErr.offsetTop + 20) + "px"; this.xTooltip.style.left = (xNodeErr.offsetLeft > nTooltipLeftLimit) ? nTooltipLeftLimit + "px" : xNodeErr.offsetLeft + "px"; if (xNodeErr.dataset.error_type === "grammar") { // grammar error - this.xParent.getElementById("grammalecte_tooltip_db_search").style.display = "none"; if (xNodeErr.dataset.gc_message.includes(" ##")) { - this.bDebug = true; // display rule id let n = xNodeErr.dataset.gc_message.indexOf(" ##"); this.xParent.getElementById("grammalecte_tooltip_message").textContent = xNodeErr.dataset.gc_message.slice(0, n); this.xParent.getElementById("grammalecte_tooltip_rule_id").textContent = "Règle : " + xNodeErr.dataset.gc_message.slice(n+2); this.xParent.getElementById("grammalecte_tooltip_rule_id").style.display = "block"; } else { - this.bDebug = false; this.xParent.getElementById("grammalecte_tooltip_message").textContent = xNodeErr.dataset.gc_message; this.xParent.getElementById("grammalecte_tooltip_rule_id").style.display = "none"; } if (xNodeErr.dataset.gc_url != "") { this.xParent.getElementById("grammalecte_tooltip_url").dataset.url = xNodeErr.dataset.gc_url; @@ -855,10 +851,11 @@ this.xParent.getElementById("grammalecte_tooltip_url").style.display = "inline"; } else { this.xParent.getElementById("grammalecte_tooltip_url").dataset.url = ""; this.xParent.getElementById("grammalecte_tooltip_url").style.display = "none"; } + this.xParent.getElementById("grammalecte_tooltip_db_search").style.display = "none"; this.xParent.getElementById("grammalecte_tooltip_ignore").dataset.error_id = xNodeErr.dataset.error_id; let iSugg = 0; this.clearSuggestionBlock(); if (xNodeErr.dataset.suggestions.length > 0) { for (let sSugg of xNodeErr.dataset.suggestions.split("|")) { @@ -875,16 +872,12 @@ this.xParent.getElementById("grammalecte_tooltip_message").textContent = "Mot inconnu du dictionnaire."; this.xParent.getElementById("grammalecte_tooltip_ignore").dataset.error_id = xNodeErr.dataset.error_id; this.xParent.getElementById("grammalecte_tooltip_rule_id").style.display = "none"; this.xParent.getElementById("grammalecte_tooltip_url").dataset.url = ""; this.xParent.getElementById("grammalecte_tooltip_url").style.display = "none"; - if (this.bDebug) { - this.xParent.getElementById("grammalecte_tooltip_db_search").style.display = "inline"; - this.xParent.getElementById("grammalecte_tooltip_db_search").dataset.url = "https://grammalecte.net/dictionary.php?prj=fr&lemma="+xNodeErr.textContent; - } else { - this.xParent.getElementById("grammalecte_tooltip_db_search").style.display = "none"; - } + this.xParent.getElementById("grammalecte_tooltip_db_search").style.display = "inline-block"; + this.xParent.getElementById("grammalecte_tooltip_db_search").dataset.url = "https://grammalecte.net/dictionary.php?prj=fr&lemma="+xNodeErr.textContent; this.clearSuggestionBlock(); this.xTooltipSuggBlock.textContent = "Recherche de graphies possibles…"; oGrammalecteBackgroundPort.getSpellSuggestions(xNodeErr.textContent, "__GrammalectePanel__", xNodeErr.dataset.error_id); } this.xTooltipArrow.style.display = "block"; @@ -899,14 +892,10 @@ while (this.xTooltipSuggBlock.firstChild) { this.xTooltipSuggBlock.removeChild(this.xTooltipSuggBlock.firstChild); } } - setTooltipColor () { - // todo - } - hide () { this.xTooltipArrow.style.display = "none"; this.xTooltip.style.display = "none"; }