1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
// JavaScript
// Panel creator
"use strict";
console.log("[Content script] Panel creator");
class GrammalectePanel {
constructor (sId, sTitle, nWidth, nHeight, bFlexible=true) {
this.sId = sId;
this.sContentId = sId+"_content";
this.nWidth = nWidth;
this.nHeight = nHeight;
this.bFlexible = bFlexible;
this.xPanelContent = createNode("div", {className: "grammalecte_panel_content"});
this.xWaitIcon = this._createWaitIcon();
this.xPanelNode = this._createPanel(sTitle);
this.center();
|
<
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
// JavaScript
// Panel creator
"use strict";
console.log("[Content script] Panel creator");
class GrammalectePanel {
constructor (sId, sTitle, nWidth, nHeight, bFlexible=true) {
this.sId = sId;
this.nWidth = nWidth;
this.nHeight = nHeight;
this.bFlexible = bFlexible;
this.xPanelContent = createNode("div", {className: "grammalecte_panel_content"});
this.xWaitIcon = this._createWaitIcon();
this.xPanelNode = this._createPanel(sTitle);
this.center();
|
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
showError(e);
}
}
_createButtons () {
let xButtonLine = createNode("div", {className: "grammalecte_panel_commands"});
xButtonLine.appendChild(this.xWaitIcon);
xButtonLine.appendChild(this._createMoveButton("stickToTop", "¯", "Coller en haut"));
xButtonLine.appendChild(this._createMoveButton("stickToLeft", "«", "Coller à gauche"));
xButtonLine.appendChild(this._createMoveButton("center", "•", "Centrer"));
xButtonLine.appendChild(this._createMoveButton("stickToRight", "»", "Coller à droite"));
xButtonLine.appendChild(this._createMoveButton("stickToBottom", "_", "Coller en bas"));
xButtonLine.appendChild(this._createCloseButton());
return xButtonLine;
}
_createWaitIcon () {
let xWaitIcon = createNode("div", {className: "grammalecte_spinner"});
xWaitIcon.appendChild(createNode("div", {className: "bounce1"}));
xWaitIcon.appendChild(createNode("div", {className: "bounce2"}));
return xWaitIcon;
}
_createMoveButton (sAction, sLabel, sTitle) {
let xButton = createNode("div", {className: "grammalecte_move_button", textContent: sLabel, title: sTitle});
xButton.onclick = function () { this[sAction](); }.bind(this);
return xButton;
}
|
>
>
>
>
>
>
>
>
>
|
36
37
38
39
40
41
42
43
44
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
|
showError(e);
}
}
_createButtons () {
let xButtonLine = createNode("div", {className: "grammalecte_panel_commands"});
xButtonLine.appendChild(this.xWaitIcon);
if (this.sId === "grammalecte_gc_panel") {
xButtonLine.appendChild(this._createCopyButton());
}
xButtonLine.appendChild(this._createMoveButton("stickToTop", "¯", "Coller en haut"));
xButtonLine.appendChild(this._createMoveButton("stickToLeft", "«", "Coller à gauche"));
xButtonLine.appendChild(this._createMoveButton("center", "•", "Centrer"));
xButtonLine.appendChild(this._createMoveButton("stickToRight", "»", "Coller à droite"));
xButtonLine.appendChild(this._createMoveButton("stickToBottom", "_", "Coller en bas"));
xButtonLine.appendChild(this._createCloseButton());
return xButtonLine;
}
_createWaitIcon () {
let xWaitIcon = createNode("div", {className: "grammalecte_spinner"});
xWaitIcon.appendChild(createNode("div", {className: "bounce1"}));
xWaitIcon.appendChild(createNode("div", {className: "bounce2"}));
return xWaitIcon;
}
_createCopyButton () {
let xButton = createNode("div", {id: "grammalecte_clipboard_button", className: "grammalecte_copy_button", textContent: "∑", title: "Copier dans le presse-papiers"});
xButton.onclick = function () { this.copyTextToClipboard(); }.bind(this);
return xButton;
}
_createMoveButton (sAction, sLabel, sTitle) {
let xButton = createNode("div", {className: "grammalecte_move_button", textContent: sLabel, title: sTitle});
xButton.onclick = function () { this[sAction](); }.bind(this);
return xButton;
}
|