Grammalecte  Diff

Differences From Artifact [b9e5fe8eb0]:

To Artifact [40a7f962ad]:


45
46
47
48
49
50
51

























52
53
54
55
56
57
58
    }
    catch (e) {
        console.error(e);
    }
}
document.body.appendChild(iframe);



























console.log('[Web] La suite des initialisations');

let nWrapper = 0;
let xConjPanel = null;
let xTFPanel = null;
let xLxgPanel = null;







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
    }
    catch (e) {
        console.error(e);
    }
}
document.body.appendChild(iframe);

/*
* Bidoule pour les les images du module et les intégrès sur la page
*/
function loadImage(sContennaireID, sImagePath){
        let xRequest;

        xRequest = new XMLHttpRequest();
        xRequest.open('GET', browser.extension.getURL("")+sImagePath, false);
        xRequest.responseType = "arraybuffer";
        xRequest.send();

        let blobTxt = new Blob([xRequest.response], {type: 'image/png'});

        var img = document.createElement('img');;
        img.src = (URL || webkitURL).createObjectURL(blobTxt);
        //img.src = 'data:image/png;base64, '+btoa(xRequest.response);

        let elmClass = document.getElementsByClassName(sContennaireID);
        
        for (let oElment in elmClass) {
            if( typeof elmClass[oElment].appendChild === "function" ){
                elmClass[oElment].appendChild(img);
            }
        }        
}

console.log('[Web] La suite des initialisations');

let nWrapper = 0;
let xConjPanel = null;
let xTFPanel = null;
let xLxgPanel = null;
72
73
74
75
76
77
78


79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94





95
96
97
98
99
100
101
        xWrapper.style = "padding: 5px; color: hsl(210, 10%, 90%); background-color: hsl(210, 50%, 50%); border-radius: 3px;";
        xWrapper.id = nWrapper + 1;
        nWrapper += 1;
        xParentElement.insertBefore(xWrapper, xTextArea);
        xWrapper.appendChild(xTextArea); // move textarea in wrapper
        let xToolbar = createWrapperToolbar(xTextArea);
        xWrapper.appendChild(xToolbar);


    }
    catch (e) {
        showError(e);
    }
}


let sButtonStyle = "display: inline-block; padding: 0 5px; margin-left: 5px; background-color: hsl(210, 50%, 60%); border-radius: 2px; cursor: pointer;";

function createWrapperToolbar (xTextArea) {
    try {
        let xToolbar = document.createElement("div");
        xToolbar.style = "display: flex; justify-content: flex-end; margin-top: 5px; padding: 5px 10px;";
        /*let xLogo = document.createElement("img");
        xLogo.src = browser.extension.getURL("img/logo-16.png");
        xTitle.appendChild(xLogo);*/





        xToolbar.appendChild(document.createTextNode("Grammalecte"));
        let xConjButton = document.createElement("div");
        xConjButton.textContent = "Conjuguer";
        xConjButton.style = sButtonStyle;
        xConjButton.onclick = function() {
            createConjPanel();
        };







>
>
















>
>
>
>
>







97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
        xWrapper.style = "padding: 5px; color: hsl(210, 10%, 90%); background-color: hsl(210, 50%, 50%); border-radius: 3px;";
        xWrapper.id = nWrapper + 1;
        nWrapper += 1;
        xParentElement.insertBefore(xWrapper, xTextArea);
        xWrapper.appendChild(xTextArea); // move textarea in wrapper
        let xToolbar = createWrapperToolbar(xTextArea);
        xWrapper.appendChild(xToolbar);

        loadImage("GrammalecteTitle", "img/logo-16.png");
    }
    catch (e) {
        showError(e);
    }
}


let sButtonStyle = "display: inline-block; padding: 0 5px; margin-left: 5px; background-color: hsl(210, 50%, 60%); border-radius: 2px; cursor: pointer;";

function createWrapperToolbar (xTextArea) {
    try {
        let xToolbar = document.createElement("div");
        xToolbar.style = "display: flex; justify-content: flex-end; margin-top: 5px; padding: 5px 10px;";
        /*let xLogo = document.createElement("img");
        xLogo.src = browser.extension.getURL("img/logo-16.png");
        xTitle.appendChild(xLogo);*/

        let xImage = document.createElement("span");
        xImage.className = "GrammalecteTitle";
        xToolbar.appendChild(xImage);

        xToolbar.appendChild(document.createTextNode("Grammalecte"));
        let xConjButton = document.createElement("div");
        xConjButton.textContent = "Conjuguer";
        xConjButton.style = sButtonStyle;
        xConjButton.onclick = function() {
            createConjPanel();
        };