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
@@ -56,10 +56,12 @@
padding: 2px;
justify-content: center;
}
#lexicon_button {
background-color: hsl(210, 80%, 90%);
+ color: hsl(210, 80%, 30%);
+ font-weight: bold;
}
.main_button {
margin: 0 5px;
width: 100px;
padding: 10px 20px;
@@ -74,11 +76,11 @@
padding: 10px;
background-color: hsl(210, 20%, 96%);
border-radius: 5px;
}
-#add_word_page {
+#add_page {
display: none;
}
.columns {
display: flex;
@@ -212,10 +214,17 @@
#lexicon_page {
}
+#search_page {
+ display: none;
+}
+
+#info_page {
+ display: none;
+}
.button_block {
margin: 5px 0px;
background-color: hsl(210, 10%, 90%);
border-radius: 5px;
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
@@ -23,14 +23,16 @@
-
Votre lexique
+
+
+
+
+
+
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
@@ -47,31 +47,54 @@
} else {
console.log("HTML node named <" + sElemId + "> not found.")
}
}
-function showPage (sPage) {
- if (sPage == "lexicon") {
- hideElement("add_word_page");
- showElement("lexicon_page");
- document.getElementById("lexicon_button").style.backgroundColor = "hsl(210, 80%, 90%)";
- document.getElementById("add_word_button").style.backgroundColor = "hsl(210, 10%, 95%)";
- } else {
- hideElement("lexicon_page");
- showElement("add_word_page");
- document.getElementById("lexicon_button").style.backgroundColor = "hsl(210, 10%, 95%)";
- document.getElementById("add_word_button").style.backgroundColor = "hsl(210, 80%, 90%)";
- document.getElementById("lemma").focus();
- }
-}
-
-
-document.getElementById("lexicon_button").addEventListener("click", () => { showPage("lexicon"); }, false);
-document.getElementById("add_word_button").addEventListener("click", () => { showPage("lemma"); }, false);
-
-document.getElementById("save_button").addEventListener("click", () => { oBinaryDict.build(); }, false);
-
+
+const oTabulations = {
+
+ lPage: ["lexicon_page", "add_page", "search_page", "info_page"],
+
+ showPage: function (sRequestedPage) {
+ for (let sPage of this.lPage) {
+ if (sPage !== sRequestedPage) {
+ hideElement(sPage);
+ this.downlightButton(sPage.slice(0,-5) + "_button");
+ }
+ }
+ showElement(sRequestedPage);
+ this.highlightButton(sRequestedPage.slice(0,-5) + "_button");
+ if (sRequestedPage == "add_page") {
+ document.getElementById("lemma").focus();
+ }
+ },
+
+ highlightButton: function (sButton) {
+ if (document.getElementById(sButton)) {
+ let xButton = document.getElementById(sButton);
+ xButton.style.backgroundColor = "hsl(210, 80%, 90%)";
+ xButton.style.color = "hsl(210, 80%, 30%)";
+ xButton.style.fontWeight = "bold";
+ }
+ },
+
+ downlightButton: function (sButton) {
+ if (document.getElementById(sButton)) {
+ let xButton = document.getElementById(sButton);
+ xButton.style.backgroundColor = "hsl(210, 10%, 95%)";
+ xButton.style.color = "hsl(210, 10%, 50%)";
+ xButton.style.fontWeight = "normal";
+ }
+ },
+
+ listen: function () {
+ document.getElementById("lexicon_button").addEventListener("click", () => { this.showPage("lexicon_page"); }, false);
+ document.getElementById("add_button").addEventListener("click", () => { this.showPage("add_page"); }, false);
+ document.getElementById("search_button").addEventListener("click", () => { this.showPage("search_page"); }, false);
+ document.getElementById("info_button").addEventListener("click", () => { this.showPage("info_page"); }, false);
+ }
+}
class Table {
constructor (sNodeId, lColumn, sProgressBarId, sResultId="") {
@@ -492,10 +515,11 @@
document.getElementById("dic_num_entries").textContent = nEntries;
document.getElementById("dic_save_date").textContent = sDate;
},
listen: function () {
+ document.getElementById("save_button").addEventListener("click", () => { this.build(); }, false);
document.getElementById("export_button").addEventListener("click", () => { this.export(); }, false);
document.getElementById("import_button").addEventListener("click", () => { this.import(); }, false);
},
build: function () {
@@ -532,5 +556,6 @@
const oGenWordsTable = new Table("generated_words_table", ["Flexions", "Étiquettes"], "wait_progress");
oBinaryDict.load();
oBinaryDict.listen();
oGenerator.listen();
+oTabulations.listen();