Grammalecte  Diff

Differences From Artifact [9a8dec5f0d]:

To Artifact [57b0e4a29a]:


1
2
3
4
5
6
7
8
9
10
11

12
13

14
15
16
17
18
19
20
// Main panel

"use strict";


function showError (e) {
    console.error(e.fileName + "\n" + e.name + "\nline: " + e.lineNumber + "\n" + e.message);
}

// Chrome don’t follow the W3C specification:
// https://browserext.github.io/browserext/

if (typeof(browser) !== "object") {
    var browser = chrome;

}


/*
    Events
*/
window.addEventListener(











>


>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// Main panel

"use strict";


function showError (e) {
    console.error(e.fileName + "\n" + e.name + "\nline: " + e.lineNumber + "\n" + e.message);
}

// Chrome don’t follow the W3C specification:
// https://browserext.github.io/browserext/
let bChrome = false;
if (typeof(browser) !== "object") {
    var browser = chrome;
    bChrome = true;
}


/*
    Events
*/
window.addEventListener(
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
    }
}


function showTestResult (sText) {
    document.getElementById("tests_result").textContent = sText;
}


function setGCOptionsFromStorage () {




    let xPromise = browser.storage.local.get("gc_options");
    xPromise.then(


        function (dSavedOptions) {
            if (dSavedOptions.hasOwnProperty("gc_options")) {
                setGCOptions(dSavedOptions.gc_options);
            }
        },
        function (e) {
            showError(e);
        }
    );
}

function setGCOptions (dOptions) {

    for (let [sOpt, bVal] of dOptions) {
        if (document.getElementById("option_"+sOpt)) {
            document.getElementById("option_"+sOpt).checked = bVal;
        }
    }
}








>

>
>
>
>

|
>
>
|
|
|
|
<
<
<
<
<



>






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


function showTestResult (sText) {
    document.getElementById("tests_result").textContent = sText;
}


function setGCOptionsFromStorage () {
    if (bChrome) {
        browser.storage.local.get("gc_options", _setGCOptions);
        return;
    }
    let xPromise = browser.storage.local.get("gc_options");
    xPromise.then(_setGCOptions, showError);
}

function _setGCOptions (dSavedOptions) {
    if (dSavedOptions.hasOwnProperty("gc_options")) {
        setGCOptions(dSavedOptions.gc_options);
    }





}

function setGCOptions (dOptions) {
    console.log(dOptions);
    for (let [sOpt, bVal] of dOptions) {
        if (document.getElementById("option_"+sOpt)) {
            document.getElementById("option_"+sOpt).checked = bVal;
        }
    }
}