From e77cd07978a79988822bb9d806023d23cebc4150 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sat, 12 Sep 2020 21:54:59 +0300 Subject: apply theme on rendition rendered hook --- js/reader.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/js/reader.js b/js/reader.js index a842a74..7cfb2ad 100644 --- a/js/reader.js +++ b/js/reader.js @@ -527,6 +527,8 @@ const Reader = { rendition.on('rendered', function(/*chapter*/) { $(".chapter").html($("").addClass("glyphicon glyphicon-th-list")); + Reader.applyTheme(); + Reader.resizeSideColumns(); try { @@ -673,7 +675,7 @@ const Reader = { if (EpubeApp.isNightMode()) theme = "night"; - console.log('theme', theme); + console.log('setting main UI theme', theme); const theme_url = base_url + "themes/" + theme + ".css"; const theme_data = Reader.Loader._res_data[theme_url]; @@ -701,9 +703,14 @@ const Reader = { } /* apply to existing reader */ + //$($("#reader iframe")[0].contentDocument).find("#theme_css").text(Reader.Loader._res_data[theme_url]) + $.each(window.book.rendition.getContents(), function(i, c) { + console.log('applying rendition theme', theme); + $(c.document).find("#theme_css").text(Reader.Loader._res_data[theme_url]) }); + }); }, hotkeyHandler: function(e) { -- cgit v1.2.3