Index: gc_lang/fr/build.py
==================================================================
--- gc_lang/fr/build.py
+++ gc_lang/fr/build.py
@@ -8,12 +8,23 @@
def build (sLang, dVars, spLangPack):
"complementary build launched from make.py"
createFirefoxExtension(sLang, dVars)
+ createWebExtension(sLang, dVars)
createThunderbirdExtension(sLang, dVars, spLangPack)
+
+def createWebExtension (sLang, dVars):
+ "create Web-extension"
+ print("Building Web-extension")
+ helpers.createCleanFolder("_build/webext/"+sLang)
+ dir_util.copy_tree("gc_lang/"+sLang+"/webext/", "_build/webext/"+sLang)
+ dir_util.copy_tree("grammalecte-js", "_build/webext/"+sLang+"/grammalecte")
+ with helpers.cd("_build/webext/"+sLang):
+ os.system("web-ext build")
+
def createFirefoxExtension (sLang, dVars):
"create extension for Firefox"
print("Building extension for Firefox")
helpers.createCleanFolder("_build/xpi/"+sLang)
Index: gc_lang/fr/config.ini
==================================================================
--- gc_lang/fr/config.ini
+++ gc_lang/fr/config.ini
@@ -28,10 +28,15 @@
oxt_identifier = French.linguistic.resources.from.Dicollecte.by.OlivierR
# Firefox
fx_identifier = French-GC@grammalecte.net
fx_name = Grammalecte [fr]
+
+fx_standard_path = C:\Program Files\Mozilla Firefox\firefox.exe
+fx_beta_path = C:\Program Files\Mozilla Firefox Beta\firefox.exe
+fx_nightly_path = C:\Program Files (x86)\Nightly\firefox.exe
+
# Thunderbird
tb_identifier = French-GC-TB@grammalecte.net
tb_name = Grammalecte [fr]
tb_debug_extension_path = _build/tb-debug.profile/extensions/French-GC-TB@grammalecte.net
ADDED gc_lang/fr/webext/README.md
Index: gc_lang/fr/webext/README.md
==================================================================
--- /dev/null
+++ gc_lang/fr/webext/README.md
@@ -0,0 +1,22 @@
+# Grammalecte
+
+**French Grammar Checker**
+
+écrit en JavaScript ES6/ES7
+par Olivier R.
+
+## Fonctionnalités ##
+
+* correcteur grammatical
+* conjugueur
+* formateur de texte
+* lexicographe
+
+## Site web ##
+
+https://grammalecte.net
+
+## Licence ##
+
+GNU GPL 3.0+
+http://www.gnu.org/copyleft/gpl.html
ADDED gc_lang/fr/webext/content_scripts/modify_page.js
Index: gc_lang/fr/webext/content_scripts/modify_page.js
==================================================================
--- /dev/null
+++ gc_lang/fr/webext/content_scripts/modify_page.js
@@ -0,0 +1,28 @@
+import { echo } from "../mymodule";
+
+echo("CONTENT SCRIPRT!!!");
+
+function handleMessage2 (oRequest, xSender, sendResponse) {
+ console.log(`[Content script] received: ${oRequest.content}`);
+ change(request.myparam);
+ //browser.runtime.onMessage.removeListener(handleMessage);
+ sendResponse({response: "response from content script"});
+}
+
+function removeEverything () {
+ while (document.body.firstChild) {
+ document.body.firstChild.remove();
+ }
+}
+
+function change (param) {
+ document.getElementById("title").setAttribute("background-color", "#809060");
+ console.log("param: " + param);
+ document.getElementById("title").setAttribute("background-color", "#FF0000");
+}
+
+
+/*
+ Assign do_something() as a listener for messages from the extension.
+*/
+browser.runtime.onMessage.addListener(handleMessage2);
ADDED gc_lang/fr/webext/gce_worker.js
Index: gc_lang/fr/webext/gce_worker.js
==================================================================
--- /dev/null
+++ gc_lang/fr/webext/gce_worker.js
@@ -0,0 +1,139 @@
+
+
+/*
+try {
+ console.log("BEFORE");
+ //var myhelpers = require('./grammalecte/helpers.js');
+ require(['./grammalecte/helpers.js'], function (foo) {
+ console.log("LOADING");
+ echo("MODULE LOADED2");
+ });
+ console.log("AFTER");
+}
+catch (e) {
+ console.log("\n" + e.fileName + "\n" + e.name + "\nline: " + e.lineNumber + "\n" + e.message);
+ console.error(e);
+}*/
+
+echo("VA TE FAIRE FOUTRE");
+
+
+
+let gce = null; // module: grammar checker engine
+let text = null;
+let tkz = null; // module: tokenizer
+let lxg = null; // module: lexicographer
+let helpers = null;
+
+let oTokenizer = null;
+let oDict = null;
+let oLxg = null;
+
+function loadGrammarChecker (sGCOptions="", sContext="JavaScript") {
+ if (gce === null) {
+ try {
+ gce = require("resource://grammalecte/fr/gc_engine.js");
+ helpers = require("resource://grammalecte/helpers.js");
+ text = require("resource://grammalecte/text.js");
+ tkz = require("resource://grammalecte/tokenizer.js");
+ lxg = require("resource://grammalecte/fr/lexicographe.js");
+ oTokenizer = new tkz.Tokenizer("fr");
+ helpers.setLogOutput(console.log);
+ gce.load(sContext);
+ oDict = gce.getDictionary();
+ oLxg = new lxg.Lexicographe(oDict);
+ if (sGCOptions !== "") {
+ gce.setOptions(helpers.objectToMap(JSON.parse(sGCOptions)));
+ }
+ // we always retrieve options from the gce, for setOptions filters obsolete options
+ return gce.getOptions()._toString();
+ }
+ catch (e) {
+ console.log("# Error: " + e.fileName + "\n" + e.name + "\nline: " + e.lineNumber + "\n" + e.message);
+ }
+ }
+}
+
+function parse (sText, sLang, bDebug, bContext) {
+ let aGrammErr = gce.parse(sText, sLang, bDebug, bContext);
+ return JSON.stringify(aGrammErr);
+}
+
+function parseAndSpellcheck (sText, sLang, bDebug, bContext) {
+ let aGrammErr = gce.parse(sText, sLang, bDebug, bContext);
+ let aSpellErr = oTokenizer.getSpellingErrors(sText, oDict);
+ return JSON.stringify({ aGrammErr: aGrammErr, aSpellErr: aSpellErr });
+}
+
+function getOptions () {
+ return gce.getOptions()._toString();
+}
+
+function getDefaultOptions () {
+ return gce.getDefaultOptions()._toString();
+}
+
+function setOptions (sGCOptions) {
+ gce.setOptions(helpers.objectToMap(JSON.parse(sGCOptions)));
+ return gce.getOptions()._toString();
+}
+
+function setOption (sOptName, bValue) {
+ gce.setOptions(new Map([ [sOptName, bValue] ]));
+ return gce.getOptions()._toString();
+}
+
+function resetOptions () {
+ gce.resetOptions();
+ return gce.getOptions()._toString();
+}
+
+function fullTests (sGCOptions="") {
+ if (!gce || !oDict) {
+ return "# Error: grammar checker or dictionary not loaded."
+ }
+ let dMemoOptions = gce.getOptions();
+ if (sGCOptions) {
+ gce.setOptions(helpers.objectToMap(JSON.parse(sGCOptions)));
+ }
+ let tests = require("resource://grammalecte/tests.js");
+ let oTest = new tests.TestGrammarChecking(gce);
+ let sAllRes = "";
+ for (let sRes of oTest.testParse()) {
+ dump(sRes+"\n");
+ sAllRes += sRes+"\n";
+ }
+ gce.setOptions(dMemoOptions);
+ return sAllRes;
+}
+
+
+// Lexicographer
+
+function getListOfElements (sText) {
+ try {
+ let aElem = [];
+ let aRes = null;
+ for (let oToken of oTokenizer.genTokens(sText)) {
+ aRes = oLxg.getInfoForToken(oToken);
+ if (aRes) {
+ aElem.push(aRes);
+ }
+ }
+ return JSON.stringify(aElem);
+ }
+ catch (e) {
+ helpers.logerror(e);
+ }
+ return JSON.stringify([]);
+}
+
+
+function handleMessage (oRequest, xSender, sendResponse) {
+ console.log(`[background] received: ${oRequest.content}`);
+ sendResponse({response: "response from background script"});
+}
+
+browser.runtime.onMessage.addListener(handleMessage);
+
+
ADDED gc_lang/fr/webext/img/logo-16.png
Index: gc_lang/fr/webext/img/logo-16.png
==================================================================
--- /dev/null
+++ gc_lang/fr/webext/img/logo-16.png
cannot compute difference between binary files
ADDED gc_lang/fr/webext/img/logo-32.png
Index: gc_lang/fr/webext/img/logo-32.png
==================================================================
--- /dev/null
+++ gc_lang/fr/webext/img/logo-32.png
cannot compute difference between binary files
ADDED gc_lang/fr/webext/img/logo-48.png
Index: gc_lang/fr/webext/img/logo-48.png
==================================================================
--- /dev/null
+++ gc_lang/fr/webext/img/logo-48.png
cannot compute difference between binary files
ADDED gc_lang/fr/webext/img/logo-64.png
Index: gc_lang/fr/webext/img/logo-64.png
==================================================================
--- /dev/null
+++ gc_lang/fr/webext/img/logo-64.png
cannot compute difference between binary files
ADDED gc_lang/fr/webext/img/logo-96.png
Index: gc_lang/fr/webext/img/logo-96.png
==================================================================
--- /dev/null
+++ gc_lang/fr/webext/img/logo-96.png
cannot compute difference between binary files
ADDED gc_lang/fr/webext/manifest.json
Index: gc_lang/fr/webext/manifest.json
==================================================================
--- /dev/null
+++ gc_lang/fr/webext/manifest.json
@@ -0,0 +1,43 @@
+{
+ "manifest_version": 2,
+ "name": "Grammalecte [fr]",
+ "short_name": "Grammalecte [fr]",
+ "version": "0.6",
+
+ "applications": {
+ "gecko": {
+ "id": "French-GC@grammalecte.net",
+ "strict_min_version": "54.0"
+ }
+ },
+
+ "author": "Olivier R.",
+ "homepage_url": "https://grammalecte.net",
+ "offline_enabled": true,
+
+ "description": "Correcteur grammatical pour le français.",
+
+ "icons": { "16": "img/logo-16.png",
+ "32": "img/logo-32.png",
+ "48": "img/logo-48.png",
+ "64": "img/logo-64.png",
+ "96": "img/logo-96.png" },
+
+ "browser_action": {
+ "default_icon": "img/logo-32.png",
+ "default_popup": "panel/main.html",
+ "default_title": "Grammalecte [fr]",
+ "browser_style": false
+ },
+ "background": {
+ "scripts": ["require.js", "grammalecte/helpers.js", "gce_worker.js"]
+ },
+ "web_accessible_resources": [
+ "beasts/frog.jpg",
+ "beasts/turtle.jpg",
+ "beasts/snake.jpg"
+ ],
+ "permissions": [
+ "activeTab"
+ ]
+}
ADDED gc_lang/fr/webext/panel/main.css
Index: gc_lang/fr/webext/panel/main.css
==================================================================
--- /dev/null
+++ gc_lang/fr/webext/panel/main.css
@@ -0,0 +1,457 @@
+/*
+ flexbox:
+ https://css-tricks.com/snippets/css/a-guide-to-flexbox/
+*/
+
+
+/* reset */
+
+* { margin: 0; padding: 0; }
+img { border: none; }
+
+
+/* Selection */
+
+::-moz-selection {
+ background-color: hsl(210, 50%, 60%);
+ color: hsl(210, 20%, 100%);
+ text-shadow: 0 0 2px hsl(210, 80%, 20%);
+ border-radius: 2px;
+}
+::selection {
+ background-color: hsl(210, 50%, 60%);
+ color: hsl(210, 20%, 100%);
+ text-shadow: 0 0 2px hsl(210, 80%, 20%);
+ border-radius: 2px;
+}
+
+
+/* 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; }
+
+.red { background-color: hsl(0, 50%, 50%); color: hsl(0, 0%, 96%); }
+.red:hover { background-color: hsl(0, 60%, 40%); color: hsl(0, 0%, 100%); }
+.cyan { background-color: hsl(180, 50%, 50%); color: hsl(0, 0%, 96%); }
+.cyan:hover { background-color: hsl(180, 60%, 40%); color: hsl(0, 0%, 100%); }
+.green { background-color: hsl(120, 50%, 40%); color: hsl(120, 10%, 96%); }
+.green:hover { background-color: hsl(120, 60%, 30%); color: hsl(120, 10%, 96%); }
+.blue { background-color: hsl(210, 50%, 50%); color: hsl(210, 10%, 96%); }
+.blue:hover { background-color: hsl(210, 60%, 40%); color: hsl(210, 10%, 96%); }
+
+
+/* links */
+
+a:link, a:visited {
+ color: hsl(210, 70%, 40%);
+ /*text-decoration: none;*/
+}
+a:hover, a:active {
+ text-shadow: 0 0 2px hsl(210, 80%, 60%);
+}
+
+a.extlink:hover:after {
+ content: " >";
+}
+
+
+/* Main classes */
+
+html {
+ box-sizing: border-box;
+ width: 530px;
+ height: 880px;
+ font-family: "Trebuchet MS", "Liberation Sans", sans-serif;
+}
+body {
+ width: 530px;
+ height: 880px;
+}
+
+#main {
+ display: flex;
+ flex-direction: row;
+ flex-wrap: nowrap;
+ align-items: stretch;
+ background-color: hsl(210, 0%, 100%);
+ min-height: 100%;
+}
+
+#left {
+ width: 54px;
+ background-color: hsl(210, 10%, 96%);
+ border-right: solid 1px hsl(210, 0%, 70%);
+ color: hsl(210, 10%, 96%);
+}
+#logo {
+ padding: 10px;
+}
+#left li {
+ padding: 10px 5px;
+ border-bottom: 1px solid hsl(210, 10%, 90%);
+ text-align: center;
+ cursor: pointer;
+ color: hsl(210, 10%, 50%);
+ list-style-type: none;
+}
+#left li:hover {
+ background-color: hsl(210, 10%, 92%);
+
+}
+
+#page {
+ background-color: hsl(210, 0%, 100%);
+}
+#page h1 {
+ margin: 0 0 10px 0;
+ color: hsl(210, 70%, 70%);
+ font: bold 30px 'Yanone Kaffeesatz', "Liberation Sans Narrow", sans-serif;
+}
+#page p {
+ margin: 10px 0 5px 0;
+}
+
+#home_page {
+ display: block;
+ padding: 20px;
+}
+
+#tf_page {
+ display: none;
+ padding: 20px;
+}
+#gc_page {
+ display: none;
+ padding: 20px 20px 30px 20px;
+}
+#gc_options_page {
+ display: none;
+ padding: 20px;
+}
+#sc_options_page {
+ display: none;
+ padding: 20px;
+}
+#lxg_page {
+ display: none;
+ padding: 20px;
+}
+
+
+/*
+ Conjugueur page
+*/
+
+#conj_page {
+ display: none;
+ padding: 10px;
+}
+
+#conj_page h2 {
+ margin: 5px 0 2px 0;
+ color: hsl(210, 50%, 50%);
+ font: bold 30px Tahoma, "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", sans-serif;
+}
+#conj_page h3 {
+ margin: 5px 0 2px 0;
+ color: hsl(0, 50%, 50%);
+ font: bold 16px Tahoma, "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", sans-serif;
+}
+#conj_page h4 {
+ margin: 5px 0 2px 0;
+ color: hsl(210, 50%, 50%);
+ font: bold 14px Tahoma, "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", sans-serif;
+}
+
+#conj_page .colonne {
+ float: left;
+ width: 240px;
+}
+#conj_page .colsep {
+ float: left;
+ width: 20px;
+}
+
+#conj_page .colonne p {
+ font-size: 12px;
+}
+
+
+#conj_page input#verb {
+ 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%);
+}
+#conj_page input[placeholder]#verb {
+ color: hsl(0, 0%, 70%);
+}
+
+#conj_page a#conjugate {
+ 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;
+}
+#conj_page a#conjugate:hover {
+ background-color: hsl(0, 60%, 40%);
+ color: hsl(0, 60%, 70%);
+ box-shadow: 0 0 2px hsl(0, 60%, 50%);
+}
+
+#conj_options {
+ margin: 10px 5px 0 5px;
+ font-size: 16px;
+ text-align: center;
+}
+
+#conj_smallnote {
+ float: right;
+ width: 190px;
+ margin: 15px 0 0 0;
+ padding: 0 5px;
+ font-size: 8.5px;
+ color: hsl(0, 0%, 60%);
+ text-align: center;
+}
+
+
+/*
+ Test page
+*/
+
+#test_page {
+ display: none;
+}
+#test_cmd {
+ padding: 15px;
+ background-color: hsl(0, 0%, 92%);
+ border-bottom: 1px solid hsl(0, 0%, 86%);
+}
+#test_cmd textarea {
+ width: 100%;
+ border: 2px solid hsl(0, 0%, 89%);
+ border-radius: 3px;
+ resize: vertical;
+}
+
+#test_results {
+ padding: 15px;
+ background-color: hsl(0, 0%, 96%);
+}
+
+#test_page .button {
+ display: inline-block;
+ padding: 5px 10px;
+ width: 120px;
+ border-radius: 3px;
+ font-size: 12px;
+ text-align: center;
+ cursor: pointer;
+}
+
+
+/*
+ Text formatter
+*/
+
+#tf_options {
+
+}
+
+#tf_options fieldset {
+ margin: 5px 0;
+ padding: 5px 10px 10px 10px;
+ background-color: hsl(0, 0%, 92%);
+ border-radius: 3px;
+}
+
+#tf_options legend {
+ font-size: 20px;
+ color: hsla(210, 20%, 50%, .8);
+ font-weight: bold;
+}
+#tf_options legend span {
+ display: none;
+}
+
+#tf_options fieldset h2 {
+ color: hsl(210, 80%, 40%);
+}
+
+#tf_options fieldset .blockopt {
+ padding: 2px 3px;
+ font-size: 12.5px;
+}
+#tf_options fieldset .underline:hover {
+ background-color: hsl(180, 10%, 86%);
+ border-radius: 2px;
+}
+
+#tf_options fieldset .option {
+ margin: 1px 3px 0 0;
+ float: left;
+}
+#tf_options legend .option {
+ margin: 7px 5px 0 3px;
+ float: left;
+}
+
+#tf_options fieldset .opt_lbl {
+ display: inline-block;
+ color: hsl(0, 0%, 20%);
+}
+
+
+#tf_options fieldset .largew {
+ width: 300px;
+}
+#tf_options fieldset .reducedw {
+ width: 200px;
+}
+#tf_options fieldset .smallw {
+ width: 90px;
+}
+
+#tf_options fieldset .secondoption {
+ display: inline-block;
+}
+
+#tf_options fieldset label span {
+ display: none;
+}
+
+#tf_options .groupblock {
+ opacity: 0.3;
+}
+
+#tf_options .inlineblock {
+ display: inline-block;
+}
+#tf_options .indent {
+ margin-left: 15px;
+}
+
+#tf_actions {
+ background-color: hsl(120, 10%, 92%);
+ padding: 15px;
+ border-top: 1px solid hsl(120, 20%, 86%);
+}
+
+#tf_options .button {
+ display: inline-block;
+ padding: 5px 10px;
+ width: 100px;
+ border-radius: 3px;
+ font-size: 16px;
+ font-weight: bold;
+ text-align: center;
+ cursor: pointer;
+}
+
+#tf_progressbarbox {
+ display: inline-block;
+ padding: 10px 20px;
+}
+
+
+/*
+ Other elements
+*/
+
+#movewindow {
+ position: fixed;
+ right: 0;
+ top: 50;
+ width: 16px;
+ margin-top: 60px;
+ z-index: 100;
+}
+#movewindow .arrow {
+ background-color: hsl(180, 60%, 50%);
+ cursor: pointer;
+ padding: 1px 3px;
+ font-size: 10px;
+ font-weight: bold;
+ text-align: center;
+ color: hsl(180, 50%, 90%);
+}
+#movewindow .arrow:hover {
+ background-color: hsl(180, 70%, 40%);
+ cursor: hsl(180, 50%, 96%);
+}
+
+#rightcorner {
+ position: absolute;
+ top: 0;
+ right: 0;
+}
+a.rightcornerbutton1 {
+ float: right;
+ padding: 2px 10px 5px 10px;
+ border-radius: 0 0 0 3px;
+ font-size: 18px;
+ text-decoration: none;
+}
+a.rightcornerbutton {
+ float: right;
+ padding: 2px 10px 5px 10px;
+ font-size: 18px;
+ text-decoration: none;
+}
+
+
+/*
+ CSS Spinner
+ Double bounce
+ http://tobiasahlin.com/spinkit/
+*/
+.spinner {
+ width: 40px;
+ height: 40px;
+ position: absolute;
+ top: 2px;
+ right: 120px;
+}
+.double-bounce1, .double-bounce2 {
+ width: 100%;
+ height: 100%;
+ border-radius: 50%;
+ background-color: hsl(180, 50%, 75%);
+ opacity: 0.6;
+ position: absolute;
+ top: 0;
+ left: 0;
+ animation: sk-bounce 2.0s infinite ease-in-out;
+}
+.double-bounce2 {
+ animation-delay: -1.0s;
+}
+
+@keyframes sk-bounce {
+ 0%, 100% {
+ transform: scale(0.0);
+ } 50% {
+ transform: scale(1.0);
+ }
+}
ADDED gc_lang/fr/webext/panel/main.html
Index: gc_lang/fr/webext/panel/main.html
==================================================================
--- /dev/null
+++ gc_lang/fr/webext/panel/main.html
@@ -0,0 +1,495 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ CORRECTEUR GRAMMATICAL
+
+
+
+
+ OPTIONS GRAMMATICALES
+
+
+
+ OPTIONS ORTHOGRAPHIQUES
+
+
+
+
+
+
+
TESTS
+
+
Tests complets
Analyser
+
+
+
+
+
+
+ CONJUGUEUR
+
+
+ Conjuguer
+
+
+
+
+ Ce verbe n’a pas encore été vérifié. C’est pourquoi les options “pronominal” et “temps composés” sont désactivées.
+
+
+ ·
+ ·
+
+ ·
+
+
+
+
+
+
+
+
+
+
Impératif
+
Présent
+
+
+
+
+
+
+
+
+
+
+
+
Participes passés
+
+
+
+
+
+
+
+
+
+
+
+
+
Indicatif
+
+
+
Imparfait
+
+
+
+
+
+
+
+
+
Passé simple
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Subjonctif
+
+
+
Imparfait
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ FORMATEUR DE TEXTE
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Par défaut
+
Appliquer
+
+
+
+
+
+
+
+
+
+
+
+
+
ADDED gc_lang/fr/webext/panel/main.js
Index: gc_lang/fr/webext/panel/main.js
==================================================================
--- /dev/null
+++ gc_lang/fr/webext/panel/main.js
@@ -0,0 +1,70 @@
+
+function showError (e) {
+ console.error(e.fileName + "\n" + e.name + "\nline: " + e.lineNumber + "\n" + e.message);
+}
+
+function beastNameToURL(beastName) {
+ switch (beastName) {
+ case "Frog":
+ return browser.extension.getURL("beasts/frog.jpg");
+ case "Snake":
+ return browser.extension.getURL("beasts/snake.jpg");
+ case "Turtle":
+ return browser.extension.getURL("beasts/turtle.jpg");
+ }
+}
+
+window.addEventListener(
+ "click",
+ function (xEvent) {
+ let xElem = xEvent.target;
+ if (xElem.id) {
+ if (xElem.id) {
+
+ }
+ } else if (xElem.className === "select") {
+ showPage(xElem.dataset.page);
+ } else if (xElem.tagName === "A") {
+ openURL(xElem.getAttribute("href"));
+ }
+ },
+ false
+);
+
+function showPage (sPageName) {
+ try {
+ // hide them all
+ for (let xNodePage of document.getElementsByClassName("page")) {
+ xNodePage.style.display = "None";
+ }
+ // show the one
+ document.getElementById(sPageName).style.display = "block";
+ sendMessage("Mon message");
+ // specific modifications
+ if (sPageName === "conj_page") {
+ document.body.style.width = "600px";
+ document.documentElement.style.width = "600px";
+ document.getElementById("movewindow").style.display = "none";
+ } else {
+ document.body.style.width = "530px";
+ document.documentElement.style.width = "530px";
+ document.getElementById("movewindow").style.display = "block";
+ }
+ }
+ catch (e) {
+ showError(e);
+ }
+}
+
+function handleResponse(message) {
+ console.log(`[Panel] received: ${message.response}`);
+}
+
+function handleError(error) {
+ console.log(`[Panel] Error: ${error}`);
+}
+
+function sendMessage (sMessage) {
+ let sending = browser.runtime.sendMessage({content: sMessage});
+ sending.then(handleResponse, handleError);
+}
Index: gc_lang/fr/xpi/data/gc_panel.html
==================================================================
--- gc_lang/fr/xpi/data/gc_panel.html
+++ gc_lang/fr/xpi/data/gc_panel.html
@@ -2,19 +2,10 @@
-
×
−
Index: make.py
==================================================================
--- make.py
+++ make.py
@@ -286,10 +286,11 @@
xParser.add_argument("-t", "--tests", help="run unit tests", action="store_true")
xParser.add_argument("-p", "--perf", help="run performance tests", action="store_true")
xParser.add_argument("-pm", "--perf_memo", help="run performance tests and store results in perf_memo.txt", action="store_true")
xParser.add_argument("-js", "--javascript", help="JavaScript build for Firefox", action="store_true")
xParser.add_argument("-fx", "--firefox", help="Launch Firefox Nightly for XPI testing", action="store_true")
+ xParser.add_argument("-we", "--web_ext", help="Launch Firefox Nightly for WebExtension testing", action="store_true")
xParser.add_argument("-tb", "--thunderbird", help="Launch Thunderbird", action="store_true")
xParser.add_argument("-i", "--install", help="install the extension in Writer (path of unopkg must be set in config.ini)", action="store_true")
xArgs = xParser.parse_args()
if xArgs.build_data:
@@ -349,14 +350,18 @@
# Firefox
if xArgs.firefox:
with helpers.cd("_build/xpi/"+sLang):
os.system("jpm run -b nightly")
+ if xArgs.web_ext:
+ with helpers.cd("_build/webext/"+sLang):
+ os.system(r'web-ext run --firefox="' + dVars['fx_beta_path'] + '" --browser-console')
+
# Thunderbird
if xArgs.thunderbird:
os.system("thunderbird -jsconsole -P debug")
else:
print("Folder not found: gc_lang/"+sLang)
if __name__ == '__main__':
main()