Grammalecte  Check-in [ef8e7d82d5]

Overview
Comment:[fx] Add image loader for content_script
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | fx | webext_sharedworker
Files: files | file ages | folders
SHA3-256: ef8e7d82d586bab37fc54dd36523ade381f70c459d25b6d13c52a6177274700d
User & Date: IllusionPerdu on 2017-08-10 16:48:48
Other Links: branch diff | manifest | tags
Context
2017-08-10
17:23
[fx] loadImage cleanup and minor change check-in: 07a6a29cb1 user: IllusionPerdu tags: fx, webext_sharedworker
16:48
[fx] Add image loader for content_script check-in: ef8e7d82d5 user: IllusionPerdu tags: fx, webext_sharedworker
15:08
[fx] Manualy apply change from webext (je me metrise pas les merge de fossil) check-in: 9db066f572 user: IllusionPerdu tags: fx, webext_sharedworker
Changes

Modified gc_lang/fr/webext/content_scripts/modify_page.js from [b9e5fe8eb0] to [40a7f962ad].

45
46
47
48
49
50
51

























52
53
54
55
56
57
58
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
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();
        };

Modified gc_lang/fr/webext/manifest.json from [fb0ccd7853] to [9c74237e70].

42
43
44
45
46
47
48
49


50
51
52
53
54
55
56
42
43
44
45
46
47
48

49
50
51
52
53
54
55
56
57







-
+
+







  "web_accessible_resources": [
    "grammalecte/_dictionaries/French.json",
    "grammalecte/fr/conj_data.json",
    "grammalecte/fr/mfsp_data.json",
    "grammalecte/fr/phonet_data.json",
    "grammalecte/fr/tests_data.json",
    "content_scripts/comunicate.html",
    "content_scripts/comunicate.js"
    "content_scripts/comunicate.js",
    "img/logo-16.png"
  ],
  "permissions": [
    "activeTab",
    "contextMenus"
  ],
  "chrome_settings_overrides": {
    "search_provider": {