13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
constructor (sId, sTitle, nWidth, nHeight, bFlexible=true) {
this.sId = sId;
this.nWidth = nWidth;
this.nHeight = nHeight;
this.bFlexible = bFlexible;
this.bShadow = document.body.createShadowRoot || document.body.attachShadow;
if (this.bShadow){
this.oShadowPanel = oGrammalecte.createNode("div", {id: this.sId+"_shadow", style: "width:0;height:0;"});
this.oShadow = this.oShadowPanel.attachShadow({mode: "open"});
this.oParent = this.oShadow;
} else {
this.oParent = document;
}
this.xPanelBar = oGrammalecte.createNode("div", {className: "grammalecte_panel_bar"});
this.xPanelContent = oGrammalecte.createNode("div", {className: "grammalecte_panel_content"});
this.xWaitIcon = this._createWaitIcon();
this.xPanel = this._createPanel(sTitle);
this.center();
|
|
|
|
|
|
|
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
constructor (sId, sTitle, nWidth, nHeight, bFlexible=true) {
this.sId = sId;
this.nWidth = nWidth;
this.nHeight = nHeight;
this.bFlexible = bFlexible;
this.bShadow = document.body.createShadowRoot || document.body.attachShadow;
if (this.bShadow) {
this.xShadowPanel = oGrammalecte.createNode("div", {id: this.sId+"_shadow", style: "width:0;height:0;"});
this.xShadow = this.xShadowPanel.attachShadow({mode: "open"});
this.xParent = this.xShadow;
} else {
this.xParent = document;
}
this.xPanelBar = oGrammalecte.createNode("div", {className: "grammalecte_panel_bar"});
this.xPanelContent = oGrammalecte.createNode("div", {className: "grammalecte_panel_content"});
this.xWaitIcon = this._createWaitIcon();
this.xPanel = this._createPanel(sTitle);
this.center();
|
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
|
_createCloseButton () {
let xButton = oGrammalecte.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;
}
insertIntoPage () {
if (this.bShadow){
oGrammalecte.createStyle("content_scripts/panel.css", null, this.oShadow);
oGrammalecte.createStyle("content_scripts/panel_gc.css", null, this.oShadow);
oGrammalecte.createStyle("content_scripts/panel_lxg.css", null, this.oShadow);
oGrammalecte.createStyle("content_scripts/panel_tf.css", null, this.oShadow);
this.oShadow.appendChild(this.xPanel);
document.body.appendChild(this.oShadowPanel);
} else {
if (!document.getElementById("grammalecte_csspanel")){
oGrammalecte.createStyle("content_scripts/panel.css", "grammalecte_csspanel", document.head);
oGrammalecte.createStyle("content_scripts/panel_gc.css", null, document.head);
oGrammalecte.createStyle("content_scripts/panel_lxg.css", null, document.head);
oGrammalecte.createStyle("content_scripts/panel_tf.css", null, document.head);
}
document.body.appendChild(this.xPanel);
}
|
|
|
|
|
|
|
|
|
|
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
|
_createCloseButton () {
let xButton = oGrammalecte.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;
}
insertIntoPage () {
if (this.bShadow) {
oGrammalecte.createStyle("content_scripts/panel.css", null, this.xShadow);
oGrammalecte.createStyle("content_scripts/panel_gc.css", null, this.xShadow);
oGrammalecte.createStyle("content_scripts/panel_lxg.css", null, this.xShadow);
oGrammalecte.createStyle("content_scripts/panel_tf.css", null, this.xShadow);
this.xShadow.appendChild(this.xPanel);
document.body.appendChild(this.xShadowPanel);
} else {
if (!document.getElementById("grammalecte_csspanel")) {
oGrammalecte.createStyle("content_scripts/panel.css", "grammalecte_csspanel", document.head);
oGrammalecte.createStyle("content_scripts/panel_gc.css", null, document.head);
oGrammalecte.createStyle("content_scripts/panel_lxg.css", null, document.head);
oGrammalecte.createStyle("content_scripts/panel_tf.css", null, document.head);
}
document.body.appendChild(this.xPanel);
}
|