diff --git a/4chan_x.js b/4chan_x.js index 2ca70e92c..51e046db4 100644 --- a/4chan_x.js +++ b/4chan_x.js @@ -2237,12 +2237,17 @@ return $.rm(thumb.nextSibling); }, expand: function(thumb) { - var a, img; + var a, filesize, img, max, _, _ref2; $.hide(thumb); a = thumb.parentNode; img = $.el('img', { src: a.href }); + if (a.parentNode.className !== 'op') { + filesize = $.x('preceding::span[@class="filesize"][1]', a); + _ref2 = filesize.textContent.match(/(\d+)x/), _ = _ref2[0], max = _ref2[1]; + img.setAttribute('style', "max-width: -moz-calc(" + max + "px);"); + } return a.appendChild(img); }, dialog: function() { diff --git a/script.coffee b/script.coffee index 02d218ec7..bbfbc7a5f 100644 --- a/script.coffee +++ b/script.coffee @@ -1716,6 +1716,10 @@ imgExpand = a = thumb.parentNode img = $.el 'img', src: a.href + unless a.parentNode.className is 'op' + filesize = $.x 'preceding::span[@class="filesize"][1]', a + [_, max] = filesize.textContent.match /(\d+)x/ + img.setAttribute 'style', "max-width: -moz-calc(#{max}px);" a.appendChild img dialog: ->