Overview
Context
Changes
Modified gc_lang/fr/webext/content_scripts/menu.js
from [1c8166f9c8]
to [56c56fae1e].
︙ | | |
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
|
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
|
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
-
-
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
-
+
+
+
+
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
+
+
|
if (oOptions.hasOwnProperty("ui_options")) {
this._bTextArea = oOptions.ui_options.textarea;
this._bEditableNode = oOptions.ui_options.editablenode;
}
}
examineNode (xNode) {
if (xNode && xNode instanceof HTMLElement) {
if (xNode === this.xTextNode) {
this.move();
return;
}
if ( ( (xNode.tagName == "TEXTAREA" && this._bTextArea && xNode.getAttribute("spellcheck") !== "false")
if (!xNode || !xNode instanceof HTMLElement) {
// not a node
this.reject();
return;
}
if (xNode === this.xTextNode) {
// same node -> possibly click for resizing -> move it
this.move();
return;
}
if ( ( (xNode.tagName == "TEXTAREA" && this._bTextArea && xNode.getAttribute("spellcheck") !== "false")
|| ( (xNode.tagName == "P" || xNode.tagName == "DIV") && xNode.isContentEditable && this._bEditableNode )
|| (xNode.tagName == "IFRAME" && this._bIframe) )
|| (xNode.tagName == "IFRAME" && this._bIframe) )
&& xNode.style.display !== "none" && xNode.style.visibility !== "hidden"
&& !(xNode.dataset.grammalecte_button && xNode.dataset.grammalecte_button == "false") ) {
this.xTextNode = xNode;
this.show()
}
else {
this.xTextNode = null;
&& !(xNode.dataset.grammalecte_button && xNode.dataset.grammalecte_button == "false") ) {
// textarea or iframe
this.accept(xNode)
}
else if (xNode.isContentEditable && this._bEditableNode) {
// editable node
const findOriginEditableNode = function (xNode) {
this.hide();
return (!xNode.parentNode.isContentEditable) ? xNode : findOriginEditableNode(xNode.parentNode);
}
xNode = findOriginEditableNode(xNode);
if ((xNode.tagName == "P" || xNode.tagName == "DIV") && !(xNode.dataset.grammalecte_button && xNode.dataset.grammalecte_button == "false")) {
this.accept(xNode);
} else {
this.reject();
}
else {
}
} else {
this.xTextNode = null;
this.hide();
this.reject();
}
}
accept (xNode=null) {
show () {
if (this.xTextNode) {
if (xNode) {
this.xTextNode = xNode;
this.xButton.style.display = "none"; // we hide it before showing it again to relaunch the animation
this.move();
this.xButton.style.display = "block";
}
}
hide () {
reject () {
this.xTextNode = null;
this.xButton.style.display = "none";
}
move () {
if (this.xTextNode) {
let oCoord = oGrammalecte.getElementCoord(this.xTextNode);
this.xButton.style.top = `${oCoord.bottom}px`;
|
︙ | | |