1
2
3
4
5
6
7
8
9
10
|
// JavaScript
"use strict";
class GrammalecteLexicographer extends GrammalectePanel {
constructor (...args) {
super(...args);
this._nCount = 0;
this._xContentNode = oGrammalecte.createNode("div", {id: "grammalecte_lxg_panel_content"});
|
>
|
1
2
3
4
5
6
7
8
9
10
11
|
// JavaScript
"use strict";
class GrammalecteLexicographer extends GrammalectePanel {
constructor (...args) {
super(...args);
this._nCount = 0;
this._xContentNode = oGrammalecte.createNode("div", {id: "grammalecte_lxg_panel_content"});
|
25
26
27
28
29
30
31
32
33
34
35
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
|
}
addMessage (sMessage) {
let xNode = oGrammalecte.createNode("div", {className: "grammalecte_panel_message", textContent: sMessage});
this._xContentNode.appendChild(xNode);
}
addListOfTokens (lTokens) {
try {
if (lTokens) {
this._nCount += 1;
let xNodeDiv = oGrammalecte.createNode("div", {className: "grammalecte_lxg_list_of_tokens"});
xNodeDiv.appendChild(oGrammalecte.createNode("div", {className: "grammalecte_lxg_list_num", textContent: this._nCount}));
for (let oToken of lTokens) {
xNodeDiv.appendChild(this._createTokenNode(oToken));
}
this._xContentNode.appendChild(xNodeDiv);
}
}
catch (e) {
showError(e);
}
}
_createTokenNode (oToken) {
let xTokenNode = oGrammalecte.createNode("div", {className: "grammalecte_lxg_token_block"});
xTokenNode.appendChild(oGrammalecte.createNode("div", {className: "grammalecte_lxg_token grammalecte_lxg_token_" + oToken.sType, textContent: oToken.sValue}));
xTokenNode.appendChild(oGrammalecte.createNode("div", {className: "grammalecte_lxg_token_colon", textContent: ":"}));
if (oToken.aLabel.length === 1) {
xTokenNode.appendChild(document.createTextNode(oToken.aLabel[0]));
} else {
let xTokenList = oGrammalecte.createNode("div", {className: "grammalecte_lxg_morph_list"});
for (let sLabel of oToken.aLabel) {
xTokenList.appendChild(oGrammalecte.createNode("div", {className: "grammalecte_lxg_morph_elem", textContent: "• " + sLabel}));
}
xTokenNode.appendChild(xTokenList);
}
return xTokenNode;
}
setHidden (sClass, bHidden) {
for (let xNode of document.getElementsByClassName(sClass)) {
xNode.hidden = bHidden;
}
}
}
|
|
|
|
|
|
|
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
|
26
27
28
29
30
31
32
33
34
35
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
|
}
addMessage (sMessage) {
let xNode = oGrammalecte.createNode("div", {className: "grammalecte_panel_message", textContent: sMessage});
this._xContentNode.appendChild(xNode);
}
addListOfTokens (lToken) {
try {
if (lToken) {
this._nCount += 1;
let xTokenList = oGrammalecte.createNode("div", {className: "grammalecte_lxg_list_of_tokens"});
xTokenList.appendChild(oGrammalecte.createNode("div", {className: "grammalecte_lxg_list_num", textContent: this._nCount}));
for (let oToken of lToken) {
xTokenList.appendChild(this._createTokenBlock(oToken));
}
this._xContentNode.appendChild(xTokenList);
}
}
catch (e) {
showError(e);
}
}
_createTokenBlock (oToken) {
let xTokenBlock = oGrammalecte.createNode("div", {className: "grammalecte_lxg_token_block"});
xTokenBlock.appendChild(this._createTokenDescr(oToken));
if (oToken.aSubElem) {
let xSubBlock = oGrammalecte.createNode("div", {className: "grammalecte_lxg_token_subblock"});
for (let oSubElem of oToken.aSubElem) {
xSubBlock.appendChild(this._createTokenDescr(oSubElem));
}
xTokenBlock.appendChild(xSubBlock);
}
return xTokenBlock;
}
_createTokenDescr (oToken) {
try {
let xTokenDescr = oGrammalecte.createNode("div", {className: "grammalecte_lxg_token_descr"});
if (oToken.sType == "LOCP") {
xTokenDescr.appendChild(oGrammalecte.createNode("div", {className: "grammalecte_lxg_token_also", textContent: "possiblement › "}));
}
xTokenDescr.appendChild(oGrammalecte.createNode("div", {className: "grammalecte_lxg_token grammalecte_lxg_token_" + oToken.sType, textContent: oToken.sValue}));
xTokenDescr.appendChild(oGrammalecte.createNode("div", {className: "grammalecte_lxg_token_colon", textContent: ":"}));
if (oToken.aLabel.length === 1) {
xTokenDescr.appendChild(document.createTextNode(oToken.aLabel[0]));
} else {
let xMorphList = oGrammalecte.createNode("div", {className: "grammalecte_lxg_morph_list"});
for (let sLabel of oToken.aLabel) {
xMorphList.appendChild(oGrammalecte.createNode("div", {className: "grammalecte_lxg_morph_elem", textContent: "• " + sLabel}));
}
xTokenDescr.appendChild(xMorphList);
}
return xTokenDescr;
}
catch (e) {
showError(e);
}
}
setHidden (sClass, bHidden) {
for (let xNode of document.getElementsByClassName(sClass)) {
xNode.hidden = bHidden;
}
}
}
|