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
27
28
29
30
31
32
33
34
35
36
| // JavaScript
// Panel creator
"use strict";
class GrammalecteMessageBox {
constructor (sId, sTitle, nWidth, nHeight) {
this.sId = sId;
this.nWidth = nWidth;
this.nHeight = nHeight;
this.xMessageBoxBar = oGrammalecte.createNode("div", {className: "grammalecte_message_box_bar"});
this.xMessageBoxContent = oGrammalecte.createNode("div", {className: "grammalecte_message_box_content"});
this.xMessageBox = this._createPanel(sTitle);
this.center();
}
_createPanel (sTitle) {
try {
let xMessageBox = oGrammalecte.createNode("div", {id: this.sId, className: "grammalecte_message_box"});
this.xMessageBoxBar.appendChild(oGrammalecte.createNode("div", {className: "grammalecte_message_box_invisible_marker", textContent: "__grammalecte_panel__"}));
this.xMessageBoxBar.appendChild(this._createButtons());
let xTitle = oGrammalecte.createNode("div", {className: "grammalecte_panel_title"});
xTitle.appendChild(this._createLogo());
xTitle.appendChild(oGrammalecte.createNode("div", {className: "grammalecte_message_box_label", textContent: sTitle}));
this.xMessageBoxBar.appendChild(xTitle);
xMessageBox.appendChild(this.xMessageBoxBar);
xMessageBox.appendChild(this.xMessageBoxContent);
return xMessageBox;
}
catch (e) {
showError(e);
}
}
|
|
<
<
<
<
| 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
27
28
29
30
31
32
| // JavaScript
// Panel creator
"use strict";
class GrammalecteMessageBox {
constructor (sId, sTitle) {
this.sId = sId;
this.xMessageBoxBar = oGrammalecte.createNode("div", {className: "grammalecte_message_box_bar"});
this.xMessageBoxContent = oGrammalecte.createNode("div", {className: "grammalecte_message_box_content"});
this.xMessageBox = this._createPanel(sTitle);
}
_createPanel (sTitle) {
try {
let xMessageBox = oGrammalecte.createNode("div", {id: this.sId, className: "grammalecte_message_box"});
this.xMessageBoxBar.appendChild(oGrammalecte.createNode("div", {className: "grammalecte_message_box_invisible_marker", textContent: "__grammalecte_panel__"}));
this.xMessageBoxBar.appendChild(this._createButtons());
let xTitle = oGrammalecte.createNode("div", {className: "grammalecte_panel_title"});
xTitle.appendChild(this._createLogo());
xTitle.appendChild(oGrammalecte.createNode("div", {className: "grammalecte_message_box_label", textContent: sTitle}));
this.xMessageBoxBar.appendChild(xTitle);
xMessageBox.appendChild(this.xMessageBoxBar);
xMessageBox.appendChild(this.xMessageBoxContent);
return xMessageBox;
}
catch (e) {
showError(e);
}
}
|
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
| }
hide () {
this.xMessageBox.style.display = "none";
this.clear();
}
addMessage (sMessage) {
this.xMessageBoxContent.appendChild(oGrammalecte.createNode("div", {className: "grammalecte_message_box_message", textContent: sMessage}));
}
clear () {
while (this.xMessageBoxContent.firstChild) {
this.xMessageBoxContent.removeChild(this.xMessageBoxContent.firstChild);
}
}
center () {
this.xMessageBox.style = `top: 50%; left: 50%; width: ${this.nWidth}px; height: ${this.nHeight}px; margin-top: -${this.nHeight/2}px; margin-left: -${this.nWidth/2}px;`;
}
}
|
|
|
<
|
|
|
<
<
<
<
<
| 58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
| }
hide () {
this.xMessageBox.style.display = "none";
this.clear();
}
setMessage (sMessage) {
this.xMessageBoxContent.textContent = sMessage;
}
clear () {
this.xMessageBoxContent.textContent = "";
}
}
|