Comment: | [core][js] merge webext2_fix: better init, mimetype for JSON loading, comments for JSHint |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | core | webext2 |
Files: | files | file ages | folders |
SHA3-256: |
2591cec5954d261604b0311db9e8244c |
User & Date: | olr on 2017-08-09 06:46:46 |
Other Links: | branch diff | manifest | tags |
2017-08-09
| ||
07:20 | [fx] remove conjugueur and lexicographer from main panel check-in: 4a3698dd1a user: olr tags: fx, webext2 | |
06:46 | [core][js] merge webext2_fix: better init, mimetype for JSON loading, comments for JSHint check-in: 2591cec595 user: olr tags: core, webext2 | |
2017-08-08
| ||
19:43 | [fr][licence] GPL 3 seulement Closed-Leaf check-in: 81f981bab2 user: olr tags: fr, webext2_fix | |
17:44 | [core][js] use typeof(require) instead of typeof(exports) check-in: b844f2ba25 user: olr tags: core, webext2 | |
Modified gc_core/js/helpers.js from [8fee48eb89] to [7c62a39694].
1 2 3 4 5 6 7 8 9 | 1 2 3 4 5 6 7 8 9 10 11 | + + | // HELPERS /*jslint esversion: 6*/ /*global console,require,exports,XMLHttpRequest*/ "use strict"; // In Firefox, there is no console.log in PromiseWorker, but there is worker.log. // In Thunderbird, you can’t access to console directly. So it’s required to pass a log function. let funcOutput = null; |
︙ | |||
54 55 56 57 58 59 60 61 62 63 64 65 66 67 | 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | + | } else { // JS bullshit again… necessary for Thunderbird let { Cc, Ci } = require("chrome"); xRequest = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"].createInstance(); xRequest.QueryInterface(Ci.nsIXMLHttpRequest); } xRequest.open('GET', spf, false); // 3rd arg is false for synchronous, sync is acceptable in workers xRequest.overrideMimeType('text/json'); xRequest.send(); return xRequest.responseText; } catch (e) { this.logerror(e); return null; } |
︙ |
Modified gc_core/js/ibdawg.js from [cdddd20c84] to [4cc6e3ad82].
1 2 3 4 5 6 7 8 | 1 2 3 4 5 6 7 8 9 10 | + + | //// IBDAWG /*jslint esversion: 6*/ /*global console,require,exports*/ "use strict"; if (typeof(require) !== 'undefined') { var str_transform = require("resource://grammalecte/str_transform.js"); var helpers = require("resource://grammalecte/helpers.js"); |
︙ |
Modified gc_core/js/jsex_map.js from [ca76af0666] to [3dc39be41a].
1 2 3 4 5 6 7 8 9 | 1 2 3 4 5 6 7 8 9 10 | + | // Map /*jslint esversion: 6*/ if (Map.prototype.grammalecte === undefined) { Map.prototype.gl_shallowCopy = function () { let oNewMap = new Map(); for (let [key, val] of this.entries()) { oNewMap.set(key, val); } |
︙ |
Modified gc_core/js/jsex_regex.js from [8feeee694f] to [0c1a934c00].
1 2 3 4 5 6 7 8 9 | 1 2 3 4 5 6 7 8 9 10 | + | // regex /*jslint esversion: 6*/ if (RegExp.prototype.grammalecte === undefined) { RegExp.prototype.gl_exec2 = function (sText, aGroupsPos, aNegLookBefore=null) { let m; while ((m = this.exec(sText)) !== null) { // we have to iterate over sText here too // because first match doesn’t imply it’s a valid match according to negative lookbefore assertions, |
︙ |
Modified gc_core/js/jsex_string.js from [86533aa4da] to [34840fe9fe].
1 2 3 4 5 6 7 8 9 | 1 2 3 4 5 6 7 8 9 10 | + | // String /*jslint esversion: 6*/ if (String.prototype.grammalecte === undefined) { String.prototype.gl_count = function (sSearch, bOverlapping) { // http://jsperf.com/string-ocurrence-split-vs-match/8 if (sSearch.length <= 0) { return this.length + 1; } |
︙ |
Modified gc_core/js/lang_core/gc_engine.js from [46602d3f85] to [a71cf52ea3].
1 2 3 4 5 6 7 8 | 1 2 3 4 5 6 7 8 9 10 | + + | // Grammar checker engine /*jslint esversion: 6*/ /*global console,require,exports*/ "use strict"; ${string} ${regex} ${map} |
︙ |
Modified gc_core/js/lang_core/gc_options.js from [ba36100a98] to [f47ea826e5].
1 2 3 4 5 6 7 8 | 1 2 3 4 5 6 7 8 9 10 | + + | // Options for Grammalecte /*jslint esversion: 6*/ /*global exports*/ ${map} var gc_options = { getOptions: function (sContext="JavaScript") { if (this.dOpt.hasOwnProperty(sContext)) { |
︙ |
Modified gc_core/js/lang_core/gc_rules.js from [02fc1d6f94] to [cdb121423e].
1 2 3 4 5 6 7 8 | 1 2 3 4 5 6 7 8 9 10 11 | + + + | // Grammar checker rules /*jslint esversion: 6*/ /*global exports*/ "use strict"; ${string} ${regex} var gc_rules = { lParagraphRules: ${paragraph_rules_JS}, |
︙ |
Modified gc_core/js/str_transform.js from [3f33d76266] to [6745507121].
1 2 3 4 5 6 7 8 | 1 2 3 4 5 6 7 8 9 | + | //// STRING TRANSFORMATION /*jslint esversion: 6*/ // Note: 48 is the ASCII code for "0" var str_transform = { getStemFromSuffixCode: function (sFlex, sSfxCode) { // Suffix only if (sSfxCode == "0") { |
︙ |
Modified gc_core/js/tests.js from [abe05a3485] to [4504bb3576].
1 2 3 4 5 6 7 8 | 1 2 3 4 5 6 7 8 9 10 | + + | // JavaScript /*jslint esversion: 6*/ /*global console,require,exports*/ "use strict"; if (typeof(require) !== 'undefined') { var helpers = require("resource://grammalecte/helpers.js"); } |
︙ |
Modified gc_core/js/text.js from [2699625d4c] to [2f8045c94f].
1 2 3 4 5 6 7 8 | 1 2 3 4 5 6 7 8 9 10 | + + | // JavaScript /*jslint esversion: 6*/ /*global require,exports*/ "use strict"; if (typeof(require) !== 'undefined') { var helpers = require("resource://grammalecte/helpers.js"); } |
︙ |
Modified gc_core/js/tokenizer.js from [c0e5d0e035] to [81088a0177].
1 2 3 4 5 6 7 8 9 | 1 2 3 4 5 6 7 8 9 10 11 | + + | // JavaScript // Very simple tokenizer /*jslint esversion: 6*/ /*global require,exports*/ "use strict"; if (typeof(require) !== 'undefined') { var helpers = require("resource://grammalecte/helpers.js"); } |
︙ |
Modified gc_lang/fr/modules-js/conj.js from [abb72eabf4] to [fdb0ca6eac].
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 | 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 | + + + + + + + + | // Grammalecte - Conjugueur // License: GPL 3 /*jslint esversion: 6*/ /*global console,require,exports,self,browser*/ "use strict"; ${map} if (typeof(require) !== 'undefined') { var helpers = require("resource://grammalecte/helpers.js"); } var conj = { _lVtyp: [], _lTags: [], _dPatternConj: {}, _dVerb: {}, bInit: 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; this.bInit = true; } catch (e) { console.error(e); } }, _zStartVoy: new RegExp("^[aeéiouœê]"), |
︙ | |||
474 475 476 477 478 479 480 | 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 507 508 509 | - + - + - - + + + | } return (this.dConj.get(":PQ").get(":Q4")) ? this.dConj.get(":PQ").get(":Q4") : this.dConj.get(":PQ").get(":Q1"); } } // Initialization |
︙ |
Modified gc_lang/fr/modules-js/cregex.js from [7faa9e5e5e] to [97d67d03aa].
1 2 3 4 5 6 7 8 | 1 2 3 4 5 6 7 8 9 | + | //// Grammalecte - Compiled regular expressions /*jslint esversion: 6*/ var cregex = { ///// Lemme _zLemma: new RegExp(">([a-zà-öø-ÿ0-9Ā-ʯ][a-zà-öø-ÿ0-9Ā-ʯ-]+)"), ///// Masculin / féminin / singulier / pluriel |
︙ |
Modified gc_lang/fr/modules-js/gce_analyseur.js from [0ad6fe5843] to [e2613ddcd2].
1 2 3 4 5 6 7 8 | 1 2 3 4 5 6 7 8 9 | + | //// GRAMMAR CHECKING ENGINE PLUGIN: Parsing functions for French language /*jslint esversion: 6*/ function rewriteSubject (s1, s2) { // s1 is supposed to be prn/patr/npr (M[12P]) if (s2 == "lui") { return "ils"; } if (s2 == "moi") { |
︙ |
Modified gc_lang/fr/modules-js/gce_date_verif.js from [de4d3b5e04] to [f30dbe242e].
1 2 3 4 5 6 7 8 | 1 2 3 4 5 6 7 8 9 | + | //// GRAMMAR CHECKING ENGINE PLUGIN /*jslint esversion: 6*/ // Check date validity // WARNING: when creating a Date, month must be between 0 and 11 const _lDay = ["dimanche", "lundi", "mardi", "mercredi", "jeudi", "vendredi", "samedi"]; |
︙ |
Modified gc_lang/fr/modules-js/gce_suggestions.js from [b1d136482e] to [0d3c06e52f].
1 2 3 4 5 6 7 8 | 1 2 3 4 5 6 7 8 9 10 | + + | //// GRAMMAR CHECKING ENGINE PLUGIN: Suggestion mechanisms /*jslint esversion: 6*/ /*global require*/ 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"); } |
︙ |
Modified gc_lang/fr/modules-js/lexicographe.js from [9672629a43] to [fd0872dfca].
1 2 3 4 5 6 7 8 9 | 1 2 3 4 5 6 7 8 9 10 11 | + + | // Grammalecte - Lexicographe // License: MPL 2 /*jslint esversion: 6*/ /*global require,exports*/ "use strict"; ${string} ${map} |
︙ |
Modified gc_lang/fr/modules-js/mfsp.js from [5ce8b4f9f6] to [4ade9720c3].
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 | 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 | + + + + | // Grammalecte /*jslint esversion: 6*/ /*global console,require,exports,browser*/ "use strict"; if (typeof(require) !== 'undefined') { var helpers = require("resource://grammalecte/helpers.js"); } var mfsp = { // list of affix codes _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(), bInit: 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); this.bInit = true; } catch (e) { console.error(e); } }, isFemForm: function (sWord) { |
︙ | |||
96 97 98 99 100 101 102 | 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 | - + - + + + | return "## erreur, code : " + sSfx + " ##"; } } }; // Initialization |
︙ |
Modified gc_lang/fr/modules-js/phonet.js from [742b1a34db] to [b4e35b2c18].
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 | 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 | + + + | // Grammalecte - Suggestion phonétique /*jslint esversion: 6*/ if (typeof(require) !== 'undefined') { var helpers = require("resource://grammalecte/helpers.js"); } var phonet = { _dWord: new Map(), _lSet: [], _dMorph: new Map(), bInit: 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); this.bInit = true; } catch (e) { console.error(e); } }, hasSimil: function (sWord, sPattern=null) { |
︙ | |||
77 78 79 80 81 82 83 | 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 | - + - + + + | } return aSelect; } }; // Initialization |
︙ |
Modified gc_lang/fr/modules-js/textformatter.js from [c6e77daf98] to [1785f80db7].
1 2 3 4 5 6 7 8 | 1 2 3 4 5 6 7 8 9 10 | + + | // Grammalecte - text formatter /*jslint esversion: 6*/ /*global exports*/ "use strict"; ${map} // Latin letters: http://unicode-table.com/fr/ |
︙ |