117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
|
// When a textarea is added via jascript we add the buttons
let that = this;
this.xObserver = new MutationObserver(function (lMutations) {
lMutations.forEach(function (xMutation) {
if (that.oOptions) {
for (let i = 0; i < xMutation.addedNodes.length; i++) {
let xNode = xMutation.addedNodes[i];
if (((xNode.tagName == "TEXTAREA" && that.oOptions.textarea && xNode.getAttribute("spellcheck") !== "false") || (xNode.isContentEditable && that.oOptions.editablenode))
&& that._isEligibleNode(xNode)) {
oGrammalecte.lButton.push(new GrammalecteButton(oGrammalecte.nButton, xNode));
oGrammalecte.nButton += 1;
}
else if (xNode.getElementsByTagName && that.oOptions.textarea) {
for (let xSubNode of xNode.getElementsByTagName("textarea")) {
if (that._isEligibleNode(xSubNode) && xSubNode.getAttribute("spellcheck") !== "false") {
oGrammalecte.lButton.push(new GrammalecteButton(oGrammalecte.nButton, xSubNode));
oGrammalecte.nButton += 1;
}
}
}
else if (xNode.querySelectorAll && that.oOptions.editablenode) {
for (let xSubNode of xNode.querySelectorAll("[contenteditable]")) {
if (that._isEligibleNode(xSubNode)) {
oGrammalecte.lButton.push(new GrammalecteButton(oGrammalecte.nButton, xSubNode));
oGrammalecte.nButton += 1;
}
}
}
}
}
});
});
this.xObserver.observe(document.body, { childList: true, subtree: true });
},
|
|
<
>
>
>
>
>
|
|
|
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
|
// When a textarea is added via jascript we add the buttons
let that = this;
this.xObserver = new MutationObserver(function (lMutations) {
lMutations.forEach(function (xMutation) {
if (that.oOptions) {
for (let i = 0; i < xMutation.addedNodes.length; i++) {
let xNode = xMutation.addedNodes[i];
if (xNode.tagName == "TEXTAREA" && that.oOptions.textarea && xNode.getAttribute("spellcheck") !== "false" && that._isEligibleNode(xNode)) {
oGrammalecte.lButton.push(new GrammalecteButton(oGrammalecte.nButton, xNode));
oGrammalecte.nButton += 1;
}
/*else if (xNode.isContentEditable && that.oOptions.editablenode && that._isEligibleNode(xNode)) {
// this makes Twitter crash when hitting backspace button
oGrammalecte.lButton.push(new GrammalecteButton(oGrammalecte.nButton, xNode));
oGrammalecte.nButton += 1;
}*/
else if (xNode.getElementsByTagName && that.oOptions.textarea) {
for (let xSubNode of xNode.getElementsByTagName("textarea")) {
if (that._isEligibleNode(xSubNode) && xSubNode.getAttribute("spellcheck") !== "false") {
oGrammalecte.lButton.push(new GrammalecteButton(oGrammalecte.nButton, xSubNode));
oGrammalecte.nButton += 1;
}
}
}
/*else if (xNode.querySelectorAll && that.oOptions.editablenode) {
for (let xSubNode of xNode.querySelectorAll("[contenteditable]")) {
if (that._isEligibleNode(xSubNode)) {
oGrammalecte.lButton.push(new GrammalecteButton(oGrammalecte.nButton, xSubNode));
oGrammalecte.nButton += 1;
}
}
}*/
}
}
});
});
this.xObserver.observe(document.body, { childList: true, subtree: true });
},
|