99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
|
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
|
-
+
|
oGrammalecteTextEditor.loadText(sText);
}
* _getParsableNodes (xRootNode) {
// recursive function
try {
for (let xNode of xRootNode.childNodes) {
if (xNode.className !== "moz-cite-prefix" && xNode.tagName !== "BLOCKQUOTE"
if (xNode.className !== "moz-cite-prefix" && xNode.className !== "moz-forward-container" && xNode.tagName !== "BLOCKQUOTE"
&& (xNode.nodeType == Node.TEXT_NODE || (xNode.nodeType == Node.ELEMENT_NODE && !xNode.textContent.startsWith(">")))
&& xNode.textContent !== "") {
if (xNode.tagName === undefined) {
if (!this.bCheckSignature && xNode.textContent.startsWith("-- ")) {
break;
}
yield xNode;
|
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
|
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
|
-
+
|
getTextFromPage () {
try {
// return this.xRootNode.innerText;
let sPageText = "";
for (let xNode of this._getParsableNodes(this.xRootNode)) {
if (xNode.textContent.trim() !== "") {
this.lNode.push(xNode);
sPageText += xNode.textContent + "\n";
sPageText += xNode.textContent.replace(/\n/g, "") + "\n";
}
}
//console.log(sPageText);
return sPageText.slice(0,-1).normalize("NFC");
}
catch (e) {
showError(e);
|