Index: gc_lang/fr/webext/content_scripts/event.js ================================================================== --- gc_lang/fr/webext/content_scripts/event.js +++ gc_lang/fr/webext/content_scripts/event.js @@ -10,10 +10,14 @@ //console.log(event); var data = JSON.parse(event.detail); // Message envoyer dès que le script est injecté if (typeof data.init !== "undefined") { browserURL = data.init; + } + if (typeof data.tiny !== "undefined") { + //console.log('Detect Tiny', data.tiny); + TinyIDInPage(data.tiny); } //console.log("GrammalecteToPage",data); }); // ! Permet d'envoyer des message vers le content script @@ -41,91 +45,115 @@ // (peut être lu aussi bien par la page web que le content script) var customAPILoaded = new CustomEvent("GrammalecteIsLoaded"); document.dispatchEvent(customAPILoaded); // Gros Hack : Auto add a button in tinymce ;) -// Page to test v4 https://www.quackit.com/html/html_editors/tinymce_editor.cfm -// Page to test v3 http://www.imathas.com/editordemo/demo.html -if (typeof tinyMCE !== "undefined" && tinyMCE.majorVersion && tinyMCE.majorVersion >= 3 && tinyMCE.majorVersion <= 5) { - //console.log("Have TinyMCE"); - function TinyOnEditor(event, editor = null) { - let xEditorAdd = editor || event.editor; - - if (typeof xEditorAdd.settings.Grammalecte === "undefined") { - let aBtn; - let plugSep; - let bIsAdded = false; - if (tinyMCE.majorVersion >= 4) { - plugSep = " "; - aBtn = ["toolbar3", "toolbar2", "toolbar1", "toolbar"]; - } else if (tinyMCE.majorVersion >= 3) { - plugSep = ","; - aBtn = ["theme_advanced_buttons3", "theme_advanced_buttons2", "theme_advanced_buttons1", "theme_advanced_buttons1_add_before"]; - } - - let iBtn = 0; - let nBtn = aBtn.length; - for (let eBtn of aBtn) { - if (!bIsAdded && (typeof xEditorAdd.settings[eBtn] !== "undefined" || iBtn == nBtn)) { - bIsAdded = true; - if (typeof xEditorAdd.settings[eBtn] !== "undefined" && xEditorAdd.settings[eBtn] !== "") { - xEditorAdd.settings[eBtn] = (xEditorAdd.settings[eBtn] + plugSep + "Grammalecte").trim(); - } else { - let m = /(.*)([0-9])/.exec(eBtn); - if (m.length === 3 && parseInt(m[2]) > 1 && xEditorAdd.settings[eBtn] === "") { - eBtn = m[1] + (parseInt(m[2]) - 1); - xEditorAdd.settings[eBtn] = (xEditorAdd.settings[eBtn] + plugSep + "Grammalecte").trim(); - } else { - xEditorAdd.settings[eBtn] = "Grammalecte"; - } - } - } - iBtn++; - } - xEditorAdd.settings.Grammalecte = true; - //xEditorAdd.settings.theme_advanced_buttons1_add_before = "Grammalecte"; - } - - xEditorAdd.addButton("Grammalecte", { - text: "", - icon: false, - image: browserURL + "img/logo-16.png", - //"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAC8UlEQVQ4jX3TbUgTcRwH8P89ddu5u9tt082aZmpFEU4tFz0QGTUwCi0heniR9MSUIKRaD0RvIlKigsooo+iNFa0XJYuwIjEK19OcDtPElsG0ktyp591t7u7+vUh7MPX3+vf5/n8/+P0BmKJIPUUVlh2rdVVeesWlzEybqg+bFOsoylnqPmNavGFfknV2Omu2Lvja3vxAURKJib3opHizu8riLK6gjRyuKgmoSoMRFENRUqfXTzvBGK62LC2uoFkOl4RhjQ8+qWt7dPNE3sbdp+2LXbsGe9qb4rIo/BfwFy6nWQ4ThWGNDzbcfu29dMDh2nHU7CypYNLmzTda0/L5cNuzmDQi/A4Y27k6eQxLI79wS/11D0AAMNvs6XT6ojVJjJEgTbMy2BT77xBMp09KcpaWV1uc41jQoi0NdUHfjeOO9WWn7AVF7s7n986SithPJGeupBh2PCSP/xxqxAp3eq6wuUV7Wc6MSZIEhA8vHjbfOe/OcW3zmAuKy+nUzAyD2bow8ODaEROFq8AyZ5WBYdEZXGqGxZ61HJV+9HYCJRbTNA0QBA40HWunaKN5dKg/DBKxeCIe09Th/m4MJwiMSZmLEzMQAABQRuNqgu8NYX3doTcMpvCkLbtQZ2AJkrPOZG1zlnY13T+Hy9EehY90h57eqcorcZ/lctZuMzAsOjLEqwNv66/6vZcPYRBC+C3cGaBxhSet2av1BpYgTTY7k5y2JPT41slIR6Axv8R9nnOs+4Pf+2r992uOxGVJwgAAAEINfgt3BGgsESWtWas1iGDyl+CT/u7WpvxNFRc4x7qtBoZFhSFejb7z1fq9NYfjsiT+cwcQavBruCOgU4SIGo18amuoq3Js3FNlynVtH385+s53ze+t8cRkURx3yMTTRBAEQVAUXbFlf3XystJKA2NExeFBdWASDAAA+MQACCEEmqbJ0b6PMC7JwhDU8YFHV5u9NZ64LErT/oW/63tPV6uJwmKoOND78u7Fg5NhAAD4CVbzY9cwrWQrAAAAAElFTkSuQmCC", - onclick: function(e) { - //console.log( xEditorAdd.getContent() ); - //console.log( xEditorAdd.getBody().innerText ) - let sText = xEditorAdd.getBody().innerText; - let iframeElement; - if (typeof xEditorAdd.iframeElement !== "undefined" && typeof xEditorAdd.iframeElement.id !== "undefined") { - iframeElement = xEditorAdd.iframeElement.id; - } else if (typeof xEditorAdd.editorId !== "undefined") { - iframeElement = xEditorAdd.editorId + "_ifr"; - } - - sendToGrammalecte({ spellcheck: sText, iframe: iframeElement }); - } - }); - } - + +// Page to test v4 https://www.quackit.com/html/html_editors/tinymce_editor.cfm +// https://www.responsivefilemanager.com/demo.php + +// Page to test v3 http://www.imathas.com/editordemo/demo.html + +function TinyOnEditor(event, editor = null) { + let xEditorAdd = editor || event.editor; + //console.log(xEditorAdd); + + if (typeof xEditorAdd.settings.Grammalecte === "undefined") { + let aBtn; + let plugSep; + let bIsAdded = false; + if (tinyMCE.majorVersion >= 4) { + plugSep = " "; + aBtn = ["toolbar3", "toolbar2", "toolbar1", "toolbar"]; + } else if (tinyMCE.majorVersion >= 3) { + plugSep = ","; + aBtn = ["theme_advanced_buttons3", "theme_advanced_buttons2", "theme_advanced_buttons1", "theme_advanced_buttons1_add_before"]; + } + + let eBtn; + let iBtn = 0; + let nBtn = aBtn.length; + for (eBtn of aBtn) { + if (!bIsAdded && (typeof xEditorAdd.settings[eBtn] !== "undefined" || iBtn == nBtn)) { + bIsAdded = true; + if (typeof xEditorAdd.settings[eBtn] !== "undefined" && xEditorAdd.settings[eBtn] !== "") { + xEditorAdd.settings[eBtn] = (xEditorAdd.settings[eBtn] + plugSep + "Grammalecte").trim(); + } else { + let m = /(.*)([0-9])/.exec(eBtn); + if (m.length === 3 && parseInt(m[2]) > 1 && xEditorAdd.settings[eBtn] === "") { + eBtn = m[1] + (parseInt(m[2]) - 1); + xEditorAdd.settings[eBtn] = (xEditorAdd.settings[eBtn] + plugSep + "Grammalecte").trim(); + } else { + xEditorAdd.settings[eBtn] = "Grammalecte"; + } + } + } + iBtn++; + } + if (!bIsAdded) { + //Valeur par defaut + xEditorAdd.settings[eBtn] = + "undo redo | styleselect | bold italic | alignleft" + + " aligncenter alignright alignjustify | " + + " bullist numlist outdent indent | link image" + + " Grammalecte"; + } + xEditorAdd.settings["Grammalecte"] = true; + } + + xEditorAdd.addButton("Grammalecte", { + text: "", + icon: false, + image: browserURL + "img/logo-16.png", + //"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAC8UlEQVQ4jX3TbUgTcRwH8P89ddu5u9tt082aZmpFEU4tFz0QGTUwCi0heniR9MSUIKRaD0RvIlKigsooo+iNFa0XJYuwIjEK19OcDtPElsG0ktyp591t7u7+vUh7MPX3+vf5/n8/+P0BmKJIPUUVlh2rdVVeesWlzEybqg+bFOsoylnqPmNavGFfknV2Omu2Lvja3vxAURKJib3opHizu8riLK6gjRyuKgmoSoMRFENRUqfXTzvBGK62LC2uoFkOl4RhjQ8+qWt7dPNE3sbdp+2LXbsGe9qb4rIo/BfwFy6nWQ4ThWGNDzbcfu29dMDh2nHU7CypYNLmzTda0/L5cNuzmDQi/A4Y27k6eQxLI79wS/11D0AAMNvs6XT6ojVJjJEgTbMy2BT77xBMp09KcpaWV1uc41jQoi0NdUHfjeOO9WWn7AVF7s7n986SithPJGeupBh2PCSP/xxqxAp3eq6wuUV7Wc6MSZIEhA8vHjbfOe/OcW3zmAuKy+nUzAyD2bow8ODaEROFq8AyZ5WBYdEZXGqGxZ61HJV+9HYCJRbTNA0QBA40HWunaKN5dKg/DBKxeCIe09Th/m4MJwiMSZmLEzMQAABQRuNqgu8NYX3doTcMpvCkLbtQZ2AJkrPOZG1zlnY13T+Hy9EehY90h57eqcorcZ/lctZuMzAsOjLEqwNv66/6vZcPYRBC+C3cGaBxhSet2av1BpYgTTY7k5y2JPT41slIR6Axv8R9nnOs+4Pf+2r992uOxGVJwgAAAEINfgt3BGgsESWtWas1iGDyl+CT/u7WpvxNFRc4x7qtBoZFhSFejb7z1fq9NYfjsiT+cwcQavBruCOgU4SIGo18amuoq3Js3FNlynVtH385+s53ze+t8cRkURx3yMTTRBAEQVAUXbFlf3XystJKA2NExeFBdWASDAAA+MQACCEEmqbJ0b6PMC7JwhDU8YFHV5u9NZ64LErT/oW/63tPV6uJwmKoOND78u7Fg5NhAAD4CVbzY9cwrWQrAAAAAElFTkSuQmCC", + onclick: function(e) { + //console.log( xEditorAdd.getContent() ); + //console.log( xEditorAdd.getBody().innerText ) + let sText = xEditorAdd.getBody().innerText; + let iframeElement; + if (typeof xEditorAdd.iframeElement !== "undefined" && typeof xEditorAdd.iframeElement.id !== "undefined") { + iframeElement = xEditorAdd.iframeElement.id; + } else if (typeof xEditorAdd.editorId !== "undefined") { + iframeElement = xEditorAdd.editorId + "_ifr"; + } + + sendToGrammalecte({ spellcheck: sText, iframe: iframeElement }); + } + }); +} + +function TinyInPage() { + for (var i = tinyMCE.editors.length - 1; i > -1; i--) { + let idTiny = tinyMCE.editors[i].id; + if (typeof tinyMCE.editors[i].settings.Grammalecte === "undefined") { + TinyIDInPage(idTiny); + } + } +} + +function TinyIDInPage(idTiny) { + if (tinyMCE.majorVersion >= 4) { + tinyMCE.EditorManager.execCommand("mceFocus", true, idTiny); + tinyMCE.EditorManager.execCommand("mceRemoveEditor", true, idTiny); + tinyMCE.EditorManager.execCommand("mceAddEditor", false, idTiny); + } else if (tinyMCE.majorVersion >= 3) { + tinyMCE.execCommand("mceFocus", false, idTiny); + tinyMCE.execCommand("mceRemoveControl", true, idTiny); + tinyMCE.execCommand("mceAddControl", false, idTiny); + } +} + +if (typeof tinyMCE !== "undefined" && tinyMCE.majorVersion && tinyMCE.majorVersion >= 3 && tinyMCE.majorVersion <= 5) { + //console.log("Have TinyMCE"); if (tinyMCE.majorVersion >= 4) { tinyMCE.on("AddEditor", TinyOnEditor); } else if (tinyMCE.majorVersion >= 3) { tinyMCE.onAddEditor.add(TinyOnEditor); } - - for (var i = tinyMCE.editors.length - 1; i > -1; i--) { - let idTiny = tinyMCE.editors[i].id; - if (tinyMCE.majorVersion >= 4) { - tinyMCE.execCommand("mceRemoveEditor", true, idTiny); - tinyMCE.execCommand("mceAddEditor", true, idTiny); - } else if (tinyMCE.majorVersion >= 3) { - //tinyMCE.editors[i].onInit.add(TinyOnEditor); - tinyMCE.execCommand("mceRemoveControl", true, idTiny); - tinyMCE.execCommand("mceAddControl", true, idTiny); - } - //tinyMCE.settings = old_global_settings; - } + try { + TinyInPage(); + } catch (error) {} } /* // ! In the webpage script : document.addEventListener('GrammalecteIsLoaded', function() { // Le gestionnaire d'évènement est prêt! Index: gc_lang/fr/webext/content_scripts/init.js ================================================================== --- gc_lang/fr/webext/content_scripts/init.js +++ gc_lang/fr/webext/content_scripts/init.js @@ -11,23 +11,21 @@ No SharedWorker, no images allowed for now… */ "use strict"; - -function showError (e) { +function showError(e) { console.error(e.fileName + "\n" + e.name + "\nline: " + e.lineNumber + "\n" + e.message); } // Chrome don’t follow the W3C specification: // https://browserext.github.io/browserext/ let bChrome = false; -if (typeof(browser) !== "object") { +if (typeof browser !== "object") { var browser = chrome; bChrome = true; } - /* function loadImage (sContainerClass, sImagePath) { let xRequest = new XMLHttpRequest(); xRequest.open('GET', browser.extension.getURL("")+sImagePath, false); @@ -40,13 +38,13 @@ oElem.appendChild(img); }); } */ +var tinyAdd = {}; const oGrammalecte = { - nMenu: 0, lMenu: [], oTFPanel: null, oLxgPanel: null, @@ -58,31 +56,35 @@ xObserver: null, sExtensionUrl: null, - listenRightClick: function () { + 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); + document.addEventListener( + "contextmenu", + function(xEvent) { + this.xRightClickedNode = xEvent.target; + }.bind(this), + true + ); }, - clearRightClickedNode: function () { + clearRightClickedNode: function() { this.xRightClickedNode = null; }, - createMenus: function () { + createMenus: function() { 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 (dOptions) { + _createMenus: function(dOptions) { if (dOptions.hasOwnProperty("ui_options")) { dOptions = dOptions.ui_options; if (dOptions.textarea) { for (let xNode of document.getElementsByTagName("textarea")) { if (xNode.style.display !== "none" && xNode.style.visibility !== "hidden" && xNode.getAttribute("spellcheck") !== "false") { @@ -98,24 +100,60 @@ } } } }, - observePage: function () { + 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") { - oGrammalecte.lMenu.push(new GrammalecteMenu(oGrammalecte.nMenu, mutation.addedNodes[i])); + function NodeTinyMCE(xNode) { + let parentNode = xNode.parentNode; //mutation.target + if ( + typeof xNode !== "undefined" && + typeof xNode.id !== "undefined" && + typeof tinyAdd[xNode.id] === "undefined" && + (parentNode.classList.contains("mce-edit-area") || parentNode.classList.contains("mceIframeContainer")) + ) { + //console.log(tinyAdd, xNode, parentNode, parentNode.classList); + tinyAdd[xNode.id] = true; + sendToWebpage({ tiny: xNode.id.replace("_ifr", "") }); + } + } + this.xObserver = new MutationObserver(function(mutations) { + mutations.forEach(function(mutation) { + for (let i = 0; i < mutation.addedNodes.length; i++) { + let MutationNode = mutation.addedNodes[i]; + let tagName = MutationNode.tagName; + + if (tagName == "TEXTAREA") { + oGrammalecte.lMenu.push(new GrammalecteMenu(oGrammalecte.nMenu, MutationNode)); + oGrammalecte.nMenu += 1; + } else if (tagName == "IFRAME") { + NodeTinyMCE(MutationNode); + } else if ((tagName == "DIV" || tagName == "SPAN") && MutationNode.hasAttribute && MutationNode.hasAttribute("contenteditable")) { + oGrammalecte.lMenu.push(new GrammalecteMenu(oGrammalecte.nMenu, MutationNode)); oGrammalecte.nMenu += 1; - } else if (mutation.addedNodes[i].getElementsByTagName) { - for (let xNode of mutation.addedNodes[i].getElementsByTagName("textarea")) { + } else if (MutationNode.getElementsByTagName) { + for (let xNode of MutationNode.getElementsByTagName("textarea")) { oGrammalecte.lMenu.push(new GrammalecteMenu(oGrammalecte.nMenu, xNode)); oGrammalecte.nMenu += 1; + } + for (let xNode of MutationNode.getElementsByTagName("div")) { + if (xNode.hasAttribute && xNode.hasAttribute("contenteditable")){ + oGrammalecte.lMenu.push(new GrammalecteMenu(oGrammalecte.nMenu, xNode)); + oGrammalecte.nMenu += 1; + } + } + for (let xNode of MutationNode.getElementsByTagName("span")) { + if (xNode.hasAttribute && xNode.hasAttribute("contenteditable")){ + oGrammalecte.lMenu.push(new GrammalecteMenu(oGrammalecte.nMenu, xNode)); + oGrammalecte.nMenu += 1; + } + } + for (let xNode of MutationNode.getElementsByTagName("iframe")) { + NodeTinyMCE(xNode); } } } }); }); @@ -123,135 +161,142 @@ childList: true, subtree: true }); }, - rescanPage: function () { - if (this.oTFPanel !== null) { this.oTFPanel.hide(); } - if (this.oLxgPanel !== null) { this.oLxgPanel.hide(); } - if (this.oGCPanel !== null) { this.oGCPanel.hide(); } + rescanPage: function() { + if (this.oTFPanel !== null) { + this.oTFPanel.hide(); + } + if (this.oLxgPanel !== null) { + this.oLxgPanel.hide(); + } + if (this.oGCPanel !== null) { + this.oGCPanel.hide(); + } for (let oMenu of this.lMenu) { oMenu.deleteNodes(); } this.lMenu.length = 0; // to clear an array this.listenRightClick(); this.createMenus(); }, - createTFPanel: function () { + createTFPanel: function() { if (this.oTFPanel === null) { this.oTFPanel = new GrammalecteTextFormatter("grammalecte_tf_panel", "Formateur de texte", 760, 615, false); //this.oTFPanel.logInnerHTML(); this.oTFPanel.insertIntoPage(); - window.setTimeout(function(self){ - self.oTFPanel.adjustHeight(); - }, 50, this); + window.setTimeout( + function(self) { + self.oTFPanel.adjustHeight(); + }, + 50, + this + ); } }, - createLxgPanel: function () { + createLxgPanel: function() { if (this.oLxgPanel === null) { this.oLxgPanel = new GrammalecteLexicographer("grammalecte_lxg_panel", "Lexicographe", 500, 700); this.oLxgPanel.insertIntoPage(); } }, - createGCPanel: function () { + createGCPanel: function() { if (this.oGCPanel === null) { this.oGCPanel = new GrammalecteGrammarChecker("grammalecte_gc_panel", "Grammalecte", 500, 700); this.oGCPanel.insertIntoPage(); } }, - createMessageBox: function () { + createMessageBox: function() { if (this.oMessageBox === null) { this.oMessageBox = new GrammalecteMessageBox("grammalecte_message_box", "Grammalecte"); this.oMessageBox.insertIntoPage(); } }, - startGCPanel: function (xNode=null) { + startGCPanel: function(xNode = null) { this.createGCPanel(); this.oGCPanel.clear(); this.oGCPanel.show(); this.oGCPanel.start(xNode); this.oGCPanel.startWaitIcon(); }, - startLxgPanel: function () { + startLxgPanel: function() { this.createLxgPanel(); this.oLxgPanel.clear(); this.oLxgPanel.show(); this.oLxgPanel.startWaitIcon(); }, - startFTPanel: function (xNode=null) { + startFTPanel: function(xNode = null) { this.createTFPanel(); this.oTFPanel.start(xNode); this.oTFPanel.show(); }, - showMessage: function (sMessage) { + showMessage: function(sMessage) { this.createMessageBox(); this.oMessageBox.show(); this.oMessageBox.setMessage(sMessage); }, - getPageText: function () { + getPageText: function() { let sPageText = document.body.innerText; let nPos = sPageText.indexOf("__grammalecte_panel__"); if (nPos >= 0) { sPageText = sPageText.slice(0, nPos); } return sPageText; }, - createNode: function (sType, oAttr, oDataset=null) { + createNode: function(sType, oAttr, oDataset = null) { try { let xNode = document.createElement(sType); Object.assign(xNode, oAttr); if (oDataset) { Object.assign(xNode.dataset, oDataset); } return xNode; - } - catch (e) { + } catch (e) { showError(e); } }, - createStyle: function (sLinkCss, sLinkId=null, xNodeToAppendTo=null) { + createStyle: function(sLinkCss, sLinkId = null, xNodeToAppendTo = null) { try { let xNode = document.createElement("link"); Object.assign(xNode, { rel: "stylesheet", type: "text/css", media: "all", href: this.sExtensionUrl + sLinkCss }); if (sLinkId) { - Object.assign(xNode, {id: sLinkId}); + Object.assign(xNode, { id: sLinkId }); } if (xNodeToAppendTo) { xNodeToAppendTo.appendChild(xNode); } return xNode; - } - catch (e) { + } catch (e) { showError(e); } } }; - /* Connexion to the background */ -let xGrammalectePort = browser.runtime.connect({name: "content-script port"}); +let xGrammalectePort = browser.runtime.connect({ name: "content-script port" }); -xGrammalectePort.onMessage.addListener(function (oMessage) { - let {sActionDone, result, dInfo, bEnd, bError} = oMessage; +xGrammalectePort.onMessage.addListener(function(oMessage) { + let { sActionDone, result, dInfo, bEnd, bError } = oMessage; let sText = ""; switch (sActionDone) { case "init": oGrammalecte.sExtensionUrl = oMessage.sUrl; // Start @@ -285,25 +330,27 @@ */ // Grammar checker commands case "rightClickGCEditableNode": if (oGrammalecte.xRightClickedNode !== null) { oGrammalecte.startGCPanel(oGrammalecte.xRightClickedNode); - sText = (oGrammalecte.xRightClickedNode.tagName == "TEXTAREA") ? oGrammalecte.xRightClickedNode.value : oGrammalecte.xRightClickedNode.innerText; + sText = oGrammalecte.xRightClickedNode.tagName == "TEXTAREA" ? oGrammalecte.xRightClickedNode.value : oGrammalecte.xRightClickedNode.innerText; xGrammalectePort.postMessage({ sCommand: "parseAndSpellcheck", - dParam: {sText: sText, sCountry: "FR", bDebug: false, bContext: false}, - dInfo: {sTextAreaId: oGrammalecte.xRightClickedNode.id} + dParam: { sText: sText, sCountry: "FR", bDebug: false, bContext: false }, + dInfo: { sTextAreaId: oGrammalecte.xRightClickedNode.id } }); } else { - oGrammalecte.showMessage("Erreur. Le node sur lequel vous avez cliqué n’a pas pu être identifié. Sélectionnez le texte à corriger et relancez le correcteur via le menu contextuel."); + oGrammalecte.showMessage( + "Erreur. Le node sur lequel vous avez cliqué n’a pas pu être identifié. Sélectionnez le texte à corriger et relancez le correcteur via le menu contextuel." + ); } break; case "rightClickGCPage": oGrammalecte.startGCPanel(); xGrammalectePort.postMessage({ sCommand: "parseAndSpellcheck", - dParam: {sText: oGrammalecte.getPageText(), sCountry: "FR", bDebug: false, bContext: false}, + dParam: { sText: oGrammalecte.getPageText(), sCountry: "FR", bDebug: false, bContext: false }, dInfo: {} }); break; case "rightClickGCSelectedText": oGrammalecte.startGCPanel(); @@ -311,25 +358,27 @@ break; // Lexicographer commands case "rightClickLxgEditableNode": if (oGrammalecte.xRightClickedNode !== null) { oGrammalecte.startLxgPanel(); - sText = (oGrammalecte.xRightClickedNode.tagName == "TEXTAREA") ? oGrammalecte.xRightClickedNode.value : oGrammalecte.xRightClickedNode.innerText; + sText = oGrammalecte.xRightClickedNode.tagName == "TEXTAREA" ? oGrammalecte.xRightClickedNode.value : oGrammalecte.xRightClickedNode.innerText; xGrammalectePort.postMessage({ sCommand: "getListOfTokens", - dParam: {sText: sText}, - dInfo: {sTextAreaId: oGrammalecte.xRightClickedNode.id} + dParam: { sText: sText }, + dInfo: { sTextAreaId: oGrammalecte.xRightClickedNode.id } }); } else { - oGrammalecte.showMessage("Erreur. Le node sur lequel vous avez cliqué n’a pas pu être identifié. Sélectionnez le texte à analyser et relancez le lexicographe via le menu contextuel."); + oGrammalecte.showMessage( + "Erreur. Le node sur lequel vous avez cliqué n’a pas pu être identifié. Sélectionnez le texte à analyser et relancez le lexicographe via le menu contextuel." + ); } break; case "rightClickLxgPage": oGrammalecte.startLxgPanel(); xGrammalectePort.postMessage({ sCommand: "getListOfTokens", - dParam: {sText: oGrammalecte.getPageText()}, + dParam: { sText: oGrammalecte.getPageText() }, dInfo: {} }); break; case "rightClickLxgSelectedText": oGrammalecte.startLxgPanel(); @@ -339,11 +388,13 @@ case "rightClickTFEditableNode": if (oGrammalecte.xRightClickedNode !== null) { if (oGrammalecte.xRightClickedNode.tagName == "TEXTAREA") { oGrammalecte.startFTPanel(oGrammalecte.xRightClickedNode); } else { - oGrammalecte.showMessage("Cette zone de texte n’est pas réellement un champ de formulaire, mais un node HTML éditable. Le formateur de texte n’est pas disponible pour ce type de champ de saisie."); + oGrammalecte.showMessage( + "Cette zone de texte n’est pas réellement un champ de formulaire, mais un node HTML éditable. Le formateur de texte n’est pas disponible pour ce type de champ de saisie." + ); } } else { oGrammalecte.showMessage("Erreur. Le node sur lequel vous avez cliqué n’a pas pu être identifié."); } break;