Index: gc_lang/fr/webext/gce_worker.js ================================================================== --- gc_lang/fr/webext/gce_worker.js +++ gc_lang/fr/webext/gce_worker.js @@ -166,16 +166,13 @@ //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) { - console.log(dOptions); gc_engine.setOptions(dOptions); } //tests(); bInitDone = true; } else { Index: gc_lang/fr/webext/panel/main.js ================================================================== --- gc_lang/fr/webext/panel/main.js +++ gc_lang/fr/webext/panel/main.js @@ -103,11 +103,11 @@ case "textToTest": case "fullTests": showTestResult(result); break; case "resetOptions": - setGCOptions(result); + displayGCOptions(result); break; default: console.log("GRAMMALECTE. Unknown command: " + sActionDone); } //sendResponse({sCommand: "none", result: "done"}); @@ -127,14 +127,14 @@ xNodePage.style.display = "none"; } // show the selected one document.getElementById(sPageName).style.display = "block"; if (sPageName == "gc_options_page") { - setGCOptionsFromStorage(); + displayGCOptionsLoadedFromStorage(); } else if (sPageName == "ui_options_page") { - setUIOptionsFromStorage(); + displayUIOptionsLoadedFromStorage(); } } catch (e) { showError(e); } @@ -161,20 +161,20 @@ /* UI options */ -function setUIOptionsFromStorage () { +function displayUIOptionsLoadedFromStorage () { if (bChrome) { - browser.storage.local.get("ui_options", setUIOptions); + browser.storage.local.get("ui_options", displayUIOptions); return; } let xPromise = browser.storage.local.get("ui_options"); - xPromise.then(setUIOptions, showError); + xPromise.then(displayUIOptions, showError); } -function setUIOptions (dOptions) { +function displayUIOptions (dOptions) { if (!dOptions.hasOwnProperty("ui_options")) { console.log("no ui options found"); return; } dOptions = dOptions.ui_options; @@ -194,26 +194,26 @@ /* GC options */ -function setGCOptionsFromStorage () { +function displayGCOptionsLoadedFromStorage () { if (bChrome) { - browser.storage.local.get("gc_options", _setGCOptions); + browser.storage.local.get("gc_options", _displayGCOptions); return; } let xPromise = browser.storage.local.get("gc_options"); - xPromise.then(_setGCOptions, showError); + xPromise.then(_displayGCOptions, showError); } -function _setGCOptions (dSavedOptions) { +function _displayGCOptions (dSavedOptions) { if (dSavedOptions.hasOwnProperty("gc_options")) { - setGCOptions(dSavedOptions.gc_options); + displayGCOptions(dSavedOptions.gc_options); } } -function setGCOptions (dOptions) { +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); @@ -223,9 +223,9 @@ document.getElementById("option_"+sOpt).checked = bVal; } } } catch (e) { - console.log(dOptions); showError(e); + console.log(dOptions); } }