1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
-
-
-
-
-
+
+
+
+
+
-
-
+
+
|
// JavaScript
"use strict";
class GrammalecteWrapper {
constructor (nWrapper, xTextArea) {
this.nWrapper = nWrapper;
let xParentElement = xTextArea.parentElement;
let xWrapper = createNode("div", {id: "grammalecte_wrapper" + nWrapper, className: "grammalecte_wrapper"});
xParentElement.insertBefore(xWrapper, xTextArea);
xWrapper.appendChild(this._createTitle());
xWrapper.appendChild(xTextArea); // move textarea in wrapper
xWrapper.appendChild(this._createWrapperToolbar(xTextArea));
xWrapper.appendChild(this._createWrapperToolbar(xTextArea));
this._insertAfter(xWrapper, xTextArea);
xWrapper.style.marginBottom = xTextArea.style.marginBottom;
xTextArea.style.marginBottom = "0px";
xWrapper.style.width = xTextArea.style.width;
}
_createTitle () {
return createNode("div", {className: "grammalecte_wrapper_title", textContent: "Grammalecte"});
_insertAfter (xNewNode, xReferenceNode) {
xReferenceNode.parentNode.insertBefore(xNewNode, xReferenceNode.nextSibling);
}
_createWrapperToolbar (xTextArea) {
try {
let xToolbar = createNode("div", {className: "grammalecte_wrapper_toolbar"});
let xConjButton = createNode("div", {className: "grammalecte_wrapper_button", textContent: "Conjuguer"});
xConjButton.onclick = () => { this.showConjButtons(); };
|
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
-
+
|
dParam: {sText: xTextArea.value, sCountry: "FR", bDebug: false, bContext: false},
dInfo: {sTextAreaId: xTextArea.id}
});
};
// Create
//xToolbar.appendChild(createNode("img", {scr: browser.extension.getURL("img/logo-16.png")}));
// can’t work, due to content-script policy: https://bugzilla.mozilla.org/show_bug.cgi?id=1267027
//xToolbar.appendChild(createLogo());
xToolbar.appendChild(createNode("div", {className: "grammalecte_wrapper_title", textContent: "Grammalecte"}))
xToolbar.appendChild(xConjButton);
xConjSection.appendChild(xConjButtonTab);
xConjSection.appendChild(xConjButtonWin);
xToolbar.appendChild(xConjSection);
xToolbar.appendChild(xTFButton);
xToolbar.appendChild(xLxgButton);
xToolbar.appendChild(xGCButton);
|