diff options
Diffstat (limited to 'js')
-rw-r--r-- | js/read.js | 38 |
1 files changed, 15 insertions, 23 deletions
@@ -117,36 +117,28 @@ function hotkey_handler(e) { } } -$(document).ready(function() { - document.onkeydown = hotkey_handler; +function resize_side_columns() { + var width = $("#reader").position().left; - $(window).on("mouseup", function(evt) { - if (evt.button == 0) { + var iframe = $("#reader iframe")[0]; - if ($(".modal").is(":visible")) - return; + if (iframe && iframe.contentWindow.$) + width += parseInt(iframe.contentWindow.$("body").css("padding-left"), 10); - var reader = $("#reader"); - var doc = $(document); - var margin_side = parseInt(reader.css("left"), 10); - var margin_top = parseInt(reader.css("top"), 10); - var margin_bottom = parseInt(reader.css("bottom"), 10); + $("#left, #right").width(width); +} - //console.log(margin_side, margin_top, margin_bottom); +$(document).ready(function() { + document.onkeydown = hotkey_handler; - if (evt.clientY < margin_top || evt.clientY >= doc.height() - margin_bottom) { - return; - } + $("#left").on("mouseup", function(evt) { + prev_page(); + }); - if (evt.clientX >= doc.width() - margin_side) { - console.log("RIGHT SIDE"); - next_page(); - } else if (evt.clientX <= margin_side) { - console.log("LEFT SIDE"); - prev_page(); - } - } + $("#right").on("mouseup", function(evt) { + next_page(); }); + }); function apply_line_height(elem) { |