summaryrefslogtreecommitdiff
path: root/read.html
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2018-02-02 10:14:50 +0300
committerAndrew Dolgov <[email protected]>2018-02-02 10:14:50 +0300
commit47b0c89467be9aede4590df01427c44f7134477c (patch)
treeeab98eccd4bcd2ee6137de0824e0dff705fa7c76 /read.html
parented676793434b2009da63d383af887d5f9158fb35 (diff)
fix theme not set properly on chapter reload if changed in the UI
Diffstat (limited to 'read.html')
-rw-r--r--read.html14
1 files changed, 8 insertions, 6 deletions
diff --git a/read.html b/read.html
index b61fa3c..7f94593 100644
--- a/read.html
+++ b/read.html
@@ -372,16 +372,18 @@
});
EPUBJS.Hooks.register("beforeChapterDisplay").applyTheme = function(callback, renderer) {
- var baseUrl = window.location.href.match(/^.*\//)[0];
-console.log('tn', themeName);
+ localforage.getItem("epube.theme").then(function(theme) {
+ var baseUrl = window.location.href.match(/^.*\//)[0];
- $(book.renderer.doc.head)
- .append($("<link rel='stylesheet' id='theme_css' type='text/css'>")
- .attr('href', baseUrl + 'themes/' + themeName + '.css'));
+ if (!theme) theme = 'default';
+ $(book.renderer.doc.head)
+ .append($("<link rel='stylesheet' id='theme_css' type='text/css'>")
+ .attr('href', baseUrl + 'themes/' + theme + '.css'));
- if (callback) callback();
+ if (callback) callback();
+ });
}
EPUBJS.Hooks.register("beforeChapterDisplay").swipeDetection = function(callback, renderer) {