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: trunk, fr
2021-01-29
16:07
[fx] prevent code checker warning check-in: 56d5c851ec user: olr tags: trunk, fx
15:06
[lo][fr] remove old and useless file check-in: a491e075e0 user: olr tags: trunk, fr, lo
Changes

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

8
9
10
11
12
13
14
15
16
17
18




19
20
21
22
23
24
25

    // functions callable from within pages
    // to be sent to the content-cript via an event “GrammalecteCall”

    sVersion: "1.0",

    generateNodeId: function (xNode) {
        xNode.id = "grammalecte_generated_id_" + Date.now().toString(36) + "_" + (Math.floor(Math.random() * (1000000))).toString(36);
        console.log("[Grammalecte API] generated id:", xNode.id);
        return xNode.id;
    },





    openPanelForNode: function (vNode) {
        //  Parameter: a HTML node or the identifier of a HTML node
        if (vNode instanceof HTMLElement) {
            let sNodeId = vNode.id || this.generateNodeId(vNode);
            let xEvent = new CustomEvent("GrammalecteCall", { detail: JSON.stringify({sCommand: "openPanelForNode", sNodeId: sNodeId}) });
            document.dispatchEvent(xEvent);







|



>
>
>
>







8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29

    // functions callable from within pages
    // to be sent to the content-cript via an event “GrammalecteCall”

    sVersion: "1.0",

    generateNodeId: function (xNode) {
        xNode.id = "grammalecte_generated_id_" + Date.now().toString(36) + "_" + this._random(0, 1000000).toString(10);
        console.log("[Grammalecte API] generated id:", xNode.id);
        return xNode.id;
    },

    _random: function (nMin, nMax) {
        return Math.floor(Math.random() * (nMax - nMin + 1) + nMin);
    },

    openPanelForNode: function (vNode) {
        //  Parameter: a HTML node or the identifier of a HTML node
        if (vNode instanceof HTMLElement) {
            let sNodeId = vNode.id || this.generateNodeId(vNode);
            let xEvent = new CustomEvent("GrammalecteCall", { detail: JSON.stringify({sCommand: "openPanelForNode", sNodeId: sNodeId}) });
            document.dispatchEvent(xEvent);