Overview
Comment: | [core][fx][tb][js] use colors defined by the rules file (+bugs fixed) |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk | core | tb | fx |
Files: | files | file ages | folders |
SHA3-256: |
05735bba7bbaea292d870a3995cb06a4 |
User & Date: | olr on 2018-09-25 16:06:16 |
Other Links: | manifest | tags |
Context
2018-09-25
| ||
16:19 | [fr] màj couleurs check-in: 634ca30225 user: olr tags: trunk, fr | |
16:06 | [core][fx][tb][js] use colors defined by the rules file (+bugs fixed) check-in: 05735bba7b user: olr tags: trunk, core, tb, fx | |
15:51 | [core][py] gc engine: no color by default (type is not certain) check-in: cdb1937a91 user: olr tags: trunk, core | |
Changes
Modified gc_core/js/lang_core/gc_engine.js from [bbb0967ee1] to [e6dde271f2].
︙ | ︙ | |||
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 | return aNew; } // data let _sAppContext = ""; // what software is running let _dOptions = null; let _oSpellChecker = null; let _oTokenizer = null; let _aIgnoredRules = new Set(); var gc_engine = { //// Informations lang: "${lang}", locales: ${loc}, pkg: "${implname}", name: "${name}", version: "${version}", author: "${author}", //// Initialization | > | > | 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 | return aNew; } // data let _sAppContext = ""; // what software is running let _dOptions = null; let _dOptionsColors = null; let _oSpellChecker = null; let _oTokenizer = null; let _aIgnoredRules = new Set(); var gc_engine = { //// Informations lang: "${lang}", locales: ${loc}, pkg: "${implname}", name: "${name}", version: "${version}", author: "${author}", //// Initialization load: function (sContext="JavaScript", sColorType="aRGB", sPath="") { try { if (typeof(require) !== 'undefined') { var spellchecker = require("resource://grammalecte/graphspell/spellchecker.js"); _oSpellChecker = new spellchecker.SpellChecker("${lang}", "", "${dic_main_filename_js}", "${dic_extended_filename_js}", "${dic_community_filename_js}", "${dic_personal_filename_js}"); } else { _oSpellChecker = new SpellChecker("${lang}", sPath, "${dic_main_filename_js}", "${dic_extended_filename_js}", "${dic_community_filename_js}", "${dic_personal_filename_js}"); } _sAppContext = sContext; _dOptions = gc_options.getOptions(sContext).gl_shallowCopy(); // duplication necessary, to be able to reset to default _dOptionsColors = gc_options.getOptionsColors(sContext, sColorType); _oTokenizer = _oSpellChecker.getTokenizer(); _oSpellChecker.activateStorage(); } catch (e) { console.error(e); } }, |
︙ | ︙ | |||
748 749 750 751 752 753 754 755 756 757 758 759 760 761 | _createError (nStart, nEnd, sLineId, sRuleId, sOption, sMessage, lSugg, sURL, bContext) { let oErr = { "nStart": nStart, "nEnd": nEnd, "sLineId": sLineId, "sRuleId": sRuleId, "sType": sOption || "notype", "sMessage": sMessage, "aSuggestions": lSugg, "URL": sURL } if (bContext) { oErr['sUnderlined'] = this.sText0.slice(nStart, nEnd); oErr['sBefore'] = this.sText0.slice(Math.max(0,nStart-80), nStart); | > | 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 | _createError (nStart, nEnd, sLineId, sRuleId, sOption, sMessage, lSugg, sURL, bContext) { let oErr = { "nStart": nStart, "nEnd": nEnd, "sLineId": sLineId, "sRuleId": sRuleId, "sType": sOption || "notype", "aColor": _dOptionsColors[sOption], "sMessage": sMessage, "aSuggestions": lSugg, "URL": sURL } if (bContext) { oErr['sUnderlined'] = this.sText0.slice(nStart, nEnd); oErr['sBefore'] = this.sText0.slice(Math.max(0,nStart-80), nStart); |
︙ | ︙ |
Modified gc_core/js/lang_core/gc_options.js from [7c4c47e8f5] to [aa3f5d62cd].
︙ | ︙ | |||
10 11 12 13 14 15 16 | if (this.dOpt.hasOwnProperty(sContext)) { return this.dOpt[sContext]; } return this.dOpt["JavaScript"]; }, getOptionsColors: function (sTheme="Default", sColorType="aRGB") { | | | < | 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | if (this.dOpt.hasOwnProperty(sContext)) { return this.dOpt[sContext]; } return this.dOpt["JavaScript"]; }, getOptionsColors: function (sTheme="Default", sColorType="aRGB") { let dOptColor = (this.dOptColor.hasOwnProperty(sTheme)) ? this.dOptColor[sTheme] : this.dOptColor["Default"]; let dColorType = (this.dColorType.hasOwnProperty(sColorType)) ? this.dColorType[sColorType] : this.dColorType["aRGB"]; let dColor = {}; try { for (let [sOpt, sColor] of Object.entries(dOptColor)) { dColor[sOpt] = dColorType[sColor]; } return dColor; } catch (e) { console.error(e); return {} } }, |
︙ | ︙ |
Modified gc_lang/fr/tb/content/overlay.css from [8c73a24356] to [89e250c93b].
︙ | ︙ | |||
134 135 136 137 138 139 140 | cursor: pointer; } .debug_info { color: hsl(0, 50%, 50%); font-style: italic; } | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 | cursor: pointer; } .debug_info { color: hsl(0, 50%, 50%); font-style: italic; } .spell { background-color: hsl(0, 50%, 50%); color: hsl(0, 0%, 96%); border-radius: 3px; } /* TB Next: fix dialogheaders */ dialogheader { -moz-binding: url("chrome://messenger/content/generalBindings.xml#dialogheader"); margin: 0 5px 5px; |
︙ | ︙ |
Modified gc_lang/fr/tb/content/overlay.js from [7e5b745ad7] to [df736903aa].
︙ | ︙ | |||
220 221 222 223 224 225 226 | for (let dErr of aGrammErr) { let nStart = dErr["nStart"]; let nEnd = dErr["nEnd"]; if (nStart >= nEndLastErr) { xParagraphNode.appendChild(document.createTextNode(this._purgeTags(sParagraph.slice(nEndLastErr, nStart)))); let xNodeError = document.createElement("b"); if (dErr['sType'] !== 'WORD') { | | > | 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 | for (let dErr of aGrammErr) { let nStart = dErr["nStart"]; let nEnd = dErr["nEnd"]; if (nStart >= nEndLastErr) { xParagraphNode.appendChild(document.createTextNode(this._purgeTags(sParagraph.slice(nEndLastErr, nStart)))); let xNodeError = document.createElement("b"); if (dErr['sType'] !== 'WORD') { xNodeError.setAttribute("class", "error"); xNodeError.textContent = oConverterToExponent.convert(nError.toString()) + sParagraph.slice(nStart, nEnd); xNodeError.style.backgroundColor = dErr["aColor"]; xParagraphNode.appendChild(xNodeError); lNodeError.push(this._createNodeGCErrorDescription(xEditor, nError, dErr, iParagraph)); } else { xNodeError.setAttribute("class", "error spell"); xNodeError.textContent = oConverterToExponent.convert(nError.toString()) + sParagraph.slice(nStart, nEnd); xParagraphNode.appendChild(xNodeError); |
︙ | ︙ |
Modified gc_lang/fr/tb/worker/gce_worker.js from [f3dbabaa73] to [086c0afb9f].
︙ | ︙ | |||
59 60 61 62 63 64 65 | try { gce = require("resource://grammalecte/fr/gc_engine.js"); helpers = require("resource://grammalecte/graphspell/helpers.js"); text = require("resource://grammalecte/text.js"); tkz = require("resource://grammalecte/graphspell/tokenizer.js"); //lxg = require("resource://grammalecte/fr/lexicographe.js"); oTokenizer = new tkz.Tokenizer("fr"); | | | 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | try { gce = require("resource://grammalecte/fr/gc_engine.js"); helpers = require("resource://grammalecte/graphspell/helpers.js"); text = require("resource://grammalecte/text.js"); tkz = require("resource://grammalecte/graphspell/tokenizer.js"); //lxg = require("resource://grammalecte/fr/lexicographe.js"); oTokenizer = new tkz.Tokenizer("fr"); gce.load(sContext, "sCSS"); oSpellChecker = gce.getSpellChecker(); if (sGCOptions !== "") { gce.setOptions(helpers.objectToMap(JSON.parse(sGCOptions))); } // we always retrieve options from the gce, for setOptions filters obsolete options return gce.getOptions().gl_toString(); } |
︙ | ︙ |
Modified gc_lang/fr/webext/content_scripts/panel_gc.css from [4ec3ab92b0] to [755062f1e5].
︙ | ︙ | |||
245 246 247 248 249 250 251 | text-shadow: unset; text-align: left; hyphens: none; } mark.grammalecte_error_ignored { background-color: hsla(30, 20%, 80%, 1); } | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 245 246 247 248 249 250 251 | text-shadow: unset; text-align: left; hyphens: none; } mark.grammalecte_error_ignored { background-color: hsla(30, 20%, 80%, 1); } |
Modified gc_lang/fr/webext/content_scripts/panel_gc.js from [1162a03a3e] to [271c87ea03].
︙ | ︙ | |||
184 185 186 187 188 189 190 | 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("|"); } | | > | 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 | 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("|"); } xNodeErr.className = (this.aIgnoredErrors.has(xNodeErr.dataset.ignored_key)) ? "grammalecte_error_ignored" : "grammalecte_error"; xNodeErr.style.backgroundColor = (oErr['sType'] === "WORD") ? "hsl(0, 50%, 50%)" : oErr["aColor"]; return xNodeErr; } blockParagraph (xParagraph) { xParagraph.contentEditable = "false"; document.getElementById("grammalecte_check"+xParagraph.dataset.para_num).textContent = "Analyse…"; document.getElementById("grammalecte_check"+xParagraph.dataset.para_num).style.backgroundColor = "hsl(0, 50%, 50%)"; |
︙ | ︙ |
Modified gc_lang/fr/webext/gce_worker.js from [49bb10d99d] to [f9f8b2256b].
︙ | ︙ | |||
164 165 166 167 168 169 170 | try { if (!bInitDone) { //console.log("[Worker] Loading… Extension path: " + sExtensionPath); conj.init(helpers.loadFile(sExtensionPath + "/grammalecte/fr/conj_data.json")); phonet.init(helpers.loadFile(sExtensionPath + "/grammalecte/fr/phonet_data.json")); mfsp.init(helpers.loadFile(sExtensionPath + "/grammalecte/fr/mfsp_data.json")); //console.log("[Worker] Modules have been initialized…"); | | | 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 | try { if (!bInitDone) { //console.log("[Worker] Loading… Extension path: " + sExtensionPath); conj.init(helpers.loadFile(sExtensionPath + "/grammalecte/fr/conj_data.json")); phonet.init(helpers.loadFile(sExtensionPath + "/grammalecte/fr/phonet_data.json")); mfsp.init(helpers.loadFile(sExtensionPath + "/grammalecte/fr/mfsp_data.json")); //console.log("[Worker] Modules have been initialized…"); gc_engine.load(sContext, "sCSS", sExtensionPath+"grammalecte/graphspell/_dictionaries"); oSpellChecker = gc_engine.getSpellChecker(); oTest = new TestGrammarChecking(gc_engine, sExtensionPath+"/grammalecte/fr/tests_data.json"); oTokenizer = new Tokenizer("fr"); oLocution = helpers.loadFile(sExtensionPath + "/grammalecte/fr/locutions_data.json"); oLxg = new Lexicographe(oSpellChecker, oTokenizer, oLocution); if (dOptions !== null) { if (!(dOptions instanceof Map)) { |
︙ | ︙ |