Overview
| Comment: | [fx] observePage update: don’t add menu if option.textarea doesn’t require it |
|---|---|
| Downloads: | Tarball | ZIP archive | SQL archive |
| Timelines: | family | ancestors | descendants | both | trunk | fx |
| Files: | files | file ages | folders |
| SHA3-256: |
35b97b66b5e07d80fb59027c6853cef6 |
| User & Date: | olr on 2019-02-13 20:03:29 |
| Other Links: | manifest | tags |
Context
|
2019-02-14
| ||
| 07:18 | [fr] faux positif check-in: 2f8140be90 user: olr tags: trunk, fr | |
|
2019-02-13
| ||
| 21:37 | merge trunk check-in: 12dd6264d6 user: olr tags: comdic | |
| 20:03 | [fx] observePage update: don’t add menu if option.textarea doesn’t require it check-in: 35b97b66b5 user: olr tags: trunk, fx | |
| 11:22 | [fr] faux positif check-in: 4cae5ae88c user: olr tags: trunk, fr | |
Changes
Modified gc_lang/fr/webext/content_scripts/init.js from [31953bf9da] to [9009a7100d].
| ︙ | ︙ | |||
55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
oMessageBox: null,
xRightClickedNode: null,
xObserver: null,
sExtensionUrl: null,
listenRightClick: function () {
// Node where a right click is done
// Bug report: https://bugzilla.mozilla.org/show_bug.cgi?id=1325814
document.addEventListener('contextmenu', function (xEvent) {
this.xRightClickedNode = xEvent.target;
}.bind(this), true);
| > > | 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
oMessageBox: null,
xRightClickedNode: null,
xObserver: null,
sExtensionUrl: null,
oOptions: null,
listenRightClick: function () {
// Node where a right click is done
// Bug report: https://bugzilla.mozilla.org/show_bug.cgi?id=1325814
document.addEventListener('contextmenu', function (xEvent) {
this.xRightClickedNode = xEvent.target;
}.bind(this), true);
|
| ︙ | ︙ | |||
76 77 78 79 80 81 82 |
if (bChrome) {
browser.storage.local.get("ui_options", this._createMenus.bind(this));
return;
}
browser.storage.local.get("ui_options").then(this._createMenus.bind(this), showError);
},
| | | | | | > | | > > | | | > | 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 |
if (bChrome) {
browser.storage.local.get("ui_options", this._createMenus.bind(this));
return;
}
browser.storage.local.get("ui_options").then(this._createMenus.bind(this), showError);
},
_createMenus: function (oOptions) {
if (oOptions.hasOwnProperty("ui_options")) {
this.oOptions = oOptions.ui_options;
if (this.oOptions.textarea) {
for (let xNode of document.getElementsByTagName("textarea")) {
if (xNode.style.display !== "none" && xNode.style.visibility !== "hidden" && xNode.getAttribute("spellcheck") !== "false") {
this.lMenu.push(new GrammalecteMenu(this.nMenu, xNode));
this.nMenu += 1;
}
}
}
if (this.oOptions.editablenode) {
for (let xNode of document.querySelectorAll("[contenteditable]")) {
this.lMenu.push(new GrammalecteMenu(this.nMenu, xNode));
this.nMenu += 1;
}
}
}
},
observePage: function () {
/*
When a textarea is added via jascript we add the menu :)
*/
this.xObserver = new MutationObserver(function (mutations) {
mutations.forEach(function (mutation) {
for (let i = 0; i < mutation.addedNodes.length; i++){
if (mutation.addedNodes[i].tagName == "TEXTAREA") {
if (this.oOptions === null || this.oOptions.textarea) {
oGrammalecte.lMenu.push(new GrammalecteMenu(oGrammalecte.nMenu, mutation.addedNodes[i]));
oGrammalecte.nMenu += 1;
}
} else if (mutation.addedNodes[i].getElementsByTagName) {
if (this.oOptions === null || this.oOptions.textarea) {
for (let xNode of mutation.addedNodes[i].getElementsByTagName("textarea")) {
oGrammalecte.lMenu.push(new GrammalecteMenu(oGrammalecte.nMenu, xNode));
oGrammalecte.nMenu += 1;
}
}
}
}
});
});
this.xObserver.observe(document.body, {
childList: true,
|
| ︙ | ︙ |