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
37
38
39
40
|
constructor (sId, sTitle, nWidth, nHeight, bMovable=true) {
this.sId = sId;
this.sContentId = sId+"_content";
this.nWidth = nWidth;
this.nHeight = nHeight;
this.bMovable = bMovable;
this.xContentNode = createNode("div", {className: "grammalecte_panel_content"});
this.xWaitIcon = this._createWaitIcon();
this.xPanelNode = this._createPanel(sTitle);
this.center();
}
_createPanel (sTitle) {
try {
let xPanel = createNode("div", {id: this.sId, className: "grammalecte_panel"});
let xBar = createNode("div", {className: "grammalecte_panel_bar"});
xBar.appendChild(this._createButtons());
let xTitle = createNode("div", {className: "grammalecte_panel_title"});
xTitle.appendChild(createLogo());
xTitle.appendChild(createNode("div", {className: "grammalecte_panel_label", textContent: sTitle}));
xBar.appendChild(xTitle);
xPanel.appendChild(xBar);
xPanel.appendChild(this.xContentNode);
return xPanel;
}
catch (e) {
showError(e);
}
}
|
|
|
|
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
37
38
39
40
|
constructor (sId, sTitle, nWidth, nHeight, bMovable=true) {
this.sId = sId;
this.sContentId = sId+"_content";
this.nWidth = nWidth;
this.nHeight = nHeight;
this.bMovable = bMovable;
this.xPanelContent = createNode("div", {className: "grammalecte_panel_content"});
this.xWaitIcon = this._createWaitIcon();
this.xPanelNode = this._createPanel(sTitle);
this.center();
}
_createPanel (sTitle) {
try {
let xPanel = createNode("div", {id: this.sId, className: "grammalecte_panel"});
let xBar = createNode("div", {className: "grammalecte_panel_bar"});
xBar.appendChild(this._createButtons());
let xTitle = createNode("div", {className: "grammalecte_panel_title"});
xTitle.appendChild(createLogo());
xTitle.appendChild(createNode("div", {className: "grammalecte_panel_label", textContent: sTitle}));
xBar.appendChild(xTitle);
xPanel.appendChild(xBar);
xPanel.appendChild(this.xPanelContent);
return xPanel;
}
catch (e) {
showError(e);
}
}
|
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
_createCloseButton () {
let xButton = createNode("div", {className: "grammalecte_close_button", textContent: "×", title: "Fermer la fenêtre"});
xButton.onclick = function () { this.hide(); }.bind(this); // better than writing “let that = this;” before the function?
return xButton;
}
setContentNode (xNode) {
this.xContentNode.appendChild(xNode);
}
insertIntoPage () {
document.body.appendChild(this.xPanelNode);
}
show () {
|
|
|
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
_createCloseButton () {
let xButton = createNode("div", {className: "grammalecte_close_button", textContent: "×", title: "Fermer la fenêtre"});
xButton.onclick = function () { this.hide(); }.bind(this); // better than writing “let that = this;” before the function?
return xButton;
}
setContentNode (xNode) {
this.xPanelContent.appendChild(xNode);
}
insertIntoPage () {
document.body.appendChild(this.xPanelNode);
}
show () {
|
124
125
126
127
128
129
130
131
132
133
134
135
136
137
|
startWaitIcon () {
this.xWaitIcon.style.visibility = "visible";
}
stopWaitIcon () {
this.xWaitIcon.style.visibility = "hidden";
}
}
/*
Common functions
*/
function createNode (sType, oAttr, oDataset=null) {
|
>
>
>
>
|
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
|
startWaitIcon () {
this.xWaitIcon.style.visibility = "visible";
}
stopWaitIcon () {
this.xWaitIcon.style.visibility = "hidden";
}
openURL (sURL) {
// todo
}
}
/*
Common functions
*/
function createNode (sType, oAttr, oDataset=null) {
|