diff options
author | Andrew Dolgov <[email protected]> | 2018-07-02 13:04:30 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2018-07-02 13:04:30 +0300 |
commit | 7b462f0b3ce566ac7edba96507ca951371705776 (patch) | |
tree | 0709702f6eaf482b13c922d204bb4472784bdad7 /js | |
parent | edbc49b9b7ad9dd4323db4a0e4ed0a7907871dd6 (diff) |
add manually-resized turn page columns instead of previous padding hacks
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) { |