From 882589acaee7d30e5065b8d24b9725ca694e44a7 Mon Sep 17 00:00:00 2001 From: psychobunny Date: Thu, 1 May 2014 13:43:07 -0400 Subject: [PATCH] moved findBootstrapEnvironment into utils --- public/src/modules/composer.js | 22 +--------------------- public/src/utils.js | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 21 deletions(-) diff --git a/public/src/modules/composer.js b/public/src/modules/composer.js index bd97c20b29..a6c6b0f830 100644 --- a/public/src/modules/composer.js +++ b/public/src/modules/composer.js @@ -156,24 +156,6 @@ define(['taskbar'], function(taskbar) { composer.load(uuid); } - //http://stackoverflow.com/questions/14441456/how-to-detect-which-device-view-youre-on-using-twitter-bootstrap-api - function findBootstrapEnvironment() { - var envs = ['xs', 'sm', 'md', 'lg'], - $el = $('
'); - - $el.appendTo($('body')); - - for (var i = envs.length - 1; i >= 0; i--) { - var env = envs[i]; - - $el.addClass('hidden-'+env); - if ($el.is(':hidden')) { - $el.remove(); - return env; - } - } - } - function composerAlert(message) { $('.action-bar button').removeAttr('disabled'); app.alert({ @@ -186,7 +168,6 @@ define(['taskbar'], function(taskbar) { } function initializeDragAndDrop(post_uuid) { - if($.event.props.indexOf('dataTransfer') === -1) { $.event.props.push('dataTransfer'); } @@ -852,7 +833,6 @@ define(['taskbar'], function(taskbar) { }; composer.activateReposition = function(post_uuid) { - if(composer.active && composer.active !== post_uuid) { composer.minimize(composer.active); } @@ -861,7 +841,7 @@ define(['taskbar'], function(taskbar) { postContainer = $('#cmp-uuid-' + post_uuid); composer.active = post_uuid; - var env = findBootstrapEnvironment(); + var env = utils.findBootstrapEnvironment(); if (percentage) { if ( env === 'md' || env === 'lg') { diff --git a/public/src/utils.js b/public/src/utils.js index 528f5b9981..534ef59273 100644 --- a/public/src/utils.js +++ b/public/src/utils.js @@ -254,6 +254,24 @@ // http://stackoverflow.com/questions/9286355/how-to-detect-only-the-native-android-browser var nua = navigator.userAgent; return ((nua.indexOf('Mozilla/5.0') > -1 && nua.indexOf('Android ') > -1 && nua.indexOf('AppleWebKit') > -1) && !(nua.indexOf('Chrome') > -1)); + }, + + findBootstrapEnvironment: function() { + //http://stackoverflow.com/questions/14441456/how-to-detect-which-device-view-youre-on-using-twitter-bootstrap-api + var envs = ['xs', 'sm', 'md', 'lg'], + $el = $('
'); + + $el.appendTo($('body')); + + for (var i = envs.length - 1; i >= 0; i--) { + var env = envs[i]; + + $el.addClass('hidden-'+env); + if ($el.is(':hidden')) { + $el.remove(); + return env; + } + } } };