58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
}
browser.runtime.sendMessage(e.data);
break;
case "setOptions":
case "setOption":
storeGCOptions(result);
break;
default:
console.log("[background] Unknown command: " + sActionDone);
console.log(e.data);
}
}
catch (e) {
showError(e);
|
>
>
>
|
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
}
browser.runtime.sendMessage(e.data);
break;
case "setOptions":
case "setOption":
storeGCOptions(result);
break;
case "setDictionary":
console.log("[background] " + sActionDone + ": " + result);
break;
default:
console.log("[background] Unknown command: " + sActionDone);
console.log(e.data);
}
}
catch (e) {
showError(e);
|
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
|
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;
}
browser.storage.local.get("gc_options").then(initGrammarChecker, showError);
browser.storage.local.get("ui_options").then(initUIOptions, showError);
}
init();
browser.runtime.onInstalled.addListener(function (oDetails) {
// launched at installation or update
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
|
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 setSpellingDictionary (dSavedDictionary) {
if (dSavedDictionary.hasOwnProperty("oExtendedDictionary")) {
xGCEWorker.postMessage({
sCommand: "setDictionary",
dParam: { sType: "extended", oDict: dSavedDictionary["oExtendedDictionary"] },
dInfo: {}
});
}
else if (dSavedDictionary.hasOwnProperty("oPersonalDictionary")) {
xGCEWorker.postMessage({
sCommand: "setDictionary",
dParam: { sType: "personal", oDict: dSavedDictionary["oPersonalDictionary"] },
dInfo: {}
});
}
}
function init () {
if (bChrome) {
browser.storage.local.get("gc_options", initGrammarChecker);
browser.storage.local.get("ui_options", initUIOptions);
browser.storage.local.get("oExtendedDictionary", setSpellingDictionary);
browser.storage.local.get("oPersonalDictionary", setSpellingDictionary);
return;
}
browser.storage.local.get("gc_options").then(initGrammarChecker, showError);
browser.storage.local.get("ui_options").then(initUIOptions, showError);
browser.storage.local.get("oExtendedDictionary").then(setSpellingDictionary, showError);
browser.storage.local.get("oPersonalDictionary").then(setSpellingDictionary, showError);
}
init();
browser.runtime.onInstalled.addListener(function (oDetails) {
// launched at installation or update
|
131
132
133
134
135
136
137
138
139
140
141
142
143
144
|
case "getOptions":
case "getDefaultOptions":
case "setOptions":
case "setOption":
case "resetOptions":
case "textToTest":
case "fullTests":
xGCEWorker.postMessage(oRequest);
break;
case "openURL":
browser.tabs.create({url: dParam.sURL});
break;
default:
console.log("[background] Unknown command: " + sCommand);
|
>
|
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
|
case "getOptions":
case "getDefaultOptions":
case "setOptions":
case "setOption":
case "resetOptions":
case "textToTest":
case "fullTests":
case "setDictionary":
xGCEWorker.postMessage(oRequest);
break;
case "openURL":
browser.tabs.create({url: dParam.sURL});
break;
default:
console.log("[background] Unknown command: " + sCommand);
|