From bd99124fb998c4c8b39fe28c83963cf5a82e3e17 Mon Sep 17 00:00:00 2001 From: psychobunny Date: Mon, 9 Mar 2015 16:49:53 -0400 Subject: [PATCH] refactored write preview code --- public/src/modules/composer/resize.js | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/public/src/modules/composer/resize.js b/public/src/modules/composer/resize.js index 0f4f1528c6..f2da4f90ca 100644 --- a/public/src/modules/composer/resize.js +++ b/public/src/modules/composer/resize.js @@ -143,12 +143,17 @@ define('composer/resize', function() { function resizeWritePreview(postContainer) { - var h1 = postContainer.find('.title-container').outerHeight(true); - var h2 = postContainer.find('.category-tag-row').outerHeight(true); - var h3 = postContainer.find('.formatting-bar').outerHeight(true); - var h4 = postContainer.find('.topic-thumb-container').outerHeight(true); - var h5 = $('.taskbar').height(); - var total = h1 + h2 + h3 + h4 + h5; + var rows = [ + postContainer.find('.title-container').outerHeight(true), + postContainer.find('.formatting-bar').outerHeight(true), + postContainer.find('.topic-thumb-container').outerHeight(true), + $('.taskbar').height() + ]; + + var total = rows.reduce(function(a, b) { + return a + b; + }); + postContainer.find('.write-preview-container').css('height', postContainer.height() - total); }