diff --git a/resources/compiled_coffeescript.zip b/resources/compiled_coffeescript.zip index 1934079e84..fefc756553 100644 Binary files a/resources/compiled_coffeescript.zip and b/resources/compiled_coffeescript.zip differ diff --git a/src/calibre/ebooks/oeb/display/paged.coffee b/src/calibre/ebooks/oeb/display/paged.coffee index 07d4ae33e8..e53b94236d 100644 --- a/src/calibre/ebooks/oeb/display/paged.coffee +++ b/src/calibre/ebooks/oeb/display/paged.coffee @@ -142,6 +142,14 @@ class PagedDisplay # Check if the current document is a full screen layout like # cover, if so we treat it specially. single_screen = (document.body.scrollHeight < window.innerHeight + 75) + has_svg = document.getElementsByTagName('svg').length > 0 + only_img = document.getElementsByTagName('img').length == 1 and document.getElementsByTagName('div').length < 3 and document.getElementsByTagName('p').length < 2 + if only_img + has_viewport = document.head and document.head.querySelector('meta[name="viewport"]') + if has_viewport + # Has a viewport and only an img, is probably a comic, see for + # example: https://bugs.launchpad.net/bugs/1667357 + single_screen = true this.handle_rtl_body(body_style) first_layout = true if not single_screen and this.cols_per_screen > 1 @@ -248,8 +256,6 @@ class PagedDisplay # width 100% are wider than body and lead to a blank page after the # current page (when cols_per_screen == 1). Similarly img elements # with height=100% overflow the first column - has_svg = document.getElementsByTagName('svg').length > 0 - only_img = document.getElementsByTagName('img').length == 1 and document.getElementsByTagName('div').length < 3 and document.getElementsByTagName('p').length < 2 # We only set full_screen_layout if scrollWidth is in (body_width, # 2*body_width) as if it is <= body_width scrolling will work # anyway and if it is >= 2*body_width it can't be a full screen