diff options
Diffstat (limited to 'read.html')
-rw-r--r-- | read.html | 63 |
1 files changed, 27 insertions, 36 deletions
@@ -20,6 +20,8 @@ <link id="favicon" rel="shortcut icon" type="image/png" href="img/favicon.png" /> <link type="text/css" rel="stylesheet" media="screen" href="css/read.css" /> + + <link type="text/css" rel="stylesheet" media="screen" href="themes/default.css" id="theme_css" /> </head> <body> @@ -40,6 +42,7 @@ <option>Arial</option> <option>Times New Roman</option> <option>Georgia</option> + <option>Courier New</option> </select> </div> </div> @@ -59,6 +62,17 @@ </div> <div class="form-group"> + <label class="col-sm-3 control-label">Theme</label> + <div class="col-sm-9"> + <select class="theme_name form-control" onchange="change_theme(this)"> + <option value="default">Default</option> + <option value="night">Night</option> + <option value="mocca">Mocca</option> + </select> + </div> + </div> + + <div class="form-group"> <label class="col-sm-3 control-label"></label> <div class="col-sm-9"> <div class="text-muted">Options take effect after reload:</div> @@ -179,6 +193,7 @@ </div> </div> +<div class="container"> <div class="header"> <span> <a href="#" onclick="save_and_close()">« Exit</a> @@ -196,10 +211,6 @@ <span class="glyphicon glyphicon-wrench" aria-hidden="true"></span> </button> - <button class="btn btn-default btn-xs" onclick="toggle_night_mode()"> - <span class="glyphicon glyphicon-eye-open" aria-hidden="true"></span> - </button> - <button class="btn btn-default btn-xs" data-toggle="modal" data-target="#search-modal"> <span class="glyphicon glyphicon-search" aria-hidden="true"></span> @@ -231,6 +242,7 @@ Opening book... </div> </div> +</div> <script> var _pagination_stored = 0; @@ -247,8 +259,6 @@ } $(document).ready(function() { - apply_night_mode(); - $(window).on('online', function() { console.log("we're online, storing lastread"); @@ -352,6 +362,7 @@ }); init_taps(); + apply_theme(); document.onkeydown = hotkey_handler; localforage.getItem("epube.enable-fullscreen").then(function(enable) { @@ -368,6 +379,9 @@ EPUBJS.core.addCss(baseUrl + "css/reader.css", null, renderer.doc.head); + $(book.renderer.doc.head) + .append("<link rel='stylesheet' id='theme_css' type='text/css' href='themes/default.css'>") + localforage.getItem("epube.disable-swipes").then(function(noswipes) { if (!noswipes) { @@ -411,27 +425,6 @@ }); } - var fontSize; - var fontFamily; - var lineHeight; - - Promise.all([ - localforage.getItem("epube.fontSize"), - localforage.getItem("epube.fontFamily"), - localforage.getItem("epube.lineHeight") - ]).then(function(res) { - fontSize = res[0] ? res[0] + "px" : DEFAULT_FONT_SIZE + "px"; - fontFamily = res[1] ? res[1] : DEFAULT_FONT_FAMILY; - lineHeight = res[2] ? res[2] + "%" : DEFAULT_LINE_HEIGHT + "%"; - - book.setStyle("fontSize", fontSize); - book.setStyle("fontFamily", fontFamily); - book.setStyle("lineHeight", lineHeight); - - book.setStyle("textAlign", "justify"); - - }); - window.book = book; var rendered = book.renderTo("reader"); @@ -472,6 +465,10 @@ $(".font_family").val(font); }); + localforage.getItem("epube.theme").then(function(theme) { + $(".theme_name").val(theme); + }); + localforage.getItem("epube.fontSize").then(function(size) { if (!size) size = DEFAULT_FONT_SIZE; @@ -649,16 +646,10 @@ }); book.on("renderer:chapterDisplayed", function() { + $("#reader").hide(); - // cleanup possibly interfering styles - // variables defined above after reading from localforage - - $("#reader iframe").contents().find("*") - .css("font-family", fontFamily) - .css("font-size", fontSize) - .css("line-height", lineHeight) - .css("text-align", "justify"); - + apply_theme(); + apply_styles(); }); book.on("renderer:keydown", hotkey_handler); |