Index: gc_lang/fr/webext/background.js ================================================================== --- gc_lang/fr/webext/background.js +++ gc_lang/fr/webext/background.js @@ -269,10 +269,13 @@ openConjugueurTab(); break; case "conjugueur_window": openConjugueurWindow(); break; + case "lex_editor": + openLexEditor(); + break; } }); /* @@ -289,10 +292,23 @@ function sendCommandToTab (sCommand, iTab) { let xTabPort = dConnx.get(iTab); xTabPort.postMessage({sActionDone: sCommand, result: null, dInfo: null, bEnd: false, bError: false}); } + +function openLexEditor () { + if (bChrome) { + browser.tabs.create({ + url: browser.extension.getURL("panel/lex_editor.html") + }); + return; + } + let xLexEditor = browser.tabs.create({ + url: browser.extension.getURL("panel/lex_editor.html") + }); + xLexEditor.then(onCreated, onError); +} function openConjugueurTab () { if (bChrome) { browser.tabs.create({ url: browser.extension.getURL("panel/conjugueur.html") Index: gc_lang/fr/webext/gce_worker.js ================================================================== --- gc_lang/fr/webext/gce_worker.js +++ gc_lang/fr/webext/gce_worker.js @@ -51,11 +51,11 @@ Warning. Initialization can’t be completed at startup of the worker, for we need the path of the extension to load data stored in JSON files. This path is retrieved in background.js and passed with the event “init”. */ -console.log("[Worker] imports odne"); + function createResponse (sActionDone, result, dInfo, bEnd, bError=false) { return { "sActionDone": sActionDone, "result": result, // can be of any type Index: gc_lang/fr/webext/manifest.json ================================================================== --- gc_lang/fr/webext/manifest.json +++ gc_lang/fr/webext/manifest.json @@ -104,10 +104,16 @@ "conjugueur_window": { "suggested_key": { "default": "Ctrl+Shift+7" }, "description": "Ouvre le conjugueur dans une fenêtre" + }, + "lex_editor": { + "suggested_key": { + "default": "Ctrl+Shift+8" + }, + "description": "Ouvre l’éditeur lexical" } }, "web_accessible_resources": [ "grammalecte/_dictionaries/French.json", ADDED gc_lang/fr/webext/panel/lex_editor.css Index: gc_lang/fr/webext/panel/lex_editor.css ================================================================== --- gc_lang/fr/webext/panel/lex_editor.css +++ gc_lang/fr/webext/panel/lex_editor.css @@ -0,0 +1,138 @@ +/* + CSS Document + White + Design par Olivier R. +*/ + +* { margin: 0; padding: 0; } +img { border: none; } + + +/* Generic classes */ + +.fleft { float: left; } +.fright { float: right; } +.center { text-align: center; } +.right { text-align: right; } +.left { text-align: left; } +.justify { text-align: justify; } +.hidden { display: none; } +.clearer { clear: both; font-size: 0; height: 0; } + +body { + background: hsl(0, 0%, 100%) url(../img/lines.png); + font: normal 16px "Trebuchet MS", "Fira Sans", "Liberation Sans", sans-serif; + color: #505050; +} + + + +/* MAIN ====================================================================== */ + +#main .inbox { + width: 600px; + margin: 20px auto 10px auto; + padding: 10px 30px 30px 30px; + background: hsl(0, 0%, 100%); + border: 2px solid #F0F0F0; + border-radius: 20px; +} + +#main h1 { + margin: 5px 0 20px 0; + color: hsl(210, 50%, 50%); + font: bold 30px "Trebuchet MS", "Fira Sans", "Liberation Sans", sans-serif; +} +#main h2 { + margin: 5px 0 2px 0; + color: hsl(0, 50%, 50%); + font: bold 20px "Trebuchet MS", "Fira Sans", "Liberation Sans", sans-serif; +} +#main h3 { + margin: 3px 0 2px 0; + color: hsl(210, 50%, 50%); + font: bold 16px "Trebuchet MS", "Fira Sans", "Liberation Sans", sans-serif; +} + + +#categories { + display: flex; + padding: 10px 0; +} + +.category { + padding: 10px; + border-radius: 3px; + cursor: pointer; +} +.category:hover { + background-color: hsl(0, 0%, 90%); +} + + +.empty_section { + padding: 80px; + font-size: 24px; + text-align: center; +} +.section { + display: none; + padding: 10px; +} + +.container { + display: flex; +} + +.block { + flex-grow: 1; + margin: 5px; + padding: 10px 15px 15px 15px; + background-color: hsl(0, 10%, 96%); + border-radius: 3px; +} + + +input#word { + display: inline-block; + width: 230px; + margin-left: 5px; + padding: 5px 10px; + border: 2px solid hsl(0, 0%, 80%); + border-radius: 3px; + height: 24px; + background: transparent; + font: normal 20px Tahoma, "Ubuntu Condensed"; + color: hsl(0, 0%, 30%); +} +input[placeholder]#word { + color: hsl(0, 0%, 70%); +} + + +#generated_words { + padding: 10px; +} + +#buttonline { + text-align: right; +} + +#add_to_dictionary { + display: inline-block; + padding: 7px 10px; + font-size: 20px; + 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; +} +#add_to_dictionary:hover { + background-color: hsl(0, 60%, 40%); + color: hsl(0, 60%, 70%); + box-shadow: 0 0 2px hsl(0, 60%, 50%); +} + ADDED gc_lang/fr/webext/panel/lex_editor.html Index: gc_lang/fr/webext/panel/lex_editor.html ================================================================== --- gc_lang/fr/webext/panel/lex_editor.html +++ gc_lang/fr/webext/panel/lex_editor.html @@ -0,0 +1,210 @@ + + + + + Grammalecte · Éditeur lexical + + + + + + +
+
+ +

Éditeur lexical

+ + + +
+
Nom
+
Adjectif
+
Verbe
+
Adverbe
+ +
+ +
Prénom
+
Patronyme
+
Nom propre
+ +
+ +
Autre
+
+ + +
+ +
+ Sélectionnez une catégorie. +
+ +
+

Nom

+

+
+
+

Genre

+

+

+

+
+
+

Pluriel

+

+

+

+
+
+ +

[optionnel] Autre forme (masculine, féminine, variante, etc.)

+ +

+
+
+

Genre

+

+

+

+
+
+

Pluriel

+

+

+

+
+
+
+ +
+

Adjectif

+ +
+ +
+

Verbe

+
+

+
Cochez cette case, si ce verbe peut s’utiliser sans complément d’objet.
+
Je mange. Je pars. Je pense.
+
J’appartiens à…
+
+
+

+
Cochez cette case, si ce verbe peut s’utiliser avec un complément d’objet direct.
+
Je mange une pomme. Je donne une gifle.
+
Je pars. J’appartiens à…
+
+
+

+
Cochez cette case, si ce verbe peut s’utiliser avec un complément d’objet indirect direct.
+
Je donne une bise à sa femme.J’appartiens à ce groupe..
+
+
+
+

+
Cochez cette case, si ce verbe peut s’utiliser pronominalement.
+
Je me suis trompé.
+
+
+
+

+
Cochez cette case, si ce verbe ne peut s’utiliser à la première personne, mais uniquement à la troisième personne du singulier ou du pluriel.
+
.
+
+
+
+

+
Cochez cette case, si ce verbe s’emploie au passé composé avec l’auxilaire “être”.
+
Je suis venu. Je suis parti.
+
J’ai venu. J’ai parti.
+
+
+

+
Cochez cette case, si ce verbe s’emploie au passé composé avec l’auxilaire “avoir”.
+
J’ai mangé. J’ai prié.
+
Je suis mangé. Je suis prié.
+
+
+ +
+

Adverbe

+

Les adverbes sont invariables en genre et en nombre.

+
+ +
+

Prénom

+
+
+

Genre

+

+

+

+
+
+

Pluriel

+

Les prénoms sont invariables en nombre.

+
+
+
+ +
+

Patronyme

+
+
+

Genre

+

+

+

+
+
+

Pluriel

+

Les noms de famille sont invariables en nombre.

+
+
+
+ +
+

Nom propre

+
+
+

Genre

+

+

+

+
+
+

Pluriel

+

Les noms propres sont invariables en nombre.

+
+
+
+ +
+

Autre

+

Indiquez les étiquettes grammaticales que vous voulez appliquer au mot. À utiliser seulement si vous savez ce que vous faites. Dans le cas contraire, tant pis pour vous.

+

Étiquettes

+

+
+
+ +
+

Mots générés

+

+                
+ +
+
Ajouter au dictionnaire
+
+ +
+ + +
+ + + + + + ADDED gc_lang/fr/webext/panel/lex_editor.js Index: gc_lang/fr/webext/panel/lex_editor.js ================================================================== --- gc_lang/fr/webext/panel/lex_editor.js +++ gc_lang/fr/webext/panel/lex_editor.js @@ -0,0 +1,52 @@ +// JavaScript + +"use strict"; + + +function showError (e) { + console.error(e.fileName + "\n" + e.name + "\nline: " + e.lineNumber + "\n" + e.message); +} + + +function onSelectionClick (xEvent) { + try { + let xElem = xEvent.target; + if (xElem.id) { + if (xElem.id.startsWith("select_")) { + showSection("section_" + xElem.id.slice(7)); + } else { + + } + } else { + + } + } + catch (e) { + showError(e); + } +} + + +document.getElementById("categories").addEventListener("click", onSelectionClick, false); + + + + +/* + ACTIONS +*/ + +function hideAllSections () { + for (let xElem of document.getElementById("editor").childNodes) { + if (xElem.id) { + xElem.style.display = "none"; + } + } +} + +function showSection (sName) { + hideAllSections(); + if (document.getElementById(sName)) { + document.getElementById(sName).style.display = "block"; + } +}