Index: gc_lang/fr/webext/background.js ================================================================== --- gc_lang/fr/webext/background.js +++ gc_lang/fr/webext/background.js @@ -190,11 +190,10 @@ browser.contextMenus.onClicked.addListener(function (xInfo, xTab) { // xInfo = https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/contextMenus/OnClickData // xTab = https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/tabs/Tab - // confusing: no way to get the node where we click?! switch (xInfo.menuItemId) { case "parseAndSpellcheck": parseAndSpellcheckSelectedText(xTab.id, xInfo.selectionText); break; Index: gc_lang/fr/webext/content_scripts/panel_tf.css ================================================================== --- gc_lang/fr/webext/content_scripts/panel_tf.css +++ gc_lang/fr/webext/content_scripts/panel_tf.css @@ -7,73 +7,73 @@ Options */ #grammalecte_tf_options { display: flex; padding: 10px; + color: hsl(0, 0%, 0%); } .grammalecte_tf_column { flex-grow: 1; width: 360px; padding: 0 5px; } #grammalecte_tf_options legend label { + margin: 0; + padding: 0; font-size: 20px; color: hsla(210, 20%, 50%, .8); font-weight: bold; } #grammalecte_tf_options fieldset { padding: 2px 10px 10px 13px; - margin-bottom: 5px; + margin: 0 0 5px 0; background-color: hsl(210, 10%, 96%); border-color: hsl(210, 20%, 80%); border-radius: 3px; } -#grammalecte_tf_options legend .option { +#grammalecte_tf_options legend .grammalecte_tf_option { margin: 7px 5px 0 4px; float: left; } #grammalecte_tf_options label { + margin: 0; + padding: 0; font-size: 13px; } -#grammalecte_tf_options .underline:hover { +.grammalecte_tf_underline:hover { background-color: hsl(210, 10%, 86%); border-radius: 2px; } -#grammalecte_tf_options .blockopt .option { +.grammalecte_tf_blockopt .grammalecte_tf_option { margin: 4px 5px 0 6px; float: left; } -#grammalecte_tf_options .grammalecte_tf_result { +.grammalecte_tf_result { float: right; margin: 2px 3px 0 0; font-size: 13px; } -#grammalecte_tf_options .indent { +.grammalecte_tf_indent { padding-left: 20px; } -#grammalecte_tf_options .inlineblock { +.grammalecte_tf_inlineblock { display: inline-block; margin-right: 10px; } -#grammalecte_tf_options .rmg10 { - margin-right: 10px; -} - /* Actions */ #grammalecte_tf_actions { - /*background-color: hsl(120, 10%, 92%);*/ display: flex; justify-content: space-between; padding: 15px 15px 10px 15px; border-top: 1px solid hsl(210, 10%, 90%); } -.grammalecte_button { +.grammalecte_tf_button { display: inline-block; padding: 5px 10px; width: 100px; border-radius: 3px; font-size: 16px; @@ -101,10 +101,5 @@ color: hsl(150, 0%, 100%); } #grammalecte_tf_apply:hover { background-color: hsl(120, 50%, 40%); } - -#grammalecte_progressbarbox { - display: inline-block; - padding: 10px 20px; -} Index: gc_lang/fr/webext/content_scripts/panel_tf.js ================================================================== --- gc_lang/fr/webext/content_scripts/panel_tf.js +++ gc_lang/fr/webext/content_scripts/panel_tf.js @@ -69,13 +69,13 @@ xColumn2.appendChild(xStruct); xOptions.appendChild(xColumn1); xOptions.appendChild(xColumn2); // Actions let xActions = createNode("div", {id: "grammalecte_tf_actions"}); - let xDefaultButton = createNode("div", {id: "grammalecte_tf_reset", textContent: "Par défaut", className: "grammalecte_button"}); + let xDefaultButton = createNode("div", {id: "grammalecte_tf_reset", textContent: "Par défaut", className: "grammalecte_tf_button"}); xDefaultButton.addEventListener("click", () => { this.reset(); }); - let xApplyButton = createNode("div", {id: "grammalecte_tf_apply", textContent: "Appliquer", className: "grammalecte_button"}); + let xApplyButton = createNode("div", {id: "grammalecte_tf_apply", textContent: "Appliquer", className: "grammalecte_tf_button"}); xApplyButton.addEventListener("click", () => { this.saveOptions(); this.apply(); }); xActions.appendChild(xDefaultButton); xActions.appendChild(createNode("progress", {id: "grammalecte_tf_progressbar"})); xActions.appendChild(createNode("span", {id: "grammalecte_tf_time_res", textContent: "…"})); xActions.appendChild(xApplyButton); @@ -92,46 +92,46 @@ // Common options _createFieldset (sId, bDefault, sLabel) { let xFieldset = createNode("fieldset", {id: sId, className: "groupblock"}); let xLegend = document.createElement("legend"); - let xGroupOption = createNode("input", {type: "checkbox", id: "o_"+sId, className: "option"}, {default: bDefault}); + let xGroupOption = createNode("input", {type: "checkbox", id: "o_"+sId, className: "grammalecte_tf_option"}, {default: bDefault}); xGroupOption.addEventListener("click", (xEvent) => { this.switchGroup(xEvent.target.id); }); xLegend.appendChild(xGroupOption); xLegend.appendChild(createNode("label", {htmlFor: "o_"+sId, textContent: sLabel})); xFieldset.appendChild(xLegend); return xFieldset; } _createSimpleOption (sId, bDefault, sLabel) { - let xLine = createNode("div", {className: "blockopt underline"}); - xLine.appendChild(createNode("input", {type: "checkbox", id: sId, className: "option"}, {default: bDefault})); + let xLine = createNode("div", {className: "grammalecte_tf_blockopt grammalecte_tf_underline"}); + xLine.appendChild(createNode("input", {type: "checkbox", id: sId, className: "grammalecte_tf_option"}, {default: bDefault})); xLine.appendChild(createNode("label", {htmlFor: sId, textContent: sLabel, className: "opt_lbl largew"})); xLine.appendChild(createNode("div", {id: "res_"+sId, className: "grammalecte_tf_result", textContent: "·"})); return xLine; } // Hyphens _createRadioBoxHyphens (sName, sIdEmDash, sIdEnDash, bDefaultEmDash) { - let xLine = createNode("div", {className: "blockopt indent"}); + let xLine = createNode("div", {className: "grammalecte_tf_blockopt grammalecte_tf_indent"}); xLine.appendChild(this._createInlineRadioOption(sName, sIdEmDash, "cadratin (—)", bDefaultEmDash)); xLine.appendChild(this._createInlineRadioOption(sName, sIdEnDash, "demi-cadratin (—)", !bDefaultEmDash)); return xLine; } // Ligatures _createRadioBoxLigatures () { - let xLine = createNode("div", {className: "blockopt underline"}); + let xLine = createNode("div", {className: "grammalecte_tf_blockopt grammalecte_tf_underline"}); xLine.appendChild(createNode("div", {id: "res_"+"o_ts_ligature", className: "grammalecte_tf_result", textContent: "·"})); xLine.appendChild(this._createInlineCheckboxOption("o_ts_ligature", "Ligatures", true)); xLine.appendChild(this._createInlineRadioOption("liga", "o_ts_ligature_do", "faire", false)); xLine.appendChild(this._createInlineRadioOption("liga", "o_ts_ligature_undo", "défaire", true)); return xLine; } _createLigaturesSelection () { - let xLine = createNode("div", {className: "blockopt indent"}); + let xLine = createNode("div", {className: "grammalecte_tf_blockopt grammalecte_tf_indent"}); xLine.appendChild(this._createInlineCheckboxOption("o_ts_ligature_ff", "ff", true)); xLine.appendChild(this._createInlineCheckboxOption("o_ts_ligature_fi", "fi", true)); xLine.appendChild(this._createInlineCheckboxOption("o_ts_ligature_ffi", "ffi", true)); xLine.appendChild(this._createInlineCheckboxOption("o_ts_ligature_fl", "fl", true)); xLine.appendChild(this._createInlineCheckboxOption("o_ts_ligature_ffl", "ffl", true)); @@ -140,37 +140,37 @@ return xLine; } // Apostrophes _createSingleLetterOptions () { - let xLine = createNode("div", {className: "blockopt indent"}); + let xLine = createNode("div", {className: "grammalecte_tf_blockopt grammalecte_tf_indent"}); xLine.appendChild(this._createInlineCheckboxOption("o_ma_1letter_lowercase", "lettres isolées (j’ n’ m’ t’ s’ c’ d’ l’)", false)); xLine.appendChild(this._createInlineCheckboxOption("o_ma_1letter_uppercase", "Maj.", false)); return xLine; } // Ordinals _createOrdinalOptions () { - let xLine = createNode("div", {className: "blockopt underline"}); + let xLine = createNode("div", {className: "grammalecte_tf_blockopt grammalecte_tf_underline"}); xLine.appendChild(createNode("div", {id: "res_"+"o_ordinals_no_exponant", className: "grammalecte_tf_result", textContent: "·"})); xLine.appendChild(this._createInlineCheckboxOption("o_ordinals_no_exponant", "Ordinaux (15e, XXIe…)", true)); xLine.appendChild(this._createInlineCheckboxOption("o_ordinals_exponant", "e → ᵉ", true)); return xLine; } // Inline option block _createInlineCheckboxOption (sId, sLabel, bDefault) { - let xInlineBlock = createNode("div", {className: "inlineblock"}); - xInlineBlock.appendChild(createNode("input", {type: "checkbox", id: sId, className: "option"}, {default: bDefault})); + let xInlineBlock = createNode("div", {className: "grammalecte_tf_inlineblock"}); + xInlineBlock.appendChild(createNode("input", {type: "checkbox", id: sId, className: "grammalecte_tf_option"}, {default: bDefault})); xInlineBlock.appendChild(createNode("label", {htmlFor: sId, textContent: sLabel, className: "opt_lbl"})); return xInlineBlock; } _createInlineRadioOption (sName, sId, sLabel, bDefault) { - let xInlineBlock = createNode("div", {className: "inlineblock"}); - xInlineBlock.appendChild(createNode("input", {type: "radio", id: sId, name: sName, className:"option"}, {default: bDefault})); + let xInlineBlock = createNode("div", {className: "grammalecte_tf_inlineblock"}); + xInlineBlock.appendChild(createNode("input", {type: "radio", id: sId, name: sName, className:"grammalecte_tf_option"}, {default: bDefault})); xInlineBlock.appendChild(createNode("label", {htmlFor: sId, className: "opt_lbl", textContent: sLabel})); return xInlineBlock; } @@ -192,11 +192,11 @@ this.resetProgressBar(); } reset () { this.resetProgressBar(); - for (let xNode of document.getElementsByClassName("option")) { + for (let xNode of document.getElementsByClassName("grammalecte_tf_option")) { xNode.checked = (xNode.dataset.default === "true"); if (xNode.id.startsWith("o_group_")) { this.switchGroup(xNode.id); } } @@ -209,11 +209,11 @@ setOptions (oOptions) { if (oOptions.hasOwnProperty("tf_options")) { oOptions = oOptions.tf_options; } - for (let xNode of document.getElementsByClassName("option")) { + for (let xNode of document.getElementsByClassName("grammalecte_tf_option")) { //console.log(xNode.id + " > " + oOptions.hasOwnProperty(xNode.id) + ": " + oOptions[xNode.id] + " [" + xNode.dataset.default + "]"); xNode.checked = (oOptions.hasOwnProperty(xNode.id)) ? oOptions[xNode.id] : (xNode.dataset.default === "true"); if (document.getElementById("res_"+xNode.id) !== null) { document.getElementById("res_"+xNode.id).textContent = ""; } @@ -223,11 +223,11 @@ } } saveOptions () { let oOptions = {}; - for (let xNode of document.getElementsByClassName("option")) { + for (let xNode of document.getElementsByClassName("grammalecte_tf_option")) { oOptions[xNode.id] = xNode.checked; //console.log(xNode.id + ": " + xNode.checked); } browser.storage.local.set({"tf_options": oOptions}); }