Grammalecte  Check-in [19934834b3]

Overview
Comment:[fx] commited by mistake (not working)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | fx | webext_sharedworker
Files: files | file ages | folders
SHA3-256: 19934834b37789071560d057addde20f36bfecee311a7e9f6e2d8771f0658ec1
User & Date: olr on 2017-08-11 07:35:12
Original Comment: [fx] rename communicate
Other Links: branch diff | manifest | tags
Context
2017-08-11
07:49
[fx] fix previous commit check-in: e95b59c0d0 user: olr tags: fx, webext_sharedworker
07:35
[fx] commited by mistake (not working) check-in: 19934834b3 user: olr tags: fx, webext_sharedworker
07:15
[fx] rename communicate check-in: cd64de6f5a user: olr tags: fx, webext_sharedworker
Changes

Modified gc_lang/fr/webext/content_scripts/modify_page.js from [db5cbebcc3] to [2505acbc2a].

29
30
31
32
33
34
35

36
37
38
39
40
41
42

43
44
45
46
47
48
49
50
51
52
53
54
55
56
29
30
31
32
33
34
35
36
37
38
39
40
41
42

43
44
45
46
47
48
49

50
51
52
53
54
55
56







+






-
+






-







}

/*
* Creation d'une iframe pour communiquer entre la page visitée et le Shareworker
*/
var sFrameID = browser.extension.getURL("").split('/')[2];
var xIframe = document.createElement('iframe');
let xFrameContent = null;
xIframe.id = sFrameID;
xIframe.src = browser.extension.getURL('content_scripts/communicate.html');
xIframe.hidden = true;
xIframe.onload= function () {
    console.log('[Web] Init protocol de communication');
    //var xFrameContent = xIframe.contentWindow;
    var xFrameContent = document.getElementById(sFrameID).contentWindow;
    xFrameContent = document.getElementById(sFrameID).contentWindow;
    xFrameContent.addEventListener("message", receivedMessageFromIframe, false);
    try {
        //La frame est chargé on envoie l'initialisation du Sharedworker
        console.log('[Web] Initialise the worker :s');
        console.log('[Web] Domaine ext: '+browser.extension.getURL(""));
        xFrameContent.postMessage({sPath: browser.extension.getURL(""), sPage: location.origin.trim("/")}, browser.extension.getURL(""));
   
        //Un petit test pour débogage ;)
        console.log('[Web] Test the worker :s');
        xFrameContent.postMessage(["parse", {sText: "Vas... J’en aie mare...", sCountry: "FR", bDebug: false, bContext: false}], browser.extension.getURL(""));
    }
    catch (e) {
        console.error(e);
    }
128
129
130
131
132
133
134
135

136
137
138
139
140
141
142

143
144
145
146
147
148
149

150
151
152
153
154
155
156
128
129
130
131
132
133
134

135
136
137
138
139
140
141

142
143
144
145
146
147
148

149
150
151
152
153
154
155
156







-
+






-
+






-
+







        xConjButton.onclick = function() {
            createConjPanel();
        };
        xToolbar.appendChild(xConjButton);
        let xTFButton = document.createElement("div");
        xTFButton.textContent = "Formater";
        xTFButton.style = sButtonStyle;
        xTFButton.onclick = function() {
        xTFButton.onclick = function(xTextArea) {
            createTFPanel();
        };
        xToolbar.appendChild(xTFButton);
        let xLxgButton = document.createElement("div");
        xLxgButton.textContent = "Analyser";
        xLxgButton.style = sButtonStyle;
        xLxgButton.onclick = function() {
        xLxgButton.onclick = function(xTextArea) {
            createLxgPanel();
        };
        xToolbar.appendChild(xLxgButton);
        let xGCButton = document.createElement("div");
        xGCButton.textContent = "Corriger";
        xGCButton.style = sButtonStyle;
        xGCButton.onclick = function() {
        xGCButton.onclick = function(xTextArea) {
            createGCPanel();
        };
        xToolbar.appendChild(xGCButton);
        return xToolbar;
    }
    catch (e) {
        showError(e);
172
173
174
175
176
177
178
179

180
181
182
183

184
185
186
187

188

189
190
191
192
193
194
195
172
173
174
175
176
177
178

179
180
181
182

183
184
185
186

187
188
189
190
191
192
193
194
195
196







-
+



-
+



-
+

+







        xConjPanel.appendChild(createCloseButton(xConjPanel));
        document.body.appendChild(xConjPanel);
    }
}



function createTFPanel () {
function createTFPanel (xTextArea) {
    console.log("Formateur de texte");
}

function createLxgPanel () {
function createLxgPanel (xTextArea) {
    console.log("Analyse");
}

function createGCPanel () {
function createGCPanel (xTextArea) {
    console.log("Correction grammaticale");
    xFrameContent.postMessage(["parse", {sText: xTextArea.value, sCountry: "FR", bDebug: false, bContext: false}], browser.extension.getURL(""));
}

function createCloseButton (xParentNode) {
    let xButton = document.createElement("div");
    xButton.style = "float: right; width: 20px; padding: 5px 10px; color: hsl(210, 0%, 100%); text-align: center;"
                  + "font-size: 20px; font-weight: bold; background-color: hsl(0, 80%, 50%); border-radius: 0 0 0 3px; cursor: pointer;";
    xButton.textContent = "×";

Modified gc_lang/fr/webext/panel/main.html from [152e200e98] to [e9d159efe3].

34
35
36
37
38
39
40

41
42
43
44
45
46
47
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48







+







      </div>
      -->

      <div id="page">

        <section id="home_page" class="page">
          <h1>GRAMMALECTE</h1>
          <a href="https://www.dicollecte.org/test.html"></a>
        </section>

        <section id="gc_page" class="page">
          <h1>CORRECTEUR GRAMMATICAL</h1>
          <div id="paragraphs_list"></div>
        </section>