Grammalecte  Diff

Differences From Artifact [bec0f2d48c]:

To Artifact [f6d1815bfa]:


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
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







+
+
+
+
+
+
+
+
+













+


-
+
-
-
-
-
+
-
-
-
-
-
-
-







                console.log(e.data);
        }
    }
    catch (e) {
        showError(e);
    }
};

function initUIOptions (dSavedOptions) {
    if (!dSavedOptions.hasOwnProperty("ui_options")) {
        browser.storage.local.set({"ui_options": {
            textarea: true,
            editablenode: false
        }});
    }
}

function initGrammarChecker (dSavedOptions) {
    let dOptions = (dSavedOptions.hasOwnProperty("gc_options")) ? dSavedOptions.gc_options : null;
    xGCEWorker.postMessage({
        sCommand: "init",
        dParam: {sExtensionPath: browser.extension.getURL(""), dOptions: dOptions, sContext: "Firefox"},
        dInfo: {}
    });
}

function init () {
    if (bChrome) {
        browser.storage.local.get("gc_options", initGrammarChecker);
        browser.storage.local.get("ui_options", initUIOptions);
        return;
    }
    let xPromise = browser.storage.local.get("gc_options");
    browser.storage.local.get("gc_options").then(initGrammarChecker, showError);
    xPromise.then(
        initGrammarChecker,
        function (e) {
            showError(e);
    browser.storage.local.get("ui_options").then(initUIOptions, showError);
            xGCEWorker.postMessage({
                sCommand: "init",
                dParam: {sExtensionPath: browser.extension.getURL("."), dOptions: null, sContext: "Firefox"},
                dInfo: {}
            });
        }
    );
}

init();


/*
    Ports from content-scripts