43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
+
-
-
-
-
-
+
+
+
+
+
+
|
browser.runtime.sendMessage({
sCommand: "resetOptions",
dParam: {},
dInfo: {}
});
}
else if (xElem.id.startsWith("option_")) {
if (xElem.dataset.option) {
browser.runtime.sendMessage({
sCommand: "setOption",
dParam: {sOptName: xElem.dataset.option, bValue: xElem.checked},
dInfo: {}
});
browser.runtime.sendMessage({
sCommand: "setOption",
dParam: {sOptName: xElem.dataset.option, bValue: xElem.checked},
dInfo: {}
});
}
}
else if (xElem.id.startsWith("ui_option_")) {
storeUIOptions();
}
else if (xElem.id.startsWith("link_")) {
browser.tabs.create({url: xElem.dataset.url});
}
|
152
153
154
155
156
157
158
159
160
161
162
163
164
165
|
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
|
+
+
+
+
+
+
+
+
+
+
+
+
+
|
}
let xConjTab = browser.tabs.create({
url: browser.extension.getURL("panel/conjugueur.html")
});
xConjTab.then(onCreated, onError);
}
function openConjugueurTab () {
if (bChrome) {
browser.tabs.create({
url: browser.extension.getURL("panel/conjugueur.html")
});
return;
}
let xConjTab = browser.tabs.create({
url: browser.extension.getURL("panel/conjugueur.html")
});
xConjTab.then(onCreated, onError);
}
/*
UI options
*/
function setUIOptionsFromStorage () {
if (bChrome) {
|
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
|
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
|
+
-
-
-
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
|
function _setGCOptions (dSavedOptions) {
if (dSavedOptions.hasOwnProperty("gc_options")) {
setGCOptions(dSavedOptions.gc_options);
}
}
function setGCOptions (dOptions) {
try {
// dOptions is supposed to be a Map
if (bChrome) {
// JS crap again. Chrome can’t store/send Map object.
// dOptions is supposed to be a Map
if (bChrome) {
// JS crap again. Chrome can’t store/send Map object.
let m = new Map();
for (let param in dOptions) {
m.set(param, dOptions[param]);
}
dOptions = m;
}
for (let [sOpt, bVal] of dOptions) {
if (document.getElementById("option_"+sOpt)) {
document.getElementById("option_"+sOpt).checked = bVal;
}
}
}
dOptions = helpers.objectToMap(dOptions);
}
for (let [sOpt, bVal] of dOptions) {
if (document.getElementById("option_"+sOpt)) {
document.getElementById("option_"+sOpt).checked = bVal;
}
}
}
catch (e) {
console.log(dOptions);
showError(e);
}
}
|