Index: gc_core/js/exemple-node.js ================================================================== --- gc_core/js/exemple-node.js +++ gc_core/js/exemple-node.js Index: gc_core/js/lang_core/gc_options.js ================================================================== --- gc_core/js/lang_core/gc_options.js +++ gc_core/js/lang_core/gc_options.js @@ -45,14 +45,14 @@ 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; +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; } Index: gc_core/js/lang_core/gc_rules.js ================================================================== --- gc_core/js/lang_core/gc_rules.js +++ gc_core/js/lang_core/gc_rules.js @@ -14,9 +14,9 @@ lSentenceRules: ${sentence_rules_JS} }; -if (typeof exports !== 'undefined') { +if (typeof(exports) !== 'undefined') { exports.lParagraphRules = gc_rules.lParagraphRules; exports.lSentenceRules = gc_rules.lSentenceRules; } Index: gc_core/js/lang_core/gc_rules_graph.js ================================================================== --- gc_core/js/lang_core/gc_rules_graph.js +++ gc_core/js/lang_core/gc_rules_graph.js @@ -4,19 +4,19 @@ /* jslint esversion:6 */ /*global exports*/ "use strict"; -//${string} +${string} var gc_rules_graph = { dAllGraph: ${rules_graphsJS}, dRule: ${rules_actionsJS} }; -if (typeof exports !== 'undefined') { +if (typeof(exports) !== 'undefined') { exports.dAllGraph = gc_rules_graph.dAllGraph; exports.dRule = gc_rules_graph.dRule; } Index: gc_lang/fr/modules-js/conj.js ================================================================== --- gc_lang/fr/modules-js/conj.js +++ gc_lang/fr/modules-js/conj.js @@ -5,17 +5,17 @@ /* jslint esversion:6 */ /*global require, exports, console, self, browser, chrome, __dirname */ "use strict"; -//${map} +${map} -if(typeof process !== 'undefined') { - var helpers = require('../graphspell/helpers.js'); -} else if (typeof require !== 'undefined') { - var helpers = require('resource://grammalecte/graphspell/helpers.js'); +if(typeof(process) !== 'undefined') { + var helpers = require("../graphspell/helpers.js"); +} else if (typeof(require) !== 'undefined') { + var helpers = require("resource://grammalecte/graphspell/helpers.js"); } var conj = { _lVtyp: [], _lTags: [], @@ -498,23 +498,23 @@ } } // Initialization -if(!conj.bInit && typeof process !== 'undefined') { +if(!conj.bInit && typeof(process) !== 'undefined') { // Work with nodejs - conj.init(helpers.loadFile(__dirname+'/conj_data.json')); + conj.init(helpers.loadFile(__dirname+"/conj_data.json")); } else if (!conj.bInit && typeof(browser) !== 'undefined') { // WebExtension Standard (but not in Worker) - conj.init(helpers.loadFile(browser.extension.getURL('grammalecte/fr/conj_data.json'))); -} else if (!conj.bInit && typeof chrome !== 'undefined') { + conj.init(helpers.loadFile(browser.extension.getURL("grammalecte/fr/conj_data.json"))); +} else if (!conj.bInit && typeof(chrome) !== 'undefined') { // WebExtension Chrome (but not in Worker) - conj.init(helpers.loadFile(chrome.extension.getURL('grammalecte/fr/conj_data.json'))); -} else if (!conj.bInit && typeof require !== 'undefined') { + conj.init(helpers.loadFile(chrome.extension.getURL("grammalecte/fr/conj_data.json"))); +} else if (!conj.bInit && typeof(require) !== 'undefined') { // Add-on SDK and Thunderbird - conj.init(helpers.loadFile('resource://grammalecte/fr/conj_data.json')); -} else if (!conj.bInit && typeof self !== 'undefined' && typeof self.port !== 'undefined' && typeof self.port.on !== 'undefined') { + conj.init(helpers.loadFile("resource://grammalecte/fr/conj_data.json")); +} else if (!conj.bInit && typeof(self) !== 'undefined' && typeof(self.port) !== 'undefined' && typeof(self.port.on) !== 'undefined') { // used within Firefox content script (conjugation panel). // can’t load JSON from here, so we do it in ui.js and send it here. self.port.on('provideConjData', function (sJSONData) { conj.init(sJSONData); }); @@ -523,11 +523,11 @@ } else { //console.log("Module conj non initialisé"); } -if (typeof exports !== 'undefined') { +if (typeof(exports) !== 'undefined') { exports._lVtyp = conj._lVtyp; exports._lTags = conj._lTags; exports._dPatternConj = conj._dPatternConj; exports._dVerb = conj._dVerb; exports.init = conj.init; Index: gc_lang/fr/modules-js/cregex.js ================================================================== --- gc_lang/fr/modules-js/cregex.js +++ gc_lang/fr/modules-js/cregex.js @@ -267,11 +267,11 @@ return lMorph.some(s => this._zNPm.test(s)); } }; -if (typeof exports !== 'undefined') { +if (typeof(exports) !== 'undefined') { exports._zLemma = cregex._zLemma; exports._zGender = cregex._zGender; exports._zNumber = cregex._zNumber; exports._zNA = cregex._zNA; exports._zNAs = cregex._zNAs; Index: gc_lang/fr/modules-js/gce_suggestions.js ================================================================== --- gc_lang/fr/modules-js/gce_suggestions.js +++ gc_lang/fr/modules-js/gce_suggestions.js @@ -2,18 +2,18 @@ /* jshint esversion:6 */ /* jslint esversion:6 */ /* global require */ -if(typeof process !== 'undefined') { - var conj = require('./conj.js'); - var mfsp = require('./mfsp.js'); - var phonet = require('./phonet.js'); -} else if (typeof require !== 'undefined') { - var conj = require('resource://grammalecte/fr/conj.js'); - var mfsp = require('resource://grammalecte/fr/mfsp.js'); - var phonet = require('resource://grammalecte/fr/phonet.js'); +if(typeof(process) !== 'undefined') { + var conj = require("./conj.js"); + var mfsp = require("./mfsp.js"); + var phonet = require("./phonet.js"); +} else if (typeof(require) !== 'undefined') { + var conj = require("resource://grammalecte/fr/conj.js"); + var mfsp = require("resource://grammalecte/fr/mfsp.js"); + var phonet = require("resource://grammalecte/fr/phonet.js"); } //// verbs Index: gc_lang/fr/modules-js/mfsp.js ================================================================== --- gc_lang/fr/modules-js/mfsp.js +++ gc_lang/fr/modules-js/mfsp.js @@ -5,14 +5,14 @@ /* global require, exports, console, browser,__dirname */ "use strict"; -if(typeof process !== 'undefined') { - var helpers = require('../graphspell/helpers.js'); -} else if (typeof require !== 'undefined') { - var helpers = require('resource://grammalecte/graphspell/helpers.js'); +if(typeof(process) !== 'undefined') { + var helpers = require("../graphspell/helpers.js"); +} else if (typeof(require) !== 'undefined') { + var helpers = require("resource://grammalecte/graphspell/helpers.js"); } var mfsp = { // list of affix codes @@ -106,11 +106,11 @@ } }; // Initialization -if(!mfsp.bInit && typeof process !== 'undefined') { +if(!mfsp.bInit && typeof(process) !== 'undefined') { //Nodejs mfsp.init(helpers.loadFile(__dirname+'/mfsp_data.json')); } else if (!mfsp.bInit && typeof(browser) !== 'undefined') { // WebExtension mfsp.init(helpers.loadFile(browser.extension.getURL('grammalecte/fr/mfsp_data.json'))); @@ -122,11 +122,11 @@ } else { //console.log('Module mfsp non initialisé'); } -if (typeof exports !== 'undefined') { +if (typeof(exports) !== 'undefined') { exports._lTagMiscPlur = mfsp._lTagMiscPlur; exports._lTagMasForm = mfsp._lTagMasForm; exports._dMiscPlur = mfsp._dMiscPlur; exports._dMasForm = mfsp._dMasForm; exports.init = mfsp.init; Index: gc_lang/fr/modules-js/phonet.js ================================================================== --- gc_lang/fr/modules-js/phonet.js +++ gc_lang/fr/modules-js/phonet.js @@ -2,13 +2,13 @@ /* jshint esversion:6 */ /* jslint esversion:6 */ /* global __dirname */ -if(typeof process !== 'undefined') { +if(typeof(process) !== 'undefined') { var helpers = require("../graphspell/helpers.js"); -} else if (typeof require !== 'undefined') { +} else if (typeof(require) !== 'undefined') { var helpers = require("resource://grammalecte/graphspell/helpers.js"); } var phonet = { @@ -87,30 +87,30 @@ } }; // Initialization -if (!phonet.bInit && typeof process !== 'undefined') { +if (!phonet.bInit && typeof(process) !== 'undefined') { //Nodejs - phonet.init(helpers.loadFile(__dirname+'/phonet_data.json')); -} else if (!phonet.bInit && typeof browser !== 'undefined') { + phonet.init(helpers.loadFile(__dirname+"/phonet_data.json")); +} else if (!phonet.bInit && typeof(browser) !== 'undefined') { // WebExtension - phonet.init(helpers.loadFile(browser.extension.getURL('grammalecte/fr/phonet_data.json'))); -} else if (!phonet.bInit && typeof require !== 'undefined') { + phonet.init(helpers.loadFile(browser.extension.getURL("grammalecte/fr/phonet_data.json"))); +} else if (!phonet.bInit && typeof(require) !== 'undefined') { // Add-on SDK and Thunderbird - phonet.init(helpers.loadFile('resource://grammalecte/fr/phonet_data.json')); + phonet.init(helpers.loadFile("resource://grammalecte/fr/phonet_data.json")); } else if (phonet.bInit){ - console.log('Module phonet déjà initialisé'); + console.log("Module phonet déjà initialisé"); } else { //console.log('Module phonet non initialisé'); } -if (typeof exports !== 'undefined') { +if (typeof(exports) !== 'undefined') { exports._dWord = phonet._dWord; exports._lSet = phonet._lSet; exports._dMorph = phonet._dMorph; exports.init = phonet.init; exports.hasSimil = phonet.hasSimil; exports.getSimil = phonet.getSimil; exports.selectSimil = phonet.selectSimil; } Index: gc_lang/fr/modules-js/textformatter.js ================================================================== --- gc_lang/fr/modules-js/textformatter.js +++ gc_lang/fr/modules-js/textformatter.js @@ -287,9 +287,9 @@ return dTFDefaultOptions; } } -if (typeof exports !== 'undefined') { +if (typeof(exports) !== "undefined") { exports.TextFormatter = TextFormatter; exports.oReplTable = oReplTable; } Index: graphspell-js/char_player.js ================================================================== --- graphspell-js/char_player.js +++ graphspell-js/char_player.js @@ -386,11 +386,11 @@ } }; -if (typeof exports !== 'undefined') { +if (typeof(exports) !== 'undefined') { exports._xTransCharsForSpelling = char_player._xTransCharsForSpelling; exports.spellingNormalization = char_player.spellingNormalization; exports._xTransCharsForSimplification = char_player._xTransCharsForSimplification; exports.simplifyWord = char_player.simplifyWord; exports.aVowel = char_player.aVowel; Index: graphspell-js/dawg.js ================================================================== --- graphspell-js/dawg.js +++ graphspell-js/dawg.js @@ -12,14 +12,14 @@ /* jslint esversion:6 */ /* global require, exports, console, helpers */ "use strict"; -if(typeof process !== 'undefined') { - var str_transform = require('./str_transform.js'); -} else if (typeof require !== 'undefined') { - var str_transform = require('resource://grammalecte/graphspell/str_transform.js'); +if(typeof(process) !== 'undefined') { + var str_transform = require("./str_transform.js"); +} else if (typeof(require) !== 'undefined') { + var str_transform = require("resource://grammalecte/graphspell/str_transform.js"); } ${map} Index: graphspell-js/helpers.js ================================================================== --- graphspell-js/helpers.js +++ graphspell-js/helpers.js @@ -21,14 +21,14 @@ loadFile: function (spf) { // load ressources in workers (suggested by Mozilla extensions reviewers) // for more options have a look here: https://gist.github.com/Noitidart/ec1e6b9a593ec7e3efed // if not in workers, use sdk/data.load() instead try { - if(typeof process !== 'undefined' && typeof require !== 'undefined') { + if(typeof(process) !== 'undefined') { //console.log('loadFile(disque): ' + spf); - let fs = require('fs'); - return fs.readFileSync(spf, 'utf8'); + let fs = require("fs"); + return fs.readFileSync(spf, "utf8"); } else { //console.log('loadFile: ' + spf); let xRequest; xRequest = new XMLHttpRequest(); xRequest.open('GET', spf, false); // 3rd arg is false for synchronous, sync is acceptable in workers @@ -66,11 +66,11 @@ return obj; } }; -if (typeof exports !== 'undefined') { +if (typeof(exports) !== 'undefined') { exports.inspect = helpers.inspect; exports.loadFile = helpers.loadFile; exports.objectToMap = helpers.objectToMap; exports.mapToObject = helpers.mapToObject; } Index: graphspell-js/ibdawg.js ================================================================== --- graphspell-js/ibdawg.js +++ graphspell-js/ibdawg.js @@ -4,18 +4,18 @@ /* jslint esversion:6 */ /* global require, exports, console, __dirname */ "use strict"; -if(typeof process !== 'undefined') { - var str_transform = require('./str_transform.js'); - var helpers = require('./helpers.js'); - var char_player = require('./char_player.js'); -} else if (typeof require !== 'undefined') { - var str_transform = require('resource://grammalecte/graphspell/str_transform.js'); - var helpers = require('resource://grammalecte/graphspell/helpers.js'); - var char_player = require('resource://grammalecte/graphspell/char_player.js'); +if(typeof(process) !== 'undefined') { + var str_transform = require("./str_transform.js"); + var helpers = require("./helpers.js"); + var char_player = require("./char_player.js"); +} else if (typeof(require) !== 'undefined') { + var str_transform = require("resource://grammalecte/graphspell/str_transform.js"); + var helpers = require("resource://grammalecte/graphspell/helpers.js"); + var char_player = require("resource://grammalecte/graphspell/char_player.js"); } // Don’t remove . Necessary in TB. ${string} ${map} @@ -638,8 +638,8 @@ // to do } } -if (typeof exports !== 'undefined') { +if (typeof(exports) !== 'undefined') { exports.IBDAWG = IBDAWG; } Index: graphspell-js/spellchecker.js ================================================================== --- graphspell-js/spellchecker.js +++ graphspell-js/spellchecker.js @@ -12,16 +12,16 @@ /* jslint esversion:6 */ /* global require, exports, console, IBDAWG, Tokenizer */ "use strict"; -if(typeof process !== 'undefined') { - var ibdawg = require('./ibdawg.js'); - var tokenizer = require('./tokenizer.js'); -} else if (typeof require !== 'undefined') { - var ibdawg = require('resource://grammalecte/graphspell/ibdawg.js'); - var tokenizer = require('resource://grammalecte/graphspell/tokenizer.js'); +if(typeof(process) !== 'undefined') { + var ibdawg = require("./ibdawg.js"); + var tokenizer = require("./tokenizer.js"); +} else if (typeof(require) !== 'undefined') { + var ibdawg = require("resource://grammalecte/graphspell/ibdawg.js"); + var tokenizer = require("resource://grammalecte/graphspell/tokenizer.js"); } ${map} @@ -303,8 +303,8 @@ } return lResult; } } -if (typeof exports !== 'undefined') { +if (typeof(exports) !== 'undefined') { exports.SpellChecker = SpellChecker; } Index: graphspell-js/str_transform.js ================================================================== --- graphspell-js/str_transform.js +++ graphspell-js/str_transform.js @@ -221,11 +221,11 @@ return sSfxCode[0] == '0' ? sWord + sSfxCode.slice(1) : sWord.slice(0, -(sSfxCode.charCodeAt(0)-48)) + sSfxCode.slice(1); } }; -if (typeof exports !== 'undefined') { +if (typeof(exports) !== 'undefined') { exports.longestCommonSubstring = str_transform.longestCommonSubstring; exports.distanceDamerauLevenshtein = str_transform.distanceDamerauLevenshtein; exports.distanceDamerauLevenshtein2 = str_transform.distanceDamerauLevenshtein2; exports.showDistance = str_transform.showDistance; exports.changeWordWithSuffixCode = str_transform.changeWordWithSuffixCode; Index: graphspell-js/tokenizer.js ================================================================== --- graphspell-js/tokenizer.js +++ graphspell-js/tokenizer.js @@ -92,8 +92,8 @@ } } } -if (typeof exports !== 'undefined') { +if (typeof(exports) !== 'undefined') { exports.Tokenizer = Tokenizer; }