1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
// Options for Grammalecte
/* jshint esversion:6 */
/* jslint esversion:6 */
/* global exports */
${map}
var gc_options = {
getOptions: function (sContext="JavaScript") {
if (this.dOpt.hasOwnProperty(sContext)) {
return this.dOpt[sContext];
}
return this.dOpt["JavaScript"];
},
getOptionsColors: function (sTheme="Default", sColorType="aRGB") {
let dOptColor = (this.dOptColor.hasOwnProperty(sTheme)) ? this.dOptColor[sTheme] : this.dOptColor["Default"];
let dColorType = (this.dColorType.hasOwnProperty(sColorType)) ? this.dColorType[sColorType] : this.dColorType["aRGB"];
let dColor = {};
try {
for (let [sOpt, sColor] of Object.entries(dOptColor)) {
dColor[sOpt] = dColorType[sColor];
}
return dColor;
}
catch (e) {
console.error(e);
return {};
}
},
lStructOpt: ${lStructOpt},
dOpt: {
"JavaScript": new Map (${dOptJavaScript}),
"Firefox": new Map (${dOptFirefox}),
"Thunderbird": new Map (${dOptThunderbird}),
},
dColorType: ${dColorType},
dOptColor: ${dOptColor},
dOptLabel: ${dOptLabel}
};
if (typeof(exports) !== 'undefined') {
exports.getOptions = gc_options.getOptions;
exports.getOptionsColors = gc_options.getOptionsColors;
exports.lStructOpt = gc_options.lStructOpt;
exports.dOpt = gc_options.dOpt;
exports.dColorType = gc_options.dColorType;
exports.dOptColor = gc_options.dOptColor;
exports.dOptLabel = gc_options.dOptLabel;
}
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
|
>
>
>
>
>
>
>
|
|
|
|
|
|
|
|
|
|
|
|
>
>
>
>
>
>
>
|
|
|
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
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
|
// Options for Grammalecte
/* jshint esversion:6 */
/* jslint esversion:6 */
/* global exports */
${map}
var gc_options = {
dOptions: new Map(),
sAppContext: "JavaScript",
load: function (sContext="JavaScript") {
this.sAppContext = sContext;
this.dOptions = this.getDefaultOptions(sContext);
},
setOption: function (sOpt, bVal) {
if (this.dOptions.has(sOpt)) {
this.dOptions.set(sOpt, bVal);
}
},
setOptions: function (dOpt) {
this.dOptions.gl_updateOnlyExistingKeys(dOpt);
},
getOptions: function () {
return this.dOptions.gl_shallowCopy();
},
resetOptions: function () {
this.dOptions = this.getDefaultOptions(this._sAppContext);
},
getDefaultOptions: function (sContext="") {
if (!sContext) {
sContext = this.sAppContext;
}
if (this.oDefaultOpt.hasOwnProperty(sContext)) {
return this.oDefaultOpt[sContext].gl_shallowCopy();
}
return this.oDefaultOpt["JavaScript"].gl_shallowCopy();
},
getOptionLabels: function (sLang="${sLang}") {
if (this.oOptLabel.hasOwnProperty(sLang)) {
return this.oOptLabel[sLang];
}
return this.oOptLabel["{$sLang}"];
},
getOptionsColors: function (sTheme="Default", sColorType="aRGB") {
let oOptColor = (this.oOptColor.hasOwnProperty(sTheme)) ? this.oOptColor[sTheme] : this.oOptColor["Default"];
let oColorType = (this.oColorType.hasOwnProperty(sColorType)) ? this.oColorType[sColorType] : this.oColorType["aRGB"];
let oColor = {};
try {
for (let [sOpt, sColor] of Object.entries(oOptColor)) {
oColor[sOpt] = oColorType[sColor];
}
return oColor;
}
catch (e) {
console.error(e);
return {};
}
},
lStructOpt: ${lStructOpt},
oDefaultOpt: {
"JavaScript": new Map (${dOptJavaScript}),
"Firefox": new Map (${dOptFirefox}),
"Thunderbird": new Map (${dOptThunderbird}),
},
oColorType: ${dColorType},
oOptColor: ${dOptColor},
oOptLabel: ${dOptLabel}
};
if (typeof(exports) !== 'undefined') {
exports.dOptions = gc_options.dOptions;
exports.sAppContext = gc_options.sAppContext;
exports.load = gc_options.load;
exports.setOption = gc_options.setOption;
exports.setOptions = gc_options.setOptions;
exports.resetOptions = gc_options.resetOptions;
exports.getDefaultOptions = gc_options.getDefaultOptions;
exports.getOptions = gc_options.getOptions;
exports.getOptionsColors = gc_options.getOptionsColors;
exports.lStructOpt = gc_options.lStructOpt;
exports.oDefaultOpt = gc_options.oDefaultOpt;
exports.dColorType = gc_options.dColorType;
exports.oOptColor = gc_options.oOptColor;
exports.oOptLabel = gc_options.oOptLabel;
}
|