Overview
Comment: | [core] add isInit in object conj, phonet, mfsp to prevent loading data twice |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | core | webext2_fix |
Files: | files | file ages | folders |
SHA3-256: |
5dd4693a8f51186f50594523adb148ca |
User & Date: | IllusionPerdu on 2017-08-08 17:31:11 |
Original Comment: | [gc_lang] add isInit in object conj, phonet, mfsp to prevent double load data |
Other Links: | branch diff | manifest | tags |
Context
2017-08-08
| ||
17:45 | [core] set isInit to true when the object was initialized check-in: 6cea30d5de user: IllusionPerdu tags: core, webext2_fix | |
17:31 | [core] add isInit in object conj, phonet, mfsp to prevent loading data twice check-in: 5dd4693a8f user: IllusionPerdu tags: core, webext2_fix | |
17:07 | [core] move require helper at the top of conj.js (following the same logic everywhere) check-in: eb74ef2889 user: IllusionPerdu tags: core, webext2_fix | |
Changes
Modified gc_lang/fr/modules-js/conj.js from [9eed7b965b] to [2cae186485].
︙ | ︙ | |||
12 13 14 15 16 17 18 19 20 21 22 23 24 25 | var conj = { _lVtyp: [], _lTags: [], _dPatternConj: {}, _dVerb: {}, init: function (sJSONData) { try { let _oData = JSON.parse(sJSONData); this._lVtyp = _oData.lVtyp; this._lTags = _oData.lTags; this._dPatternConj = _oData.dPatternConj; this._dVerb = _oData.dVerb; | > | 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | var conj = { _lVtyp: [], _lTags: [], _dPatternConj: {}, _dVerb: {}, isInit: false, init: function (sJSONData) { try { let _oData = JSON.parse(sJSONData); this._lVtyp = _oData.lVtyp; this._lTags = _oData.lTags; this._dPatternConj = _oData.dPatternConj; this._dVerb = _oData.dVerb; |
︙ | ︙ | |||
478 479 480 481 482 483 484 | } return (this.dConj.get(":PQ").get(":Q4")) ? this.dConj.get(":PQ").get(":Q4") : this.dConj.get(":PQ").get(":Q1"); } } // Initialization | | | | > > | 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 | } return (this.dConj.get(":PQ").get(":Q4")) ? this.dConj.get(":PQ").get(":Q4") : this.dConj.get(":PQ").get(":Q1"); } } // Initialization if (!conj.isInit && typeof(browser) !== 'undefined') { // WebExtension (but not in Worker) conj.init(helpers.loadFile(browser.extension.getURL("grammalecte/fr/conj_data.json"))); } else if (!conj.isInit && typeof(require) !== 'undefined') { // Add-on SDK and Thunderbird conj.init(helpers.loadFile("resource://grammalecte/fr/conj_data.json")); } else if ( !conj.isInit && 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); }); } else if (conj.isInit){ console.log("Module conj déjà initialisé"); } else { console.log("Module conj non initialisé"); } if (typeof(exports) !== 'undefined') { exports._lVtyp = conj._lVtyp; |
︙ | ︙ |
Modified gc_lang/fr/modules-js/mfsp.js from [5ce8b4f9f6] to [3d581c8015].
︙ | ︙ | |||
13 14 15 16 17 18 19 20 21 22 23 24 25 26 | _lTagMiscPlur: [], _lTagMasForm: [], // dictionary of words with uncommon plurals (-x, -ux, english, latin and italian plurals) and tags to generate them _dMiscPlur: new Map(), // dictionary of feminine forms and tags to generate masculine forms (singular and plural) _dMasForm: new Map(), init: function (sJSONData) { try { let _oData = JSON.parse(sJSONData); this._lTagMiscPlur = _oData.lTagMiscPlur; this._lTagMasForm = _oData.lTagMasForm; this._dMiscPlur = helpers.objectToMap(_oData.dMiscPlur); this._dMasForm = helpers.objectToMap(_oData.dMasForm); | > | 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | _lTagMiscPlur: [], _lTagMasForm: [], // dictionary of words with uncommon plurals (-x, -ux, english, latin and italian plurals) and tags to generate them _dMiscPlur: new Map(), // dictionary of feminine forms and tags to generate masculine forms (singular and plural) _dMasForm: new Map(), isInit: false, init: function (sJSONData) { try { let _oData = JSON.parse(sJSONData); this._lTagMiscPlur = _oData.lTagMiscPlur; this._lTagMasForm = _oData.lTagMasForm; this._dMiscPlur = helpers.objectToMap(_oData.dMiscPlur); this._dMasForm = helpers.objectToMap(_oData.dMasForm); |
︙ | ︙ | |||
96 97 98 99 100 101 102 | return "## erreur, code : " + sSfx + " ##"; } } }; // Initialization | | | > > | 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | return "## erreur, code : " + sSfx + " ##"; } } }; // Initialization if (!mfsp.isInit && typeof(browser) !== 'undefined') { // WebExtension mfsp.init(helpers.loadFile(browser.extension.getURL("grammalecte/fr/mfsp_data.json"))); } else if (!mfsp.isInit && typeof(require) !== 'undefined') { // Add-on SDK and Thunderbird mfsp.init(helpers.loadFile("resource://grammalecte/fr/mfsp_data.json")); } else if (mfsp.isInit){ console.log("Module mfsp déjà initialisé"); } else { console.log("Module mfsp non initialisé"); } if (typeof(exports) !== 'undefined') { exports._lTagMiscPlur = mfsp._lTagMiscPlur; |
︙ | ︙ |
Modified gc_lang/fr/modules-js/phonet.js from [742b1a34db] to [b606739764].
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 | } return aSelect; } }; // Initialization | | | > > | 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; |
︙ | ︙ |