Overview
Comment: | [fx] main panel: better functions name |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk | fx |
Files: | files | file ages | folders |
SHA3-256: |
07d0ec19f522902e6802faee8ecac854 |
User & Date: | olr on 2018-03-07 13:57:07 |
Other Links: | manifest | tags |
Context
2018-03-07
| ||
15:23 | [fx][bug] JS sucks: don’t store Map object in storage check-in: 4124e27218 user: olr tags: trunk, fx | |
13:57 | [fx] main panel: better functions name check-in: 07d0ec19f5 user: olr tags: trunk, fx | |
13:41 | [fx][bug] workaround for weird bug (from Firefox?) while loading gc_options which may be an empty object check-in: 0eeca06c55 user: olr tags: trunk, fx | |
Changes
Modified gc_lang/fr/webext/gce_worker.js from [0e6bb7b841] to [0220235f9e].
︙ | ︙ | |||
164 165 166 167 168 169 170 | 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, sExtensionPath+"grammalecte/graphspell/_dictionaries"); oSpellChecker = gc_engine.getSpellChecker(); oTest = new TestGrammarChecking(gc_engine, sExtensionPath+"/grammalecte/fr/tests_data.json"); oTokenizer = new Tokenizer("fr"); | < < < | 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 | 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, 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) { gc_engine.setOptions(dOptions); } //tests(); bInitDone = true; } else { console.log("[Worker] Already initialized…") } |
︙ | ︙ |
Modified gc_lang/fr/webext/panel/main.js from [82866d8fd8] to [3a6b7ee35a].
︙ | ︙ | |||
101 102 103 104 105 106 107 | let {sActionDone, result, dInfo, bEnd, bError} = oMessage; switch(sActionDone) { case "textToTest": case "fullTests": showTestResult(result); break; case "resetOptions": | | | 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 | let {sActionDone, result, dInfo, bEnd, bError} = oMessage; switch(sActionDone) { case "textToTest": case "fullTests": showTestResult(result); break; case "resetOptions": displayGCOptions(result); break; default: console.log("GRAMMALECTE. Unknown command: " + sActionDone); } //sendResponse({sCommand: "none", result: "done"}); } |
︙ | ︙ | |||
125 126 127 128 129 130 131 | // hide them all for (let xNodePage of document.getElementsByClassName("page")) { xNodePage.style.display = "none"; } // show the selected one document.getElementById(sPageName).style.display = "block"; if (sPageName == "gc_options_page") { | | | | 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 | // hide them all for (let xNodePage of document.getElementsByClassName("page")) { xNodePage.style.display = "none"; } // show the selected one document.getElementById(sPageName).style.display = "block"; if (sPageName == "gc_options_page") { displayGCOptionsLoadedFromStorage(); } else if (sPageName == "ui_options_page") { displayUIOptionsLoadedFromStorage(); } } catch (e) { showError(e); } } |
︙ | ︙ | |||
159 160 161 162 163 164 165 | } /* UI options */ | | | | | | 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 | } /* UI options */ function displayUIOptionsLoadedFromStorage () { if (bChrome) { browser.storage.local.get("ui_options", displayUIOptions); return; } let xPromise = browser.storage.local.get("ui_options"); xPromise.then(displayUIOptions, showError); } function displayUIOptions (dOptions) { if (!dOptions.hasOwnProperty("ui_options")) { console.log("no ui options found"); return; } dOptions = dOptions.ui_options; for (let sOpt in dOptions) { if (document.getElementById("ui_option_"+sOpt)) { |
︙ | ︙ | |||
192 193 194 195 196 197 198 | }}); } /* GC options */ | | | | | | | < > | 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 | }}); } /* GC options */ function displayGCOptionsLoadedFromStorage () { if (bChrome) { browser.storage.local.get("gc_options", _displayGCOptions); return; } let xPromise = browser.storage.local.get("gc_options"); xPromise.then(_displayGCOptions, showError); } function _displayGCOptions (dSavedOptions) { if (dSavedOptions.hasOwnProperty("gc_options")) { displayGCOptions(dSavedOptions.gc_options); } } function displayGCOptions (dOptions) { try { // dOptions is supposed to be a Map if (bChrome) { // JS crap again. Chrome can’t store/send Map object. dOptions = helpers.objectToMap(dOptions); } for (let [sOpt, bVal] of dOptions) { if (document.getElementById("option_"+sOpt)) { document.getElementById("option_"+sOpt).checked = bVal; } } } catch (e) { showError(e); console.log(dOptions); } } |