1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
-
+
|
// JavaScript
"use strict";
class GrammalecteMenu {
constructor (nMenu, xTextArea) {
this.sMenuId = "grammalecte_menu" + nMenu;
let xButton = createNode("div", {className: "grammalecte_menu_main_button"});
let xButton = createNode("div", {className: "grammalecte_menu_main_button", textContent: "•"});
xButton.onclick = () => { this.switchMenu(); };
let xMenu = this._createMenu(xTextArea);
this._insertAfter(xButton, xTextArea);
this._insertAfter(xMenu, xTextArea);
}
_insertAfter (xNewNode, xReferenceNode) {
|
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
|
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
|
-
+
-
+
|
xConjButtonWin.onclick = () => {
this.switchMenu();
xGrammalectePort.postMessage({sCommand: "openConjugueurWindow", dParam: null, dInfo: null});
};
xConjButton.appendChild(xConjButtonTab);
xConjButton.appendChild(xConjButtonWin);
// Create
xMenu.appendChild(createNode("div", {className: "grammalecte_menu_header", textContent: "Grammalecte"}));
xMenu.appendChild(createNode("div", {className: "grammalecte_menu_header", textContent: "GRAMMALECTE"}));
xMenu.appendChild(xTFButton);
xMenu.appendChild(xLxgButton);
xMenu.appendChild(xGCButton);
xMenu.appendChild(xConjButton);
//xMenu.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
xMenu.appendChild(createNode("div", {className: "grammalecte_menu_header"}));
xMenu.appendChild(createNode("div", {className: "grammalecte_menu_footer"}));
return xMenu;
}
catch (e) {
showError(e);
}
}
switchMenu () {
let xMenu = document.getElementById(this.sMenuId);
xMenu.style.display = (xMenu.style.display == "block") ? "none" : "block";
}
}
|