diff --git a/css/style.css b/css/style.css index d53f3b960..c364037d5 100644 --- a/css/style.css +++ b/css/style.css @@ -532,6 +532,9 @@ a.hide-announcement { clear: both; display: table; } +:root.fit-height .full-image { + max-height: 100vh; +} :root.fit-width .full-image { max-width: 100%; } diff --git a/src/Images/ImageExpand.coffee b/src/Images/ImageExpand.coffee index 38284688f..18d91fcc1 100644 --- a/src/Images/ImageExpand.coffee +++ b/src/Images/ImageExpand.coffee @@ -51,16 +51,20 @@ ImageExpand = $.queueTask func, post return setFitness: -> - {checked} = @ - (if checked then $.addClass else $.rmClass) doc, @name.toLowerCase().replace /\s+/g, '-' + (if @checked then $.addClass else $.rmClass) doc, @name.toLowerCase().replace /\s+/g, '-' +<% if (type === 'userjs') { %> +# XXX Opera doesn't support CSS vh. return unless @name is 'Fit height' - if checked + if @checked $.on window, 'resize', ImageExpand.resize unless ImageExpand.style ImageExpand.style = $.addStyle null ImageExpand.resize() else $.off window, 'resize', ImageExpand.resize + resize: -> + ImageExpand.style.textContent = ":root.fit-height .full-image {max-height:#{doc.clientHeight}px}" +<% } %> toggle: (post) -> {thumb} = post.file @@ -189,6 +193,3 @@ ImageExpand = $.event 'change', null, input $.on input, 'change', $.cb.checked el: label - - resize: -> - ImageExpand.style.textContent = ":root.fit-height .full-image {max-height:#{doc.clientHeight}px}"