having composer/resize call findBootstrapEnvironment only on the first resize method call, and not right when library is required, #2417

This commit is contained in:
Julian Lam
2015-01-06 16:09:35 -05:00
parent 428a431164
commit 835886998b

View File

@@ -4,9 +4,9 @@
/* globals app, define, config, utils*/
define('composer/resize', function() {
var resize = {};
var env = utils.findBootstrapEnvironment();
var oldPercentage = 0;
var resize = {},
oldPercentage = 0,
env;
resize.reposition = function(postContainer) {
var percentage = localStorage.getItem('composer:resizePercentage');
@@ -15,6 +15,10 @@ define('composer/resize', function() {
};
function doResize(postContainer, percentage) {
if (!env) {
env = utils.findBootstrapEnvironment();
}
if (percentage) {
if (env === 'md' || env === 'lg') {
postContainer.css('height', Math.floor($(window).height() * percentage) + 'px');