Index: gc_lang/fr/webext/background.js
==================================================================
--- gc_lang/fr/webext/background.js
+++ gc_lang/fr/webext/background.js
@@ -41,10 +41,11 @@
case "parse":
case "parseAndSpellcheck":
case "parseAndSpellcheck1":
case "getListOfTokens":
case "getSpellSuggestions":
+ case "getVerb":
// send result to content script
if (typeof(dInfo.iReturnPort) === "number") {
let xPort = dConnx.get(dInfo.iReturnPort);
xPort.postMessage(e.data);
} else {
@@ -247,10 +248,11 @@
case "parse":
case "parseAndSpellcheck":
case "parseAndSpellcheck1":
case "getListOfTokens":
case "getSpellSuggestions":
+ case "getVerb":
oRequest.dInfo.iReturnPort = iPortId; // we pass the id of the return port to receive answer
xGCEWorker.postMessage(oRequest);
break;
case "openURL":
browser.tabs.create({url: dParam.sURL});
ADDED gc_lang/fr/webext/content_scripts/html_src.js
Index: gc_lang/fr/webext/content_scripts/html_src.js
==================================================================
--- /dev/null
+++ gc_lang/fr/webext/content_scripts/html_src.js
@@ -0,0 +1,160 @@
+// Javascript
+
+"use strict";
+
+/*
+ No way to import HTML in content scripts.
+ Waiting for: https://bugzilla.mozilla.org/show_bug.cgi?id=1364404
+
+ @Reviewers:
+ This file only defines HTML nodes in const values
+*/
+
+
+const sGrammalecteConjugueurHTML = `
+
+
+
+
+
+
+
+
+ Négative
+ · Interrogative
+ · Féminin
+ Pronominal
+ · Temps composés
+
+ ❦
+
+
+
+
+
+
+
Impératif
+
Présent
+
+
+
+
+
+
+
+
+
+
Participes passés
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Indicatif
+
+
+
Imparfait
+
+
+
+
+
+
+
+
+
Passé simple
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Subjonctif
+
+
+
Imparfait
+
+
+
+
+
+
+
+
+
+
+
+
+
+`;
+
+
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
@@ -309,10 +309,13 @@
}
break;
case "getSpellSuggestions":
oGrammalecte.oGCPanel.oTooltip.setSpellSuggestionsFor(result.sWord, result.aSugg, result.iSuggBlock, dInfo.sErrorId);
break;
+ case "getVerb":
+ oGrammalecte.oGCPanel.conjugateWith(result.oVerb, result.oConjTable);
+ break;
/*
Commands received from the context menu
(Context menu are initialized in background)
*/
// Grammar checker commands
Index: gc_lang/fr/webext/content_scripts/panel.js
==================================================================
--- gc_lang/fr/webext/content_scripts/panel.js
+++ gc_lang/fr/webext/content_scripts/panel.js
@@ -99,18 +99,20 @@
insertIntoPage () {
if (this.bShadow) {
oGrammalecte.createStyle("content_scripts/panel.css", null, this.xShadow);
oGrammalecte.createStyle("content_scripts/panel_gc.css", null, this.xShadow);
oGrammalecte.createStyle("content_scripts/panel_lxg.css", null, this.xShadow);
+ oGrammalecte.createStyle("content_scripts/panel_conj.css", null, this.xShadow);
oGrammalecte.createStyle("content_scripts/panel_tf.css", null, this.xShadow);
this.xShadow.appendChild(this.xPanel);
document.body.appendChild(this.xShadowPanel);
} else {
if (!document.getElementById("grammalecte_csspanel")) {
oGrammalecte.createStyle("content_scripts/panel.css", "grammalecte_csspanel", document.head);
oGrammalecte.createStyle("content_scripts/panel_gc.css", null, document.head);
oGrammalecte.createStyle("content_scripts/panel_lxg.css", null, document.head);
+ oGrammalecte.createStyle("content_scripts/panel_conj.css", null, document.head);
oGrammalecte.createStyle("content_scripts/panel_tf.css", null, document.head);
}
document.body.appendChild(this.xPanel);
}
}
ADDED gc_lang/fr/webext/content_scripts/panel_conj.css
Index: gc_lang/fr/webext/content_scripts/panel_conj.css
==================================================================
--- /dev/null
+++ gc_lang/fr/webext/content_scripts/panel_conj.css
@@ -0,0 +1,94 @@
+/*
+ CSS Document
+*/
+
+div.grammalecte_clearer {
+ clear: both;
+ font-size: 0;
+ height: 0;
+}
+
+
+h1.grammalecte_conj_title {
+ margin: 5px 0 2px 0;
+ color: hsl(210, 50%, 50%);
+ font: bold 30px Tahoma, "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", sans-serif;
+ text-align: center;
+}
+h2.grammalecte_conj_title {
+ margin: 5px 0 2px 0;
+ color: hsl(0, 50%, 50%);
+ font: bold 16px Tahoma, "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", sans-serif;
+}
+h3.grammalecte_conj_title {
+ margin: 5px 0 2px 0;
+ color: hsl(210, 50%, 50%);
+ font: bold 14px Tahoma, "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", sans-serif;
+}
+
+div#grammalecte_conj_verb_info {
+ text-align: center;
+ color: hsl(210, 00%, 40%);
+}
+
+div.grammalecte_conj_container {
+ display: flex;
+ flex-direction: row;
+ flex-wrap: nowrap;
+ justify-content: center;
+ align-items: flex-start;
+}
+
+div.grammalecte_conj_column {
+ width: 50%;
+ padding: 0 10px;
+ font-size: 12px;
+}
+
+
+input#grammalecte_conj_verb {
+ display: inline-block;
+ width: 230px;
+ margin-left: 5px;
+ padding: 5px 10px;
+ border: 2px solid hsl(0, 0%, 80%);
+ border-radius: 3px;
+ height: 20px;
+ background: transparent;
+ font: normal 18px Tahoma, "Ubuntu Condensed";
+ color: hsl(0, 0%, 30%);
+}
+input[placeholder]#grammalecte_conj_verb {
+ color: hsl(0, 0%, 70%);
+}
+
+div#grammalecte_conj_button {
+ display: inline-block;
+ padding: 7px 10px;
+ font-size: 18px;
+ background-color: hsl(0, 30%, 30%);
+ color: hsl(0, 30%, 60%);
+ border-radius: 3px;
+ text-transform: uppercase;
+ text-align: center;
+ text-decoration: none;
+ cursor: pointer;
+}
+div#grammalecte_conj_button:hover {
+ background-color: hsl(0, 60%, 40%);
+ color: hsl(0, 60%, 70%);
+ box-shadow: 0 0 2px hsl(0, 60%, 50%);
+}
+
+div#grammalecte_conj_options {
+ margin: 10px 0 0 5px;
+ font-size: 16px;
+ text-align: center;
+}
+
+div#grammalecte_conj_note {
+ margin: 10px 20px;
+ font-size: 11px;
+ color: hsl(0, 0%, 60%);
+ text-align: center;
+}
Index: gc_lang/fr/webext/content_scripts/panel_gc.js
==================================================================
--- gc_lang/fr/webext/content_scripts/panel_gc.js
+++ gc_lang/fr/webext/content_scripts/panel_gc.js
@@ -62,10 +62,16 @@
this.oNodeControl = new GrammalecteNodeControl();
// Lexicographer
this.nLxgCount = 0;
this.xLxgPanelContent = oGrammalecte.createNode("div", {id: "grammalecte_lxg_panel_content"});
this.xPanelContent.appendChild(this.xLxgPanelContent);
+ // Conjugueur
+ this.xConjPanelContent = oGrammalecte.createNode("div", {id: "grammalecte_conj_panel_content"});
+ this.xConjPanelContent.innerHTML = sGrammalecteConjugueurHTML; // @Reviewers: sGrammalecteConjugueurHTML is a const value defined in
+ this.xPanelContent.appendChild(this.xConjPanelContent);
+ this.sVerb = "";
+ this.bListenConj = false;
}
createMenu () {
this.xMenu = oGrammalecte.createNode("div", {className: "grammalecte_panel_menu"});
this.xTFButton = oGrammalecte.createNode("div", {className: "grammalecte_menu_button", textContent: "Formateur de texte"});
@@ -95,12 +101,16 @@
dParam: {sText: this.getParsedText()},
dInfo: ((this.xNode) ? {sTextAreaId: this.xNode.id} : {})
});
}
};
- this.xConjButton.onclick = () => { xGrammalectePort.postMessage({sCommand: "openConjugueurTab", dParam: null, dInfo: null}); };
- this.xLEButton.onclick = () => { xGrammalectePort.postMessage({sCommand: "openLexiconEditor", dParam: null, dInfo: null}); };
+ this.xConjButton.onclick = () => {
+ this.showConjugueur();
+ };
+ this.xLEButton.onclick = () => {
+ xGrammalectePort.postMessage({sCommand: "openLexiconEditor", dParam: null, dInfo: null});
+ };
this.xMenu.appendChild(this.xTFButton)
this.xMenu.appendChild(this.xEditorButton)
this.xMenu.appendChild(this.xLxgButton)
this.xMenu.appendChild(this.xConjButton)
this.xMenu.appendChild(this.xLEButton)
@@ -137,25 +147,41 @@
return oGrammalecte.getPageText();
}
}
showEditor () {
- this.xGCPanelContent.style.display = "block";
- this.xLxgPanelContent.style.display = "none";
- this.xEditorButton.style.textShadow = "2px 0 0 hsla(210, 40%, 35%, .5), -2px 0 0 hsla(210, 40%, 35%, .5), 0 2px 0 hsla(210, 40%, 35%, .5), 0 -2px 0 hsla(210, 40%, 35%, .5), 1px 1px hsla(210, 40%, 35%, .5), -1px -1px 0 hsla(210, 40%, 35%, .5), 1px -1px 0 hsla(210, 40%, 35%, .5), -1px 1px 0 hsla(210, 40%, 35%, .5)";
- this.xLxgButton.style.textShadow = "";
- this.xEditorButton.style.backgroundColor = "hsl(210, 60%, 40%)";
- this.xLxgButton.style.backgroundColor = "";
+ this.switchContentOn(this.xGCPanelContent, this.xEditorButton);
+ this.switchContentOff(this.xLxgPanelContent, this.xLxgButton);
+ this.switchContentOff(this.xConjPanelContent, this.xConjButton);
}
showLexicographer () {
- this.xGCPanelContent.style.display = "none";
- this.xLxgPanelContent.style.display = "block";
- this.xEditorButton.style.textShadow = "";
- this.xLxgButton.style.textShadow = "2px 0 0 hsla(210, 40%, 35%, .5), -2px 0 0 hsla(210, 40%, 35%, .5), 0 2px 0 hsla(210, 40%, 35%, .5), 0 -2px 0 hsla(210, 40%, 35%, .5), 1px 1px hsla(210, 40%, 35%, .5), -1px -1px 0 hsla(210, 40%, 35%, .5), 1px -1px 0 hsla(210, 40%, 35%, .5), -1px 1px 0 hsla(210, 30%, 35%, .5)";
- this.xEditorButton.style.backgroundColor = "";
- this.xLxgButton.style.backgroundColor = "hsl(210, 60%, 40%)";
+ this.switchContentOff(this.xGCPanelContent, this.xEditorButton);
+ this.switchContentOn(this.xLxgPanelContent, this.xLxgButton);
+ this.switchContentOff(this.xConjPanelContent, this.xConjButton);
+ }
+
+ showConjugueur () {
+ this.switchContentOff(this.xGCPanelContent, this.xEditorButton);
+ this.switchContentOff(this.xLxgPanelContent, this.xLxgButton);
+ this.switchContentOn(this.xConjPanelContent, this.xConjButton);
+ this.listenConj();
+ if (!this.sVerb) {
+ this.conjugateVerb("être");
+ }
+ }
+
+ switchContentOn (xContent, xNodeButton) {
+ xContent.style.display = "block";
+ xNodeButton.style.backgroundColor = "hsl(210, 60%, 40%)";
+ xNodeButton.style.textShadow = "2px 0 0 hsla(210, 40%, 35%, .5), -2px 0 0 hsla(210, 40%, 35%, .5), 0 2px 0 hsla(210, 40%, 35%, .5), 0 -2px 0 hsla(210, 40%, 35%, .5), 1px 1px hsla(210, 40%, 35%, .5), -1px -1px 0 hsla(210, 40%, 35%, .5), 1px -1px 0 hsla(210, 40%, 35%, .5), -1px 1px 0 hsla(210, 30%, 35%, .5)";
+ }
+
+ switchContentOff (xContent, xNodeButton) {
+ xContent.style.display = "none";
+ xNodeButton.style.backgroundColor = "";
+ xNodeButton.style.textShadow = "";
}
clear () {
while (this.xParagraphList.firstChild) {
this.xParagraphList.removeChild(this.xParagraphList.firstChild);
@@ -463,10 +489,215 @@
let xPanelContent = this.xParent.getElementById('grammalecte_panel_content');
for (let xNode of xPanelContent.getElementsByClassName(sClass)) {
xNode.hidden = bHidden;
}
}
+
+ // Conjugueur
+
+ listenConj () {
+ if (!this.bListenConj) {
+ // button
+ this.xParent.getElementById('grammalecte_conj_button').addEventListener("click", (e) => { this.conjugateVerb(); });
+ // text field
+ this.xParent.getElementById('grammalecte_conj_verb').addEventListener("change", (e) => { this.conjugateVerb(); });
+ // options
+ this.xParent.getElementById('grammalecte_conj_oneg').addEventListener("click", (e) => { this.updateConj(); });
+ this.xParent.getElementById('grammalecte_conj_opro').addEventListener("click", (e) => { this.updateConj(); });
+ this.xParent.getElementById('grammalecte_conj_oint').addEventListener("click", (e) => { this.updateConj(); });
+ this.xParent.getElementById('grammalecte_conj_ofem').addEventListener("click", (e) => { this.updateConj(); });
+ this.xParent.getElementById('grammalecte_conj_otco').addEventListener("click", (e) => { this.updateConj(); });
+ this.bListenConj = true;
+ }
+ }
+
+ conjugateVerb (sVerb="") {
+ try {
+ if (!sVerb) {
+ sVerb = this.xParent.getElementById('grammalecte_conj_verb').value;
+ }
+ this.xParent.getElementById('grammalecte_conj_oneg').checked = false;
+ this.xParent.getElementById('grammalecte_conj_opro').checked = false;
+ this.xParent.getElementById('grammalecte_conj_oint').checked = false;
+ this.xParent.getElementById('grammalecte_conj_otco').checked = false;
+ this.xParent.getElementById('grammalecte_conj_ofem').checked = false;
+
+ // request analyzing
+ sVerb = sVerb.trim().toLowerCase().replace(/’/g, "'").replace(/ +/g, " ");
+ if (sVerb) {
+ if (sVerb.startsWith("ne pas ")) {
+ this.xParent.getElementById('grammalecte_conj_oneg').checked = true;
+ sVerb = sVerb.slice(7);
+ }
+ if (sVerb.startsWith("se ")) {
+ this.xParent.getElementById('grammalecte_conj_opro').checked = true;
+ sVerb = sVerb.slice(3);
+ } else if (sVerb.startsWith("s'")) {
+ this.xParent.getElementById('grammalecte_conj_opro').checked = true;
+ sVerb = sVerb.slice(2);
+ }
+ if (sVerb.endsWith("?")) {
+ this.xParent.getElementById('grammalecte_conj_oint').checked = true;
+ sVerb = sVerb.slice(0,-1).trim();
+ }
+ if (sVerb) {
+ this.sVerb = sVerb;
+ this.updateConj();
+ } else {
+ this.xParent.getElementById('grammalecte_conj_verb').value = "";
+ }
+ }
+ }
+ catch (e) {
+ console.error(e.fileName + "\n" + e.name + "\nline: " + e.lineNumber + "\n" + e.message);
+ }
+ }
+
+ updateConj () {
+ let bPro = this.xParent.getElementById('grammalecte_conj_opro').checked;
+ let bNeg = this.xParent.getElementById('grammalecte_conj_oneg').checked;
+ let bTpsCo = this.xParent.getElementById('grammalecte_conj_otco').checked;
+ let bInt = this.xParent.getElementById('grammalecte_conj_oint').checked;
+ let bFem = this.xParent.getElementById('grammalecte_conj_ofem').checked;
+ if (this.sVerb) {
+ console.log("updateConj send");
+ xGrammalectePort.postMessage({
+ sCommand: "getVerb",
+ dParam: {sVerb: this.sVerb, bPro: bPro, bNeg: bNeg, bTpsCo: bTpsCo, bInt: bInt, bFem: bFem},
+ dInfo: {}
+ });
+ }
+ }
+
+ conjugateWith (oVerb, oConjTable) {
+ // function called when results come from the Worker
+ if (oVerb) {
+ this.xParent.getElementById('grammalecte_conj_verb').style = "color: #999999;";
+ this.xParent.getElementById('grammalecte_conj_verb').value = "";
+ this.xParent.getElementById('grammalecte_conj_verb_title').textContent = oVerb.sVerb;
+ this.xParent.getElementById('grammalecte_conj_verb_info').textContent = oVerb.sInfo;
+ this.xParent.getElementById('grammalecte_conj_opro').textContent = oVerb.sProLabel;
+ if (oVerb.bUncomplete) {
+ this.xParent.getElementById('grammalecte_conj_opro').checked = false;
+ this.xParent.getElementById('grammalecte_conj_opro').disabled = true;
+ this.xParent.getElementById('grammalecte_conj_opro_lbl').style = "color: #CCC;";
+ this.xParent.getElementById('grammalecte_conj_otco').checked = false;
+ this.xParent.getElementById('grammalecte_conj_otco').disabled = true;
+ this.xParent.getElementById('grammalecte_conj_otco_lbl').style = "color: #CCC;";
+ this.xParent.getElementById('grammalecte_conj_note').textContent = "Ce verbe n’a pas encore été vérifié. C’est pourquoi les options “pronominal” et “temps composés” sont désactivées.";
+ } else {
+ this.xParent.getElementById('grammalecte_conj_otco').disabled = false;
+ this.xParent.getElementById('grammalecte_conj_otco_lbl').style = "color: #000;";
+ if (oVerb.nPronominable == 0) {
+ this.xParent.getElementById('grammalecte_conj_opro').checked = false;
+ this.xParent.getElementById('grammalecte_conj_opro').disabled = false;
+ this.xParent.getElementById('grammalecte_conj_opro_lbl').style = "color: #000;";
+ } else if (oVerb.nPronominable == 1) {
+ this.xParent.getElementById('grammalecte_conj_opro').checked = true;
+ this.xParent.getElementById('grammalecte_conj_opro').disabled = true;
+ this.xParent.getElementById('grammalecte_conj_opro_lbl').style = "color: #CCC;";
+ } else { // -1 or 1 or error
+ this.xParent.getElementById('grammalecte_conj_opro').checked = false;
+ this.xParent.getElementById('grammalecte_conj_opro').disabled = true;
+ this.xParent.getElementById('grammalecte_conj_opro_lbl').style = "color: #CCC;";
+ }
+ this.xParent.getElementById('grammalecte_conj_note').textContent = "❦";
+ }
+ this._displayConj(oConjTable);
+ } else {
+ this.xParent.getElementById('grammalecte_conj_verb').style = "color: #BB4411;";
+ }
+ }
+
+ _displayConj (oConjTable) {
+ if (oConjTable === null) {
+ return;
+ }
+ try {
+ this.xParent.getElementById('grammalecte_conj_verb').Text = "";
+ // infinitif
+ this.xParent.getElementById('grammalecte_conj_infi').textContent = oConjTable["infi"] || " "; // something or nbsp
+ // participe présent
+ this.xParent.getElementById('grammalecte_conj_ppre').textContent = oConjTable["ppre"] || " ";
+ // participes passés
+ this.xParent.getElementById('grammalecte_conj_ppas1').textContent = oConjTable["ppas1"] || " ";
+ this.xParent.getElementById('grammalecte_conj_ppas2').textContent = oConjTable["ppas2"] || " ";
+ this.xParent.getElementById('grammalecte_conj_ppas3').textContent = oConjTable["ppas3"] || " ";
+ this.xParent.getElementById('grammalecte_conj_ppas4').textContent = oConjTable["ppas4"] || " ";
+ // impératif
+ this.xParent.getElementById('grammalecte_conj_t_impe').textContent = oConjTable["t_impe"] || " ";
+ this.xParent.getElementById('grammalecte_conj_impe1').textContent = oConjTable["impe1"] || " ";
+ this.xParent.getElementById('grammalecte_conj_impe2').textContent = oConjTable["impe2"] || " ";
+ this.xParent.getElementById('grammalecte_conj_impe3').textContent = oConjTable["impe3"] || " ";
+ // présent
+ this.xParent.getElementById('grammalecte_conj_t_ipre').textContent = oConjTable["t_ipre"] || " ";
+ this.xParent.getElementById('grammalecte_conj_ipre1').textContent = oConjTable["ipre1"] || " ";
+ this.xParent.getElementById('grammalecte_conj_ipre2').textContent = oConjTable["ipre2"] || " ";
+ this.xParent.getElementById('grammalecte_conj_ipre3').textContent = oConjTable["ipre3"] || " ";
+ this.xParent.getElementById('grammalecte_conj_ipre4').textContent = oConjTable["ipre4"] || " ";
+ this.xParent.getElementById('grammalecte_conj_ipre5').textContent = oConjTable["ipre5"] || " ";
+ this.xParent.getElementById('grammalecte_conj_ipre6').textContent = oConjTable["ipre6"] || " ";
+ // imparfait
+ this.xParent.getElementById('grammalecte_conj_t_iimp').textContent = oConjTable["t_iimp"] || " ";
+ this.xParent.getElementById('grammalecte_conj_iimp1').textContent = oConjTable["iimp1"] || " ";
+ this.xParent.getElementById('grammalecte_conj_iimp2').textContent = oConjTable["iimp2"] || " ";
+ this.xParent.getElementById('grammalecte_conj_iimp3').textContent = oConjTable["iimp3"] || " ";
+ this.xParent.getElementById('grammalecte_conj_iimp4').textContent = oConjTable["iimp4"] || " ";
+ this.xParent.getElementById('grammalecte_conj_iimp5').textContent = oConjTable["iimp5"] || " ";
+ this.xParent.getElementById('grammalecte_conj_iimp6').textContent = oConjTable["iimp6"] || " ";
+ // passé simple
+ this.xParent.getElementById('grammalecte_conj_t_ipsi').textContent = oConjTable["t_ipsi"] || " ";
+ this.xParent.getElementById('grammalecte_conj_ipsi1').textContent = oConjTable["ipsi1"] || " ";
+ this.xParent.getElementById('grammalecte_conj_ipsi2').textContent = oConjTable["ipsi2"] || " ";
+ this.xParent.getElementById('grammalecte_conj_ipsi3').textContent = oConjTable["ipsi3"] || " ";
+ this.xParent.getElementById('grammalecte_conj_ipsi4').textContent = oConjTable["ipsi4"] || " ";
+ this.xParent.getElementById('grammalecte_conj_ipsi5').textContent = oConjTable["ipsi5"] || " ";
+ this.xParent.getElementById('grammalecte_conj_ipsi6').textContent = oConjTable["ipsi6"] || " ";
+ // futur
+ this.xParent.getElementById('grammalecte_conj_t_ifut').textContent = oConjTable["t_ifut"] || " ";
+ this.xParent.getElementById('grammalecte_conj_ifut1').textContent = oConjTable["ifut1"] || " ";
+ this.xParent.getElementById('grammalecte_conj_ifut2').textContent = oConjTable["ifut2"] || " ";
+ this.xParent.getElementById('grammalecte_conj_ifut3').textContent = oConjTable["ifut3"] || " ";
+ this.xParent.getElementById('grammalecte_conj_ifut4').textContent = oConjTable["ifut4"] || " ";
+ this.xParent.getElementById('grammalecte_conj_ifut5').textContent = oConjTable["ifut5"] || " ";
+ this.xParent.getElementById('grammalecte_conj_ifut6').textContent = oConjTable["ifut6"] || " ";
+ // Conditionnel
+ this.xParent.getElementById('grammalecte_conj_t_conda').textContent = oConjTable["t_conda"] || " ";
+ this.xParent.getElementById('grammalecte_conj_conda1').textContent = oConjTable["conda1"] || " ";
+ this.xParent.getElementById('grammalecte_conj_conda2').textContent = oConjTable["conda2"] || " ";
+ this.xParent.getElementById('grammalecte_conj_conda3').textContent = oConjTable["conda3"] || " ";
+ this.xParent.getElementById('grammalecte_conj_conda4').textContent = oConjTable["conda4"] || " ";
+ this.xParent.getElementById('grammalecte_conj_conda5').textContent = oConjTable["conda5"] || " ";
+ this.xParent.getElementById('grammalecte_conj_conda6').textContent = oConjTable["conda6"] || " ";
+ this.xParent.getElementById('grammalecte_conj_t_condb').textContent = oConjTable["t_condb"] || " ";
+ this.xParent.getElementById('grammalecte_conj_condb1').textContent = oConjTable["condb1"] || " ";
+ this.xParent.getElementById('grammalecte_conj_condb2').textContent = oConjTable["condb2"] || " ";
+ this.xParent.getElementById('grammalecte_conj_condb3').textContent = oConjTable["condb3"] || " ";
+ this.xParent.getElementById('grammalecte_conj_condb4').textContent = oConjTable["condb4"] || " ";
+ this.xParent.getElementById('grammalecte_conj_condb5').textContent = oConjTable["condb5"] || " ";
+ this.xParent.getElementById('grammalecte_conj_condb6').textContent = oConjTable["condb6"] || " ";
+ // subjonctif présent
+ this.xParent.getElementById('grammalecte_conj_t_spre').textContent = oConjTable["t_spre"] || " ";
+ this.xParent.getElementById('grammalecte_conj_spre1').textContent = oConjTable["spre1"] || " ";
+ this.xParent.getElementById('grammalecte_conj_spre2').textContent = oConjTable["spre2"] || " ";
+ this.xParent.getElementById('grammalecte_conj_spre3').textContent = oConjTable["spre3"] || " ";
+ this.xParent.getElementById('grammalecte_conj_spre4').textContent = oConjTable["spre4"] || " ";
+ this.xParent.getElementById('grammalecte_conj_spre5').textContent = oConjTable["spre5"] || " ";
+ this.xParent.getElementById('grammalecte_conj_spre6').textContent = oConjTable["spre6"] || " ";
+ // subjonctif imparfait
+ this.xParent.getElementById('grammalecte_conj_t_simp').textContent = oConjTable["t_simp"] || " ";
+ this.xParent.getElementById('grammalecte_conj_simp1').textContent = oConjTable["simp1"] || " ";
+ this.xParent.getElementById('grammalecte_conj_simp2').textContent = oConjTable["simp2"] || " ";
+ this.xParent.getElementById('grammalecte_conj_simp3').textContent = oConjTable["simp3"] || " ";
+ this.xParent.getElementById('grammalecte_conj_simp4').textContent = oConjTable["simp4"] || " ";
+ this.xParent.getElementById('grammalecte_conj_simp5').textContent = oConjTable["simp5"] || " ";
+ this.xParent.getElementById('grammalecte_conj_simp6').textContent = oConjTable["simp6"] || " ";
+ }
+ catch (e) {
+ console.error(e.fileName + "\n" + e.name + "\nline: " + e.lineNumber + "\n" + e.message);
+ }
+ }
}
class GrammalecteTooltip {
Index: gc_lang/fr/webext/gce_worker.js
==================================================================
--- gc_lang/fr/webext/gce_worker.js
+++ gc_lang/fr/webext/gce_worker.js
@@ -129,10 +129,13 @@
setDictionaryOnOff(dParam.sDictionary, dParam.bActivate, dInfo);
break;
case "getSpellSuggestions":
getSpellSuggestions(dParam.sWord, dInfo);
break;
+ case "getVerb":
+ getVerb(dParam.sVerb, dParam.bPro, dParam.bNeg, dParam.bTpsCo, dParam.bInt, dParam.bFem, dInfo);
+ break;
case "getListOfTokens":
getListOfTokens(dParam.sText, dInfo);
break;
default:
console.log("[Worker] Unknown command: " + sCommand);
@@ -369,10 +372,29 @@
postMessage(createResponse("getSpellSuggestions", {sWord: sWord, aSugg: aSugg, iSuggBlock: i}, dInfo, true));
i += 1;
}
}
+
+// Conjugueur
+
+function getVerb (sWord, bPro, bNeg, bTpsCo, bInt, bFem, dInfo) {
+ try {
+ let oVerb = null;
+ let oConjTable = null;
+ if (conj.isVerb(sWord)) {
+ oVerb = new Verb(sWord);
+ oConjTable = oVerb.createConjTable(bPro, bNeg, bTpsCo, bInt, bFem);
+ }
+ postMessage(createResponse("getVerb", { oVerb: oVerb, oConjTable: oConjTable }, dInfo, true));
+ }
+ catch (e) {
+ console.error(e);
+ postMessage(createResponse("getVerb", createErrorResult(e, "no verb"), dInfo, true, true));
+ }
+}
+
// Lexicographer
function getListOfTokens (sText, dInfo={}) {
try {
Index: gc_lang/fr/webext/manifest.json
==================================================================
--- gc_lang/fr/webext/manifest.json
+++ gc_lang/fr/webext/manifest.json
@@ -47,10 +47,11 @@
"*://*.wikisource.org/*",
"*://*.wikipedia.org/*",
"*://*.wiktionary.org/*"
],
"js": [
+ "content_scripts/html_src.js",
"content_scripts/panel.js",
"grammalecte/fr/textformatter.js",
"content_scripts/panel_tf.js",
"content_scripts/panel_gc.js",
"content_scripts/message_box.js",
@@ -64,10 +65,11 @@
"*://*.wikisource.org/*",
"*://*.wikipedia.org/*",
"*://*.wiktionary.org/*"
],
"js": [
+ "content_scripts/html_src.js",
"content_scripts/panel.js",
"grammalecte/fr/textformatter.js",
"content_scripts/panel_tf.js",
"content_scripts/panel_gc.js",
"content_scripts/panel_lxg.js",
@@ -96,10 +98,11 @@
"web_accessible_resources": [
"content_scripts/panel.css",
"content_scripts/panel_tf.css",
"content_scripts/panel_gc.css",
"content_scripts/panel_lxg.css",
+ "content_scripts/panel_conj.css",
"content_scripts/message_box.css",
"content_scripts/menu.css",
"grammalecte/graphspell/_dictionaries/fr-allvars.json",
"grammalecte/graphspell/_dictionaries/fr-classic.json",
"grammalecte/graphspell/_dictionaries/fr-reform.json",