Grammalecte  Check-in [56d5c851ec]

Overview
Comment:[fx] prevent code checker warning
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | fx
Files: files | file ages | folders
SHA3-256: 56d5c851ecacfb08697b0fe1c2c469bb9cc185488c2d0b37096a6d6606288a8a
User & Date: olr on 2021-01-29 16:07:45
Other Links: manifest | tags
Context
2021-01-30
10:31
[fr] faux positifs check-in: 52a13d282f user: olr tags: fr, trunk
2021-01-29
16:07
[fx] prevent code checker warning check-in: 56d5c851ec user: olr tags: fx, trunk
15:06
[lo][fr] remove old and useless file check-in: a491e075e0 user: olr tags: fr, lo, trunk
Changes

Modified gc_lang/fr/webext/content_scripts/api.js from [0491f8cbe1] to [50a6ca99e6].

     8      8   
     9      9       // functions callable from within pages
    10     10       // to be sent to the content-cript via an event “GrammalecteCall”
    11     11   
    12     12       sVersion: "1.0",
    13     13   
    14     14       generateNodeId: function (xNode) {
    15         -        xNode.id = "grammalecte_generated_id_" + Date.now().toString(36) + "_" + (Math.floor(Math.random() * (1000000))).toString(36);
           15  +        xNode.id = "grammalecte_generated_id_" + Date.now().toString(36) + "_" + this._random(0, 1000000).toString(10);
    16     16           console.log("[Grammalecte API] generated id:", xNode.id);
    17     17           return xNode.id;
    18     18       },
           19  +
           20  +    _random: function (nMin, nMax) {
           21  +        return Math.floor(Math.random() * (nMax - nMin + 1) + nMin);
           22  +    },
    19     23   
    20     24       openPanelForNode: function (vNode) {
    21     25           //  Parameter: a HTML node or the identifier of a HTML node
    22     26           if (vNode instanceof HTMLElement) {
    23     27               let sNodeId = vNode.id || this.generateNodeId(vNode);
    24     28               let xEvent = new CustomEvent("GrammalecteCall", { detail: JSON.stringify({sCommand: "openPanelForNode", sNodeId: sNodeId}) });
    25     29               document.dispatchEvent(xEvent);