Overview
Comment: | [fx] gc panel: add bundled conjugation tool |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk | fx |
Files: | files | file ages | folders |
SHA3-256: |
ee9dfb8d9117037ab96574ea2c3e4f10 |
User & Date: | olr on 2019-05-07 15:43:00 |
Other Links: | manifest | tags |
Context
2019-05-07
| ||
16:01 | [fx] gc panel: update ui, better signs check-in: db3f9c82ad user: olr tags: trunk, fx | |
15:43 | [fx] gc panel: add bundled conjugation tool check-in: ee9dfb8d91 user: olr tags: trunk, fx | |
11:54 | [fr] ajustements check-in: d1b5d597da user: olr tags: trunk, fr | |
Changes
Modified gc_lang/fr/webext/background.js from [b3e4a88116] to [dc80f683a6].
︙ | ︙ | |||
39 40 41 42 43 44 45 46 47 48 49 50 51 52 | storeGCOptions(result); break; case "parse": case "parseAndSpellcheck": case "parseAndSpellcheck1": case "getListOfTokens": case "getSpellSuggestions": // send result to content script if (typeof(dInfo.iReturnPort) === "number") { let xPort = dConnx.get(dInfo.iReturnPort); xPort.postMessage(e.data); } else { console.log("[background] don’t know where to send results"); console.log(e.data); | > | 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | storeGCOptions(result); break; case "parse": case "parseAndSpellcheck": case "parseAndSpellcheck1": case "getListOfTokens": case "getSpellSuggestions": case "getVerb": // send result to content script if (typeof(dInfo.iReturnPort) === "number") { let xPort = dConnx.get(dInfo.iReturnPort); xPort.postMessage(e.data); } else { console.log("[background] don’t know where to send results"); console.log(e.data); |
︙ | ︙ | |||
245 246 247 248 249 250 251 252 253 254 255 256 257 258 | let {sCommand, dParam, dInfo} = oRequest; switch (sCommand) { case "parse": case "parseAndSpellcheck": case "parseAndSpellcheck1": case "getListOfTokens": case "getSpellSuggestions": oRequest.dInfo.iReturnPort = iPortId; // we pass the id of the return port to receive answer xGCEWorker.postMessage(oRequest); break; case "openURL": browser.tabs.create({url: dParam.sURL}); break; case "openConjugueurTab": | > | 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 | let {sCommand, dParam, dInfo} = oRequest; switch (sCommand) { case "parse": case "parseAndSpellcheck": case "parseAndSpellcheck1": case "getListOfTokens": case "getSpellSuggestions": case "getVerb": oRequest.dInfo.iReturnPort = iPortId; // we pass the id of the return port to receive answer xGCEWorker.postMessage(oRequest); break; case "openURL": browser.tabs.create({url: dParam.sURL}); break; case "openConjugueurTab": |
︙ | ︙ |
Added gc_lang/fr/webext/content_scripts/html_src.js version [40496dba9d].
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 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 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 | // Javascript "use strict"; /* No way to import HTML in content scripts. Waiting for: https://bugzilla.mozilla.org/show_bug.cgi?id=1364404 @Reviewers: This file only defines HTML nodes in const values */ const sGrammalecteConjugueurHTML = ` <div style="float: right; margin: 10px 30px 0 0"> <input type="text" id="grammalecte_conj_verb" maxlength="40" value="" placeholder="entrez un verbe" autofocus /> <div id="grammalecte_conj_button">Conjuguer</div> </div> <div class="grammalecte_clearer"></div> <h1 class="grammalecte_conj_title" id="grammalecte_conj_verb_title" class="center"> </h1> <div id="grammalecte_conj_verb_info" class="center"> </div> <div id="grammalecte_conj_options"> <label for="grammalecte_conj_oneg">Négative</label> <input type="checkbox" id="grammalecte_conj_oneg" value="ON" /> · <label for="grammalecte_conj_oint">Interrogative</label> <input type="checkbox" id="grammalecte_conj_oint" value="ON" /> · <label for="grammalecte_conj_ofem">Féminin</label> <input type="checkbox" id="grammalecte_conj_ofem" value="ON" /> <br/><label id="grammalecte_conj_opro_lbl" for="grammalecte_conj_opro">Pronominal</label> <input type="checkbox" id="grammalecte_conj_opro" value="ON" /> · <label id="grammalecte_conj_otco_lbl" for="grammalecte_conj_otco">Temps composés</label> <input type="checkbox" id="grammalecte_conj_otco" value="ON" /> </div> <div id="grammalecte_conj_note">❦</div> <!-- section 1 --> <div class="grammalecte_conj_container"> <div class="grammalecte_conj_column"> <div id="infinitif"> <h2 class="grammalecte_conj_title" id="infinitif_title">Infinitif</h2> <div id="grammalecte_conj_infi"> </div> </div> <div id="imperatif"> <h2 class="grammalecte_conj_title" id="imperatif_title">Impératif</h2> <h3 class="grammalecte_conj_title" id="grammalecte_conj_t_impe">Présent</h3> <div id="grammalecte_conj_impe1"> </div> <div id="grammalecte_conj_impe2"> </div> <div id="grammalecte_conj_impe3"> </div> </div> </div> <div class="grammalecte_conj_column"> <div id="partpre"> <h2 class="grammalecte_conj_title" id="partpre_title">Participe présent</h2> <div id="grammalecte_conj_ppre"> </div> </div> <div id="partpas"> <h2 class="grammalecte_conj_title" id="partpas_title">Participes passés</h2> <div id="grammalecte_conj_ppas1"> </div> <div id="grammalecte_conj_ppas2"> </div> <div id="grammalecte_conj_ppas3"> </div> <div id="grammalecte_conj_ppas4"> </div> </div> </div> </div> <div class="grammalecte_clearer"></div> <!-- section 2 --> <div class="grammalecte_conj_container"> <div class="grammalecte_conj_column"> <div id="grammalecte_conj_indicatif"> <h2 class="grammalecte_conj_title" id="grammalecte_conj_indicatif_title">Indicatif</h2> <div id="grammalecte_conj_ipre"> <h3 class="grammalecte_conj_title" id="grammalecte_conj_t_ipre">Présent</h3> <div id="grammalecte_conj_ipre1"> </div> <div id="grammalecte_conj_ipre2"> </div> <div id="grammalecte_conj_ipre3"> </div> <div id="grammalecte_conj_ipre4"> </div> <div id="grammalecte_conj_ipre5"> </div> <div id="grammalecte_conj_ipre6"> </div> </div> <div id="grammalecte_conj_iimp"> <h3 class="grammalecte_conj_title" id="grammalecte_conj_t_iimp">Imparfait</h3> <div id="grammalecte_conj_iimp1"> </div> <div id="grammalecte_conj_iimp2"> </div> <div id="grammalecte_conj_iimp3"> </div> <div id="grammalecte_conj_iimp4"> </div> <div id="grammalecte_conj_iimp5"> </div> <div id="grammalecte_conj_iimp6"> </div> </div> <div id="grammalecte_conj_ipsi"> <h3 class="grammalecte_conj_title" id="grammalecte_conj_t_ipsi">Passé simple</h3> <div id="grammalecte_conj_ipsi1"> </div> <div id="grammalecte_conj_ipsi2"> </div> <div id="grammalecte_conj_ipsi3"> </div> <div id="grammalecte_conj_ipsi4"> </div> <div id="grammalecte_conj_ipsi5"> </div> <div id="grammalecte_conj_ipsi6"> </div> </div> <div id="grammalecte_conj_ifut"> <h3 class="grammalecte_conj_title" id="grammalecte_conj_t_ifut">Futur</h3> <div id="grammalecte_conj_ifut1"> </div> <div id="grammalecte_conj_ifut2"> </div> <div id="grammalecte_conj_ifut3"> </div> <div id="grammalecte_conj_ifut4"> </div> <div id="grammalecte_conj_ifut5"> </div> <div id="grammalecte_conj_ifut6"> </div> </div> </div> </div> <div class="grammalecte_conj_column"> <div id="grammalecte_conj_subjonctif"> <h2 class="grammalecte_conj_title" id="grammalecte_conj_subjontif_title">Subjonctif</h2> <div id="grammalecte_conj_spre"> <h3 class="grammalecte_conj_title" id="grammalecte_conj_t_spre">Présent</h3> <div id="grammalecte_conj_spre1"> </div> <div id="grammalecte_conj_spre2"> </div> <div id="grammalecte_conj_spre3"> </div> <div id="grammalecte_conj_spre4"> </div> <div id="grammalecte_conj_spre5"> </div> <div id="grammalecte_conj_spre6"> </div> </div> <div id="grammalecte_conj_simp"> <h3 class="grammalecte_conj_title" id="grammalecte_conj_t_simp">Imparfait</h3> <div id="grammalecte_conj_simp1"> </div> <div id="grammalecte_conj_simp2"> </div> <div id="grammalecte_conj_simp3"> </div> <div id="grammalecte_conj_simp4"> </div> <div id="grammalecte_conj_simp5"> </div> <div id="grammalecte_conj_simp6"> </div> </div> </div> <div id="grammalecte_conj_conditionnel"> <h2 class="grammalecte_conj_title" id="grammalecte_conj_conditionnel_title">Conditionnel</h2> <div id="grammalecte_conj_conda"> <h3 class="grammalecte_conj_title" id="grammalecte_conj_t_conda">Présent</h3> <div id="grammalecte_conj_conda1"> </div> <div id="grammalecte_conj_conda2"> </div> <div id="grammalecte_conj_conda3"> </div> <div id="grammalecte_conj_conda4"> </div> <div id="grammalecte_conj_conda5"> </div> <div id="grammalecte_conj_conda6"> </div> </div> <div id="grammalecte_conj_condb"> <h3 class="grammalecte_conj_title" id="grammalecte_conj_t_condb"> </h3> <div id="grammalecte_conj_condb1"> </div> <div id="grammalecte_conj_condb2"> </div> <div id="grammalecte_conj_condb3"> </div> <div id="grammalecte_conj_condb4"> </div> <div id="grammalecte_conj_condb5"> </div> <div id="grammalecte_conj_condb6"> </div> </div> </div> </div> </div> <div class="grammalecte_clearer"></div> `; |
Modified gc_lang/fr/webext/content_scripts/init.js from [66d684a48e] to [cd70530a11].
︙ | ︙ | |||
307 308 309 310 311 312 313 314 315 316 317 318 319 320 | } else { oGrammalecte.oGCPanel.stopWaitIcon(); } break; case "getSpellSuggestions": 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) */ // Grammar checker commands case "grammar_checker_editable": if (oGrammalecte.xRightClickedNode !== null) { | > > > | 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 | } else { oGrammalecte.oGCPanel.stopWaitIcon(); } break; case "getSpellSuggestions": oGrammalecte.oGCPanel.oTooltip.setSpellSuggestionsFor(result.sWord, result.aSugg, result.iSuggBlock, dInfo.sErrorId); break; case "getVerb": oGrammalecte.oGCPanel.conjugateWith(result.oVerb, result.oConjTable); break; /* Commands received from the context menu (Context menu are initialized in background) */ // Grammar checker commands case "grammar_checker_editable": if (oGrammalecte.xRightClickedNode !== null) { |
︙ | ︙ |
Modified gc_lang/fr/webext/content_scripts/panel.js from [3166e1bddd] to [d484609e88].
︙ | ︙ | |||
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | } insertIntoPage () { if (this.bShadow) { oGrammalecte.createStyle("content_scripts/panel.css", null, this.xShadow); oGrammalecte.createStyle("content_scripts/panel_gc.css", null, this.xShadow); oGrammalecte.createStyle("content_scripts/panel_lxg.css", null, this.xShadow); oGrammalecte.createStyle("content_scripts/panel_tf.css", null, this.xShadow); this.xShadow.appendChild(this.xPanel); document.body.appendChild(this.xShadowPanel); } else { if (!document.getElementById("grammalecte_csspanel")) { oGrammalecte.createStyle("content_scripts/panel.css", "grammalecte_csspanel", document.head); oGrammalecte.createStyle("content_scripts/panel_gc.css", null, document.head); oGrammalecte.createStyle("content_scripts/panel_lxg.css", null, document.head); oGrammalecte.createStyle("content_scripts/panel_tf.css", null, document.head); } document.body.appendChild(this.xPanel); } } show () { | > > | 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 | } insertIntoPage () { if (this.bShadow) { oGrammalecte.createStyle("content_scripts/panel.css", null, this.xShadow); oGrammalecte.createStyle("content_scripts/panel_gc.css", null, this.xShadow); oGrammalecte.createStyle("content_scripts/panel_lxg.css", null, this.xShadow); oGrammalecte.createStyle("content_scripts/panel_conj.css", null, this.xShadow); oGrammalecte.createStyle("content_scripts/panel_tf.css", null, this.xShadow); this.xShadow.appendChild(this.xPanel); document.body.appendChild(this.xShadowPanel); } else { if (!document.getElementById("grammalecte_csspanel")) { oGrammalecte.createStyle("content_scripts/panel.css", "grammalecte_csspanel", document.head); oGrammalecte.createStyle("content_scripts/panel_gc.css", null, document.head); oGrammalecte.createStyle("content_scripts/panel_lxg.css", null, document.head); oGrammalecte.createStyle("content_scripts/panel_conj.css", null, document.head); oGrammalecte.createStyle("content_scripts/panel_tf.css", null, document.head); } document.body.appendChild(this.xPanel); } } show () { |
︙ | ︙ |
Added gc_lang/fr/webext/content_scripts/panel_conj.css version [4adfee4314].
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 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 86 87 88 89 90 91 92 93 94 | /* CSS Document */ div.grammalecte_clearer { clear: both; font-size: 0; height: 0; } h1.grammalecte_conj_title { margin: 5px 0 2px 0; color: hsl(210, 50%, 50%); font: bold 30px Tahoma, "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", sans-serif; text-align: center; } h2.grammalecte_conj_title { margin: 5px 0 2px 0; color: hsl(0, 50%, 50%); font: bold 16px Tahoma, "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", sans-serif; } h3.grammalecte_conj_title { margin: 5px 0 2px 0; color: hsl(210, 50%, 50%); font: bold 14px Tahoma, "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", sans-serif; } div#grammalecte_conj_verb_info { text-align: center; color: hsl(210, 00%, 40%); } div.grammalecte_conj_container { display: flex; flex-direction: row; flex-wrap: nowrap; justify-content: center; align-items: flex-start; } div.grammalecte_conj_column { width: 50%; padding: 0 10px; font-size: 12px; } input#grammalecte_conj_verb { display: inline-block; width: 230px; margin-left: 5px; padding: 5px 10px; border: 2px solid hsl(0, 0%, 80%); border-radius: 3px; height: 20px; background: transparent; font: normal 18px Tahoma, "Ubuntu Condensed"; color: hsl(0, 0%, 30%); } input[placeholder]#grammalecte_conj_verb { color: hsl(0, 0%, 70%); } div#grammalecte_conj_button { display: inline-block; padding: 7px 10px; font-size: 18px; background-color: hsl(0, 30%, 30%); color: hsl(0, 30%, 60%); border-radius: 3px; text-transform: uppercase; text-align: center; text-decoration: none; cursor: pointer; } div#grammalecte_conj_button:hover { background-color: hsl(0, 60%, 40%); color: hsl(0, 60%, 70%); box-shadow: 0 0 2px hsl(0, 60%, 50%); } div#grammalecte_conj_options { margin: 10px 0 0 5px; font-size: 16px; text-align: center; } div#grammalecte_conj_note { margin: 10px 20px; font-size: 11px; color: hsl(0, 0%, 60%); text-align: center; } |
Modified gc_lang/fr/webext/content_scripts/panel_gc.js from [b2ec53a9df] to [2868380740].
︙ | ︙ | |||
60 61 62 63 64 65 66 67 68 69 70 71 72 73 | this.xPanelContent.appendChild(this.xGCPanelContent); this.xNode = null; this.oNodeControl = new GrammalecteNodeControl(); // Lexicographer this.nLxgCount = 0; this.xLxgPanelContent = oGrammalecte.createNode("div", {id: "grammalecte_lxg_panel_content"}); this.xPanelContent.appendChild(this.xLxgPanelContent); } createMenu () { this.xMenu = oGrammalecte.createNode("div", {className: "grammalecte_panel_menu"}); this.xTFButton = oGrammalecte.createNode("div", {className: "grammalecte_menu_button", textContent: "Formateur de texte"}); this.xEditorButton = oGrammalecte.createNode("div", {className: "grammalecte_menu_button", textContent: "Éditeur"}); this.xLxgButton = oGrammalecte.createNode("div", {className: "grammalecte_menu_button", textContent: "Lexicographe"}); | > > > > > > | 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | this.xPanelContent.appendChild(this.xGCPanelContent); this.xNode = null; this.oNodeControl = new GrammalecteNodeControl(); // Lexicographer this.nLxgCount = 0; this.xLxgPanelContent = oGrammalecte.createNode("div", {id: "grammalecte_lxg_panel_content"}); this.xPanelContent.appendChild(this.xLxgPanelContent); // Conjugueur this.xConjPanelContent = oGrammalecte.createNode("div", {id: "grammalecte_conj_panel_content"}); this.xConjPanelContent.innerHTML = sGrammalecteConjugueurHTML; // @Reviewers: sGrammalecteConjugueurHTML is a const value defined in <content_scripts/html_src.js> this.xPanelContent.appendChild(this.xConjPanelContent); this.sVerb = ""; this.bListenConj = false; } createMenu () { this.xMenu = oGrammalecte.createNode("div", {className: "grammalecte_panel_menu"}); this.xTFButton = oGrammalecte.createNode("div", {className: "grammalecte_menu_button", textContent: "Formateur de texte"}); this.xEditorButton = oGrammalecte.createNode("div", {className: "grammalecte_menu_button", textContent: "Éditeur"}); this.xLxgButton = oGrammalecte.createNode("div", {className: "grammalecte_menu_button", textContent: "Lexicographe"}); |
︙ | ︙ | |||
93 94 95 96 97 98 99 | xGrammalectePort.postMessage({ sCommand: "getListOfTokens", dParam: {sText: this.getParsedText()}, dInfo: ((this.xNode) ? {sTextAreaId: this.xNode.id} : {}) }); } }; | | > > > | > | 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | xGrammalectePort.postMessage({ sCommand: "getListOfTokens", dParam: {sText: this.getParsedText()}, dInfo: ((this.xNode) ? {sTextAreaId: this.xNode.id} : {}) }); } }; this.xConjButton.onclick = () => { this.showConjugueur(); }; this.xLEButton.onclick = () => { xGrammalectePort.postMessage({sCommand: "openLexiconEditor", dParam: null, dInfo: null}); }; this.xMenu.appendChild(this.xTFButton) this.xMenu.appendChild(this.xEditorButton) this.xMenu.appendChild(this.xLxgButton) this.xMenu.appendChild(this.xConjButton) this.xMenu.appendChild(this.xLEButton) this.xPanelBar.appendChild(this.xMenu); } |
︙ | ︙ | |||
135 136 137 138 139 140 141 | return (this.xNode.tagName == "TEXTAREA" || this.xNode.tagName == "INPUT") ? this.xNode.value.normalize("NFC") : this.xNode.innerText.normalize("NFC"); } else { return oGrammalecte.getPageText(); } } showEditor () { | | | > > | > > > > > | > | > > | > > | | | | | | | > > > > | | | 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 | return (this.xNode.tagName == "TEXTAREA" || this.xNode.tagName == "INPUT") ? this.xNode.value.normalize("NFC") : this.xNode.innerText.normalize("NFC"); } else { return oGrammalecte.getPageText(); } } showEditor () { this.switchContentOn(this.xGCPanelContent, this.xEditorButton); this.switchContentOff(this.xLxgPanelContent, this.xLxgButton); this.switchContentOff(this.xConjPanelContent, this.xConjButton); } showLexicographer () { this.switchContentOff(this.xGCPanelContent, this.xEditorButton); this.switchContentOn(this.xLxgPanelContent, this.xLxgButton); this.switchContentOff(this.xConjPanelContent, this.xConjButton); } showConjugueur () { this.switchContentOff(this.xGCPanelContent, this.xEditorButton); this.switchContentOff(this.xLxgPanelContent, this.xLxgButton); this.switchContentOn(this.xConjPanelContent, this.xConjButton); this.listenConj(); if (!this.sVerb) { this.conjugateVerb("être"); } } switchContentOn (xContent, xNodeButton) { xContent.style.display = "block"; xNodeButton.style.backgroundColor = "hsl(210, 60%, 40%)"; xNodeButton.style.textShadow = "2px 0 0 hsla(210, 40%, 35%, .5), -2px 0 0 hsla(210, 40%, 35%, .5), 0 2px 0 hsla(210, 40%, 35%, .5), 0 -2px 0 hsla(210, 40%, 35%, .5), 1px 1px hsla(210, 40%, 35%, .5), -1px -1px 0 hsla(210, 40%, 35%, .5), 1px -1px 0 hsla(210, 40%, 35%, .5), -1px 1px 0 hsla(210, 30%, 35%, .5)"; } switchContentOff (xContent, xNodeButton) { xContent.style.display = "none"; xNodeButton.style.backgroundColor = ""; xNodeButton.style.textShadow = ""; } clear () { while (this.xParagraphList.firstChild) { this.xParagraphList.removeChild(this.xParagraphList.firstChild); } this.aIgnoredErrors.clear(); |
︙ | ︙ | |||
461 462 463 464 465 466 467 468 469 470 471 472 473 474 | setHidden (sClass, bHidden) { let xPanelContent = this.xParent.getElementById('grammalecte_panel_content'); for (let xNode of xPanelContent.getElementsByClassName(sClass)) { xNode.hidden = bHidden; } } } class GrammalecteTooltip { constructor (xParent, xGCPanelContent) { this.xParent = xParent; | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 | setHidden (sClass, bHidden) { let xPanelContent = this.xParent.getElementById('grammalecte_panel_content'); for (let xNode of xPanelContent.getElementsByClassName(sClass)) { xNode.hidden = bHidden; } } // Conjugueur listenConj () { if (!this.bListenConj) { // button this.xParent.getElementById('grammalecte_conj_button').addEventListener("click", (e) => { this.conjugateVerb(); }); // text field this.xParent.getElementById('grammalecte_conj_verb').addEventListener("change", (e) => { this.conjugateVerb(); }); // options this.xParent.getElementById('grammalecte_conj_oneg').addEventListener("click", (e) => { this.updateConj(); }); this.xParent.getElementById('grammalecte_conj_opro').addEventListener("click", (e) => { this.updateConj(); }); this.xParent.getElementById('grammalecte_conj_oint').addEventListener("click", (e) => { this.updateConj(); }); this.xParent.getElementById('grammalecte_conj_ofem').addEventListener("click", (e) => { this.updateConj(); }); this.xParent.getElementById('grammalecte_conj_otco').addEventListener("click", (e) => { this.updateConj(); }); this.bListenConj = true; } } conjugateVerb (sVerb="") { try { if (!sVerb) { sVerb = this.xParent.getElementById('grammalecte_conj_verb').value; } this.xParent.getElementById('grammalecte_conj_oneg').checked = false; this.xParent.getElementById('grammalecte_conj_opro').checked = false; this.xParent.getElementById('grammalecte_conj_oint').checked = false; this.xParent.getElementById('grammalecte_conj_otco').checked = false; this.xParent.getElementById('grammalecte_conj_ofem').checked = false; // request analyzing sVerb = sVerb.trim().toLowerCase().replace(/’/g, "'").replace(/ +/g, " "); if (sVerb) { if (sVerb.startsWith("ne pas ")) { this.xParent.getElementById('grammalecte_conj_oneg').checked = true; sVerb = sVerb.slice(7); } if (sVerb.startsWith("se ")) { this.xParent.getElementById('grammalecte_conj_opro').checked = true; sVerb = sVerb.slice(3); } else if (sVerb.startsWith("s'")) { this.xParent.getElementById('grammalecte_conj_opro').checked = true; sVerb = sVerb.slice(2); } if (sVerb.endsWith("?")) { this.xParent.getElementById('grammalecte_conj_oint').checked = true; sVerb = sVerb.slice(0,-1).trim(); } if (sVerb) { this.sVerb = sVerb; this.updateConj(); } else { this.xParent.getElementById('grammalecte_conj_verb').value = ""; } } } catch (e) { console.error(e.fileName + "\n" + e.name + "\nline: " + e.lineNumber + "\n" + e.message); } } updateConj () { let bPro = this.xParent.getElementById('grammalecte_conj_opro').checked; let bNeg = this.xParent.getElementById('grammalecte_conj_oneg').checked; let bTpsCo = this.xParent.getElementById('grammalecte_conj_otco').checked; let bInt = this.xParent.getElementById('grammalecte_conj_oint').checked; let bFem = this.xParent.getElementById('grammalecte_conj_ofem').checked; if (this.sVerb) { console.log("updateConj send"); xGrammalectePort.postMessage({ sCommand: "getVerb", dParam: {sVerb: this.sVerb, bPro: bPro, bNeg: bNeg, bTpsCo: bTpsCo, bInt: bInt, bFem: bFem}, dInfo: {} }); } } conjugateWith (oVerb, oConjTable) { // function called when results come from the Worker if (oVerb) { this.xParent.getElementById('grammalecte_conj_verb').style = "color: #999999;"; this.xParent.getElementById('grammalecte_conj_verb').value = ""; this.xParent.getElementById('grammalecte_conj_verb_title').textContent = oVerb.sVerb; this.xParent.getElementById('grammalecte_conj_verb_info').textContent = oVerb.sInfo; this.xParent.getElementById('grammalecte_conj_opro').textContent = oVerb.sProLabel; if (oVerb.bUncomplete) { this.xParent.getElementById('grammalecte_conj_opro').checked = false; this.xParent.getElementById('grammalecte_conj_opro').disabled = true; this.xParent.getElementById('grammalecte_conj_opro_lbl').style = "color: #CCC;"; this.xParent.getElementById('grammalecte_conj_otco').checked = false; this.xParent.getElementById('grammalecte_conj_otco').disabled = true; this.xParent.getElementById('grammalecte_conj_otco_lbl').style = "color: #CCC;"; this.xParent.getElementById('grammalecte_conj_note').textContent = "Ce verbe n’a pas encore été vérifié. C’est pourquoi les options “pronominal” et “temps composés” sont désactivées."; } else { this.xParent.getElementById('grammalecte_conj_otco').disabled = false; this.xParent.getElementById('grammalecte_conj_otco_lbl').style = "color: #000;"; if (oVerb.nPronominable == 0) { this.xParent.getElementById('grammalecte_conj_opro').checked = false; this.xParent.getElementById('grammalecte_conj_opro').disabled = false; this.xParent.getElementById('grammalecte_conj_opro_lbl').style = "color: #000;"; } else if (oVerb.nPronominable == 1) { this.xParent.getElementById('grammalecte_conj_opro').checked = true; this.xParent.getElementById('grammalecte_conj_opro').disabled = true; this.xParent.getElementById('grammalecte_conj_opro_lbl').style = "color: #CCC;"; } else { // -1 or 1 or error this.xParent.getElementById('grammalecte_conj_opro').checked = false; this.xParent.getElementById('grammalecte_conj_opro').disabled = true; this.xParent.getElementById('grammalecte_conj_opro_lbl').style = "color: #CCC;"; } this.xParent.getElementById('grammalecte_conj_note').textContent = "❦"; } this._displayConj(oConjTable); } else { this.xParent.getElementById('grammalecte_conj_verb').style = "color: #BB4411;"; } } _displayConj (oConjTable) { if (oConjTable === null) { return; } try { this.xParent.getElementById('grammalecte_conj_verb').Text = ""; // infinitif this.xParent.getElementById('grammalecte_conj_infi').textContent = oConjTable["infi"] || " "; // something or nbsp // participe présent this.xParent.getElementById('grammalecte_conj_ppre').textContent = oConjTable["ppre"] || " "; // participes passés this.xParent.getElementById('grammalecte_conj_ppas1').textContent = oConjTable["ppas1"] || " "; this.xParent.getElementById('grammalecte_conj_ppas2').textContent = oConjTable["ppas2"] || " "; this.xParent.getElementById('grammalecte_conj_ppas3').textContent = oConjTable["ppas3"] || " "; this.xParent.getElementById('grammalecte_conj_ppas4').textContent = oConjTable["ppas4"] || " "; // impératif this.xParent.getElementById('grammalecte_conj_t_impe').textContent = oConjTable["t_impe"] || " "; this.xParent.getElementById('grammalecte_conj_impe1').textContent = oConjTable["impe1"] || " "; this.xParent.getElementById('grammalecte_conj_impe2').textContent = oConjTable["impe2"] || " "; this.xParent.getElementById('grammalecte_conj_impe3').textContent = oConjTable["impe3"] || " "; // présent this.xParent.getElementById('grammalecte_conj_t_ipre').textContent = oConjTable["t_ipre"] || " "; this.xParent.getElementById('grammalecte_conj_ipre1').textContent = oConjTable["ipre1"] || " "; this.xParent.getElementById('grammalecte_conj_ipre2').textContent = oConjTable["ipre2"] || " "; this.xParent.getElementById('grammalecte_conj_ipre3').textContent = oConjTable["ipre3"] || " "; this.xParent.getElementById('grammalecte_conj_ipre4').textContent = oConjTable["ipre4"] || " "; this.xParent.getElementById('grammalecte_conj_ipre5').textContent = oConjTable["ipre5"] || " "; this.xParent.getElementById('grammalecte_conj_ipre6').textContent = oConjTable["ipre6"] || " "; // imparfait this.xParent.getElementById('grammalecte_conj_t_iimp').textContent = oConjTable["t_iimp"] || " "; this.xParent.getElementById('grammalecte_conj_iimp1').textContent = oConjTable["iimp1"] || " "; this.xParent.getElementById('grammalecte_conj_iimp2').textContent = oConjTable["iimp2"] || " "; this.xParent.getElementById('grammalecte_conj_iimp3').textContent = oConjTable["iimp3"] || " "; this.xParent.getElementById('grammalecte_conj_iimp4').textContent = oConjTable["iimp4"] || " "; this.xParent.getElementById('grammalecte_conj_iimp5').textContent = oConjTable["iimp5"] || " "; this.xParent.getElementById('grammalecte_conj_iimp6').textContent = oConjTable["iimp6"] || " "; // passé simple this.xParent.getElementById('grammalecte_conj_t_ipsi').textContent = oConjTable["t_ipsi"] || " "; this.xParent.getElementById('grammalecte_conj_ipsi1').textContent = oConjTable["ipsi1"] || " "; this.xParent.getElementById('grammalecte_conj_ipsi2').textContent = oConjTable["ipsi2"] || " "; this.xParent.getElementById('grammalecte_conj_ipsi3').textContent = oConjTable["ipsi3"] || " "; this.xParent.getElementById('grammalecte_conj_ipsi4').textContent = oConjTable["ipsi4"] || " "; this.xParent.getElementById('grammalecte_conj_ipsi5').textContent = oConjTable["ipsi5"] || " "; this.xParent.getElementById('grammalecte_conj_ipsi6').textContent = oConjTable["ipsi6"] || " "; // futur this.xParent.getElementById('grammalecte_conj_t_ifut').textContent = oConjTable["t_ifut"] || " "; this.xParent.getElementById('grammalecte_conj_ifut1').textContent = oConjTable["ifut1"] || " "; this.xParent.getElementById('grammalecte_conj_ifut2').textContent = oConjTable["ifut2"] || " "; this.xParent.getElementById('grammalecte_conj_ifut3').textContent = oConjTable["ifut3"] || " "; this.xParent.getElementById('grammalecte_conj_ifut4').textContent = oConjTable["ifut4"] || " "; this.xParent.getElementById('grammalecte_conj_ifut5').textContent = oConjTable["ifut5"] || " "; this.xParent.getElementById('grammalecte_conj_ifut6').textContent = oConjTable["ifut6"] || " "; // Conditionnel this.xParent.getElementById('grammalecte_conj_t_conda').textContent = oConjTable["t_conda"] || " "; this.xParent.getElementById('grammalecte_conj_conda1').textContent = oConjTable["conda1"] || " "; this.xParent.getElementById('grammalecte_conj_conda2').textContent = oConjTable["conda2"] || " "; this.xParent.getElementById('grammalecte_conj_conda3').textContent = oConjTable["conda3"] || " "; this.xParent.getElementById('grammalecte_conj_conda4').textContent = oConjTable["conda4"] || " "; this.xParent.getElementById('grammalecte_conj_conda5').textContent = oConjTable["conda5"] || " "; this.xParent.getElementById('grammalecte_conj_conda6').textContent = oConjTable["conda6"] || " "; this.xParent.getElementById('grammalecte_conj_t_condb').textContent = oConjTable["t_condb"] || " "; this.xParent.getElementById('grammalecte_conj_condb1').textContent = oConjTable["condb1"] || " "; this.xParent.getElementById('grammalecte_conj_condb2').textContent = oConjTable["condb2"] || " "; this.xParent.getElementById('grammalecte_conj_condb3').textContent = oConjTable["condb3"] || " "; this.xParent.getElementById('grammalecte_conj_condb4').textContent = oConjTable["condb4"] || " "; this.xParent.getElementById('grammalecte_conj_condb5').textContent = oConjTable["condb5"] || " "; this.xParent.getElementById('grammalecte_conj_condb6').textContent = oConjTable["condb6"] || " "; // subjonctif présent this.xParent.getElementById('grammalecte_conj_t_spre').textContent = oConjTable["t_spre"] || " "; this.xParent.getElementById('grammalecte_conj_spre1').textContent = oConjTable["spre1"] || " "; this.xParent.getElementById('grammalecte_conj_spre2').textContent = oConjTable["spre2"] || " "; this.xParent.getElementById('grammalecte_conj_spre3').textContent = oConjTable["spre3"] || " "; this.xParent.getElementById('grammalecte_conj_spre4').textContent = oConjTable["spre4"] || " "; this.xParent.getElementById('grammalecte_conj_spre5').textContent = oConjTable["spre5"] || " "; this.xParent.getElementById('grammalecte_conj_spre6').textContent = oConjTable["spre6"] || " "; // subjonctif imparfait this.xParent.getElementById('grammalecte_conj_t_simp').textContent = oConjTable["t_simp"] || " "; this.xParent.getElementById('grammalecte_conj_simp1').textContent = oConjTable["simp1"] || " "; this.xParent.getElementById('grammalecte_conj_simp2').textContent = oConjTable["simp2"] || " "; this.xParent.getElementById('grammalecte_conj_simp3').textContent = oConjTable["simp3"] || " "; this.xParent.getElementById('grammalecte_conj_simp4').textContent = oConjTable["simp4"] || " "; this.xParent.getElementById('grammalecte_conj_simp5').textContent = oConjTable["simp5"] || " "; this.xParent.getElementById('grammalecte_conj_simp6').textContent = oConjTable["simp6"] || " "; } catch (e) { console.error(e.fileName + "\n" + e.name + "\nline: " + e.lineNumber + "\n" + e.message); } } } class GrammalecteTooltip { constructor (xParent, xGCPanelContent) { this.xParent = xParent; |
︙ | ︙ |
Modified gc_lang/fr/webext/gce_worker.js from [08f4a4604e] to [107e6c6733].
︙ | ︙ | |||
127 128 129 130 131 132 133 134 135 136 137 138 139 140 | break; case "setDictionaryOnOff": setDictionaryOnOff(dParam.sDictionary, dParam.bActivate, dInfo); break; case "getSpellSuggestions": getSpellSuggestions(dParam.sWord, dInfo); break; case "getListOfTokens": getListOfTokens(dParam.sText, dInfo); break; default: console.log("[Worker] Unknown command: " + sCommand); showData(e.data); } | > > > | 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 | break; case "setDictionaryOnOff": setDictionaryOnOff(dParam.sDictionary, dParam.bActivate, dInfo); break; case "getSpellSuggestions": getSpellSuggestions(dParam.sWord, dInfo); break; case "getVerb": getVerb(dParam.sVerb, dParam.bPro, dParam.bNeg, dParam.bTpsCo, dParam.bInt, dParam.bFem, dInfo); break; case "getListOfTokens": getListOfTokens(dParam.sText, dInfo); break; default: console.log("[Worker] Unknown command: " + sCommand); showData(e.data); } |
︙ | ︙ | |||
367 368 369 370 371 372 373 374 375 376 377 378 379 380 | let i = 0; for (let aSugg of oSpellChecker.suggest(sWord)) { postMessage(createResponse("getSpellSuggestions", {sWord: sWord, aSugg: aSugg, iSuggBlock: i}, dInfo, true)); i += 1; } } // Lexicographer function getListOfTokens (sText, dInfo={}) { try { sText = sText.replace(//g, "").normalize("NFC"); for (let sParagraph of text.getParagraph(sText)) { | > > > > > > > > > > > > > > > > > > > | 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 | let i = 0; for (let aSugg of oSpellChecker.suggest(sWord)) { postMessage(createResponse("getSpellSuggestions", {sWord: sWord, aSugg: aSugg, iSuggBlock: i}, dInfo, true)); i += 1; } } // Conjugueur function getVerb (sWord, bPro, bNeg, bTpsCo, bInt, bFem, dInfo) { try { let oVerb = null; let oConjTable = null; if (conj.isVerb(sWord)) { oVerb = new Verb(sWord); oConjTable = oVerb.createConjTable(bPro, bNeg, bTpsCo, bInt, bFem); } postMessage(createResponse("getVerb", { oVerb: oVerb, oConjTable: oConjTable }, dInfo, true)); } catch (e) { console.error(e); postMessage(createResponse("getVerb", createErrorResult(e, "no verb"), dInfo, true, true)); } } // Lexicographer function getListOfTokens (sText, dInfo={}) { try { sText = sText.replace(//g, "").normalize("NFC"); for (let sParagraph of text.getParagraph(sText)) { |
︙ | ︙ |
Modified gc_lang/fr/webext/manifest.json from [f7290722c6] to [2a849237d4].
︙ | ︙ | |||
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | "matches": ["<all_urls>"], "exclude_matches": [ "*://*.wikisource.org/*", "*://*.wikipedia.org/*", "*://*.wiktionary.org/*" ], "js": [ "content_scripts/panel.js", "grammalecte/fr/textformatter.js", "content_scripts/panel_tf.js", "content_scripts/panel_gc.js", "content_scripts/message_box.js", "content_scripts/menu.js", "content_scripts/init.js" ], "run_at": "document_end" }, { "matches": [ "*://*.wikisource.org/*", "*://*.wikipedia.org/*", "*://*.wiktionary.org/*" ], "js": [ "content_scripts/panel.js", "grammalecte/fr/textformatter.js", "content_scripts/panel_tf.js", "content_scripts/panel_gc.js", "content_scripts/panel_lxg.js", "content_scripts/menu.js", "content_scripts/init.js" | > > | 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | "matches": ["<all_urls>"], "exclude_matches": [ "*://*.wikisource.org/*", "*://*.wikipedia.org/*", "*://*.wiktionary.org/*" ], "js": [ "content_scripts/html_src.js", "content_scripts/panel.js", "grammalecte/fr/textformatter.js", "content_scripts/panel_tf.js", "content_scripts/panel_gc.js", "content_scripts/message_box.js", "content_scripts/menu.js", "content_scripts/init.js" ], "run_at": "document_end" }, { "matches": [ "*://*.wikisource.org/*", "*://*.wikipedia.org/*", "*://*.wiktionary.org/*" ], "js": [ "content_scripts/html_src.js", "content_scripts/panel.js", "grammalecte/fr/textformatter.js", "content_scripts/panel_tf.js", "content_scripts/panel_gc.js", "content_scripts/panel_lxg.js", "content_scripts/menu.js", "content_scripts/init.js" |
︙ | ︙ | |||
94 95 96 97 98 99 100 101 102 103 104 105 106 107 | }, "web_accessible_resources": [ "content_scripts/panel.css", "content_scripts/panel_tf.css", "content_scripts/panel_gc.css", "content_scripts/panel_lxg.css", "content_scripts/message_box.css", "content_scripts/menu.css", "grammalecte/graphspell/_dictionaries/fr-allvars.json", "grammalecte/graphspell/_dictionaries/fr-classic.json", "grammalecte/graphspell/_dictionaries/fr-reform.json", "grammalecte/fr/conj_data.json", "grammalecte/fr/mfsp_data.json", | > | 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 | }, "web_accessible_resources": [ "content_scripts/panel.css", "content_scripts/panel_tf.css", "content_scripts/panel_gc.css", "content_scripts/panel_lxg.css", "content_scripts/panel_conj.css", "content_scripts/message_box.css", "content_scripts/menu.css", "grammalecte/graphspell/_dictionaries/fr-allvars.json", "grammalecte/graphspell/_dictionaries/fr-classic.json", "grammalecte/graphspell/_dictionaries/fr-reform.json", "grammalecte/fr/conj_data.json", "grammalecte/fr/mfsp_data.json", |
︙ | ︙ |