1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
// Grammalecte - Suggestion phonétique
if (typeof(require) !== 'undefined') {
var helpers = require("resource://grammalecte/helpers.js");
}
var phonet = {
_dWord: new Map(),
_lSet: [],
_dMorph: new Map(),
init: function (sJSONData) {
try {
let _oData = JSON.parse(sJSONData);
this._dWord = helpers.objectToMap(_oData.dWord);
this._lSet = _oData.lSet;
this._dMorph = helpers.objectToMap(_oData.dMorph);
}
|
>
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
// Grammalecte - Suggestion phonétique
if (typeof(require) !== 'undefined') {
var helpers = require("resource://grammalecte/helpers.js");
}
var phonet = {
_dWord: new Map(),
_lSet: [],
_dMorph: new Map(),
isInit: false,
init: function (sJSONData) {
try {
let _oData = JSON.parse(sJSONData);
this._dWord = helpers.objectToMap(_oData.dWord);
this._lSet = _oData.lSet;
this._dMorph = helpers.objectToMap(_oData.dMorph);
}
|
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
|
}
return aSelect;
}
};
// Initialization
if (typeof(browser) !== 'undefined') {
// WebExtension
phonet.init(helpers.loadFile(browser.extension.getURL("grammalecte/fr/phonet_data.json")));
} else if (typeof(require) !== 'undefined') {
// Add-on SDK and Thunderbird
phonet.init(helpers.loadFile("resource://grammalecte/fr/phonet_data.json"));
} else {
console.log("Module phonet non initialisé");
}
if (typeof(exports) !== 'undefined') {
exports._dWord = phonet._dWord;
|
|
|
>
>
|
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
|
}
return aSelect;
}
};
// Initialization
if (!phonet.isInit && typeof(browser) !== 'undefined') {
// WebExtension
phonet.init(helpers.loadFile(browser.extension.getURL("grammalecte/fr/phonet_data.json")));
} else if (!phonet.isInit && typeof(require) !== 'undefined') {
// Add-on SDK and Thunderbird
phonet.init(helpers.loadFile("resource://grammalecte/fr/phonet_data.json"));
} else if (phonet.isInit){
console.log("Module phonet déjà initialisé");
} else {
console.log("Module phonet non initialisé");
}
if (typeof(exports) !== 'undefined') {
exports._dWord = phonet._dWord;
|