From 248d95a4a09d4f0ded397ffb9551837351396e35 Mon Sep 17 00:00:00 2001 From: Parziphal Date: Thu, 21 Nov 2013 14:04:29 -0500 Subject: [PATCH] reverted Post.resize_image to original --- lib/assets/javascripts/moe-legacy/post.js | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/lib/assets/javascripts/moe-legacy/post.js b/lib/assets/javascripts/moe-legacy/post.js index 23779fd..61e5174 100755 --- a/lib/assets/javascripts/moe-legacy/post.js +++ b/lib/assets/javascripts/moe-legacy/post.js @@ -751,24 +751,24 @@ Post = { resize_image: function() { var img = $("image"); - var large_width = (img.naturalWidth == img.readAttribute('large_width')) ? img.readAttribute('large_width') : img.naturalWidth; - var large_height = (img.naturalHeight == img.readAttribute('large_height')) ? img.readAttribute('large_height') : img.naturalHeight; - + + if(img.original_width == null) + { + img.original_width = img.width; + img.original_height = img.height; + } + var ratio = 1; if ((img.scale_factor == 1) || (img.scale_factor == null)) { /* Use clientWidth for sizing the width, and the window height for the height. * This prevents needing to scroll horizontally to center the image. */ var client_width = $("right-col").clientWidth - 15; var client_height = window.innerHeight - 15; - // if (img.width > img.height) { - ratio = Math.min(ratio, client_width / large_width); - ratio = Math.min(ratio, client_height / large_height); - // } else { - // ratio = Math.min(ratio, client_width / img.large_width); - // } + ratio = Math.min(ratio, client_width / img.original_width); + ratio = Math.min(ratio, client_height / img.original_height); } - img.width = large_width * ratio; - img.height = large_height * ratio; + img.width = img.original_width * ratio; + img.height = img.original_height * ratio; img.scale_factor = ratio; if (window.Note) {