Overview
Comment: | [fx] update API: send GC result as a string (JSON), not an object |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk | fx |
Files: | files | file ages | folders |
SHA3-256: |
1bb5f94a8467205540a14db4cada6f98 |
User & Date: | olr on 2020-03-12 22:46:38 |
Other Links: | manifest | tags |
Context
2020-03-12
| ||
23:53 | [fr] ajustements check-in: bdd6bc1361 user: olr tags: trunk, fr | |
22:46 | [fx] update API: send GC result as a string (JSON), not an object check-in: 1bb5f94a84 user: olr tags: trunk, fx | |
16:56 | [fx] update API and handle iframe node via GC Panel check-in: 76d78039bf user: olr tags: trunk, fx | |
Changes
Modified gc_lang/fr/webext/content_scripts/api.js from [85027b59ad] to [d7c42966b4].
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | // JavaScript "use strict"; const oGrammalecteAPI = { // functions callable from within pages sVersion: "1.0", openPanel: function (arg1) { let xNode = null; if (typeof(arg1) === 'string') { if (document.getElementById(arg1)) { | > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | // JavaScript "use strict"; const oGrammalecteAPI = { // functions callable from within pages // to be sent to the content-cript via an event GrammalecteCall sVersion: "1.0", openPanel: function (arg1) { let xNode = null; if (typeof(arg1) === 'string') { if (document.getElementById(arg1)) { |
︙ | ︙ |
Modified gc_lang/fr/webext/content_scripts/panel_gc.js from [88c95d607e] to [f1590de9e6].
︙ | ︙ | |||
966 967 968 969 970 971 972 | this.bIframe = (xNode.tagName == "IFRAME"); if (this.bTextArea) { this.xNode.disabled = true; this._loadText(this.xNode.value); } else if (this.bIframe) { // iframe | | | > | | | 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 | this.bIframe = (xNode.tagName == "IFRAME"); if (this.bTextArea) { this.xNode.disabled = true; this._loadText(this.xNode.value); } else if (this.bIframe) { // iframe if (!this.bResultInEvent) { oGrammalecte.oGCPanel.addMessageToGCPanel("⛔ La zone analysée est un cadre contenant une autre page web (“iframe”). Les changements faits ne peuvent être pas répercutés dans cette zone."); } this._loadText(this.xNode.contentWindow.document.body.innerText); } else { // editable node oGrammalecte.oGCPanel.addMessageToGCPanel("❗ La zone de texte analysée est un champ textuel enrichi susceptible de contenir des éléments non textuels qui seront effacés lors de la correction."); this._loadText(this.xNode.innerText); } } setText (sText) { this.clear(); oGrammalecte.oGCPanel.addMessageToGCPanel("⛔ Aucun champ textuel défini. Les changements ne seront pas répercutés sur la zone d’où le texte a été extrait."); this._loadText(sText); } _loadText (sText) { if (typeof(sText) === "string") { this.dParagraph.clear(); let i = 0; |
︙ | ︙ | |||
1028 1029 1030 1031 1032 1033 1034 | this.xNode.removeChild(this.xNode.firstChild); } } write () { if (this.xNode !== null) { if (this.bResultInEvent) { | | | | | 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 | this.xNode.removeChild(this.xNode.firstChild); } } write () { if (this.xNode !== null) { if (this.bResultInEvent) { const xEvent = new CustomEvent("GrammalecteResult", { detail: JSON.stringify({ text: this.getText() }) }); this.xNode.dispatchEvent(xEvent); //console.log("Text sent via an event :", xEvent.detail); } else if (this.bTextArea) { this.xNode.value = this.getText(); } else if (this.bIframe) { //console.log(this.getText()); } |
︙ | ︙ |