51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
-
+
-
-
+
+
|
this.xContentNode.appendChild(this.xParagraphList);
this.xPanelContent.addEventListener("click", onGrammalecteGCPanelClick, false);
this.oTooltip = new GrammalecteTooltip(this.xContentNode);
this.xPanelContent.appendChild(this.xContentNode);
this.oTAC = new GrammalecteTextAreaControl();
}
start (xTextArea=null) {
start (xNode=null) {
this.oTooltip.hide();
this.clear();
if (xTextArea) {
this.oTAC.setTextArea(xTextArea);
if (xNode && xNode.tagName == "TEXTAREA") {
this.oTAC.setTextArea(xNode);
}
}
clear () {
while (this.xParagraphList.firstChild) {
this.xParagraphList.removeChild(this.xParagraphList.firstChild);
}
|
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
|
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
|
-
+
|
}
addSummary () {
// todo
}
addMessage (sMessage) {
let xNode = oGrammalecte.createNode("div", {className: "grammalecte_gc_panel_message", textContent: sMessage});
let xNode = oGrammalecte.createNode("div", {className: "grammalecte_panel_message", textContent: sMessage});
this.xParagraphList.appendChild(xNode);
}
_copyToClipboard (sText) {
// recipe from https://github.com/mdn/webextensions-examples/blob/master/context-menu-copy-link-with-types/clipboard-helper.js
function setClipboardData (xEvent) {
document.removeEventListener("copy", setClipboardData, true);
|
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
|
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
|
-
+
|
sText = sText.replace("\r\n", "\n").replace("\r", "\n");
while ((iEnd = sText.indexOf("\n", iStart)) !== -1) {
this._dParagraph.set(i, sText.slice(iStart, iEnd));
i++;
iStart = iEnd+1;
}
this._dParagraph.set(i, sText.slice(iStart));
console.log("Paragraphs number: " + (i+1));
//console.log("Paragraphs number: " + (i+1));
}
write () {
if (this._xTextArea !== null) {
let sText = "";
this._dParagraph.forEach(function (val, key) {
sText += val + "\n";
});
this._xTextArea.value = sText.slice(0,-1);
}
}
}
|