summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2020-04-22 06:52:23 +0300
committerAndrew Dolgov <[email protected]>2020-04-22 06:52:23 +0300
commit2295bd1fccc31cc7b21400f1517e5a6cac5b5d14 (patch)
tree48ec63d13b1fbf819d5c47968c4557eaff6b1d3a /js
parent8294f925aa8335a8eef496340acd6047926c3b4b (diff)
app: use manual night mode switch for index for the time being; pass theme bg color to app
Diffstat (limited to 'js')
-rw-r--r--js/app.js6
-rw-r--r--js/reader.js16
2 files changed, 17 insertions, 5 deletions
diff --git a/js/app.js b/js/app.js
index 5c55fb3..25e3ce2 100644
--- a/js/app.js
+++ b/js/app.js
@@ -215,10 +215,8 @@ const App = {
},
initNightMode: function() {
if (typeof EpubeApp != "undefined") {
- if (!EpubeApp.isAutoNightModeSupported()) {
- App.applyNightMode(EpubeApp.isNightMode());
- return;
- }
+ App.applyNightMode(EpubeApp.isNightMode());
+ return;
}
if (window.matchMedia) {
diff --git a/js/reader.js b/js/reader.js
index 5aeca51..73aa73a 100644
--- a/js/reader.js
+++ b/js/reader.js
@@ -664,11 +664,25 @@ const Reader = {
$("#theme_css").attr("href", theme_url);
+ if (typeof EpubeApp != "undefined") {
+ window.setTimeout(function() {
+ const bg_color = window.getComputedStyle(document.querySelector("body"), null)
+ .getPropertyValue("background-color");
+
+ const match = bg_color.match(/rgb\((\d{1,}), (\d{1,}), (\d{1,})\)/);
+
+ if (match) {
+ console.log("sending bgcolor", match);
+
+ EpubeApp.setStatusBarColor(parseInt(match[1]), parseInt(match[2]), parseInt(match[3]));
+ }
+ }, 250);
+ }
+
/* apply to existing reader */
$.each(window.book.rendition.getContents(), function(i, c) {
$(c.document).find("#theme_css").text(Reader.Loader._res_data[theme_url])
});
-
});
},
hotkeyHandler: function(e) {