From: Laurent Mazet
Date: Thu, 13 Aug 2020 07:36:32 +0000 (+0200)
Subject: make flash light color configurable
X-Git-Url: https://secure.softndesign.org/git/?a=commitdiff_plain;h=09dafa5cb72bd6f745092dbcdafa84a0493bcf6b;p=trivabble.git
make flash light color configurable
---
diff --git a/l10n/po/fr/trivabble.po b/l10n/po/fr/trivabble.po
index a48a19f..247ef1f 100644
--- a/l10n/po/fr/trivabble.po
+++ b/l10n/po/fr/trivabble.po
@@ -183,3 +183,6 @@ msgstr "(ms)"
msgid "Flash light duration"
msgstr "Durée du flash laser"
+
+msgid "Flash light color"
+msgstr "Couleur du flash laser"
diff --git a/l10n/pot/trivabble.pot b/l10n/pot/trivabble.pot
index 544eda4..8c55bf8 100644
--- a/l10n/pot/trivabble.pot
+++ b/l10n/pot/trivabble.pot
@@ -188,3 +188,6 @@ msgstr ""
msgid "Flash light duration"
msgstr ""
+
+msgid "Flash light color"
+msgstr ""
diff --git a/public/index.html b/public/index.html
index 30f3f9f..6886496 100644
--- a/public/index.html
+++ b/public/index.html
@@ -65,6 +65,10 @@
Flash light duration
(ms)
+
+
diff --git a/public/trivabble.js b/public/trivabble.js
index b41f3e5..3fb5eb8 100644
--- a/public/trivabble.js
+++ b/public/trivabble.js
@@ -44,6 +44,7 @@
setConf("APP_PATH", "");
setConf("DOUBLE_TAP_DURATION", 1000);
setConf("FLASH_LIGHT_DURATION", 1500);
+ setConf("FLASH_LIGHT_COLOR", "#E3E");
const _ = (window.libD && libD.l10n) ? libD.l10n() : function (s) {
return s;
@@ -1606,6 +1607,22 @@
document.getElementById("flash-light-duration").value;
};
}
+
+ if (!Object.prototype.hasOwnProperty.call(localStorage, "flashLightColor")) {
+ localStorage.flashLightColor = Conf.FLASH_LIGHT_COLOR;
+ }
+ const flashLightColor = document.getElementById("flash-light-color");
+ if (flashLightColor) {
+ flashLightColor.value = localStorage.flashLightColor;
+ flashLightColor.onchange = function () {
+ localStorage.flashLightColor =
+ document.getElementById("flash-light-color").value;
+ var style = document.createElement('style')
+ style.innerHTML = ".highlight {background-color: " + localStorage.flashLightColor + ";}";
+ document.body.appendChild(style);
+ };
+ flashLightColor.onchange();
+ }
}
function repromptName(f) {