Grammalecte  Check-in [9f8939c97c]

Overview
Comment:Check if action is in event
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | comunicate
Files: files | file ages | folders
SHA3-256: 9f8939c97c68f9cbfcef36a47ccf69ce4a379c36bae7470bc4db2784976781b2
User & Date: IllusionPerdu on 2018-11-07 11:37:58
Other Links: branch diff | manifest | tags
Context
2018-11-07
11:59
Oups forgettent to change variable name check-in: 7eb5a85846 user: IllusionPerdu tags: comunicate
11:37
Check if action is in event check-in: 9f8939c97c user: IllusionPerdu tags: comunicate
2018-11-06
23:42
Added the possibility to web page script open gcpanel or lexicographe check-in: 5c25db680b user: IllusionPerdu tags: comunicate
Changes

Modified gc_lang/fr/webext/content_scripts/init.js from [fb85dd36b8] to [c869a84f0a].

361
362
363
364
365
366
367
368

369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392



393
394
*/
var scriptEvent = document.createElement('script');
scriptEvent.src = browser.extension.getURL("content_scripts/event.js");
document.documentElement.appendChild(scriptEvent);

document.addEventListener('GrammalecteEvent', function(event) {
    let actionFromPage = event.detail;
    console.log(event);

    let sText = false;
    let dInfo = {};
    let elmForGramma = null;
    if (actionFromPage.elm){
        elmForGramma = document.getElementById(actionFromPage.elm);
        sText = (elmForGramma.tagName == "TEXTAREA") ? elmForGramma.value : elmForGramma.innerText;
        dInfo = {sTextAreaId: elmForGramma.id};
    }

    if (actionFromPage.spellcheck){
        oGrammalecte.startGCPanel(elmForGramma);
        xGrammalectePort.postMessage({
            sCommand: "parseAndSpellcheck",
            dParam: {sText: sText || actionFromPage.parseAndSpellcheck, sCountry: "FR", bDebug: false, bContext: false},
            dInfo: dInfo
        });
    }
    if (actionFromPage.lexique){
        oGrammalecte.startLxgPanel();
        xGrammalectePort.postMessage({
            sCommand: "getListOfTokens",
            dParam: {sText: sText || actionFromPage.lexique},
            dInfo: dInfo
        });



    }
});







|
>
|
|
|
|
|
|
|
|

|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
>
>
>


361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
*/
var scriptEvent = document.createElement('script');
scriptEvent.src = browser.extension.getURL("content_scripts/event.js");
document.documentElement.appendChild(scriptEvent);

document.addEventListener('GrammalecteEvent', function(event) {
    let actionFromPage = event.detail;
    //console.log(event);
    if(actionFromPage){
        let sText = false;
        let dInfo = {};
        let elmForGramma = null;
        if (actionFromPage.elm){
            elmForGramma = document.getElementById(actionFromPage.elm);
            sText = (elmForGramma.tagName == "TEXTAREA") ? elmForGramma.value : elmForGramma.innerText;
            dInfo = {sTextAreaId: elmForGramma.id};
        }

        if (actionFromPage.spellcheck){
            oGrammalecte.startGCPanel(elmForGramma);
            xGrammalectePort.postMessage({
                sCommand: "parseAndSpellcheck",
                dParam: {sText: sText || actionFromPage.parseAndSpellcheck, sCountry: "FR", bDebug: false, bContext: false},
                dInfo: dInfo
            });
        }
        if (actionFromPage.lexique){
            oGrammalecte.startLxgPanel();
            xGrammalectePort.postMessage({
                sCommand: "getListOfTokens",
                dParam: {sText: sText || actionFromPage.lexique},
                dInfo: dInfo
            });
        }
    } else {
        console.log("Vous devez spécifier l'action à effectuer");
    }
});