mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-06 14:05:46 +01:00
moved findBootstrapEnvironment into utils
This commit is contained in:
@@ -156,24 +156,6 @@ define(['taskbar'], function(taskbar) {
|
|||||||
composer.load(uuid);
|
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 = $('<div>');
|
|
||||||
|
|
||||||
$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) {
|
function composerAlert(message) {
|
||||||
$('.action-bar button').removeAttr('disabled');
|
$('.action-bar button').removeAttr('disabled');
|
||||||
app.alert({
|
app.alert({
|
||||||
@@ -186,7 +168,6 @@ define(['taskbar'], function(taskbar) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function initializeDragAndDrop(post_uuid) {
|
function initializeDragAndDrop(post_uuid) {
|
||||||
|
|
||||||
if($.event.props.indexOf('dataTransfer') === -1) {
|
if($.event.props.indexOf('dataTransfer') === -1) {
|
||||||
$.event.props.push('dataTransfer');
|
$.event.props.push('dataTransfer');
|
||||||
}
|
}
|
||||||
@@ -852,7 +833,6 @@ define(['taskbar'], function(taskbar) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
composer.activateReposition = function(post_uuid) {
|
composer.activateReposition = function(post_uuid) {
|
||||||
|
|
||||||
if(composer.active && composer.active !== post_uuid) {
|
if(composer.active && composer.active !== post_uuid) {
|
||||||
composer.minimize(composer.active);
|
composer.minimize(composer.active);
|
||||||
}
|
}
|
||||||
@@ -861,7 +841,7 @@ define(['taskbar'], function(taskbar) {
|
|||||||
postContainer = $('#cmp-uuid-' + post_uuid);
|
postContainer = $('#cmp-uuid-' + post_uuid);
|
||||||
|
|
||||||
composer.active = post_uuid;
|
composer.active = post_uuid;
|
||||||
var env = findBootstrapEnvironment();
|
var env = utils.findBootstrapEnvironment();
|
||||||
|
|
||||||
if (percentage) {
|
if (percentage) {
|
||||||
if ( env === 'md' || env === 'lg') {
|
if ( env === 'md' || env === 'lg') {
|
||||||
|
|||||||
@@ -254,6 +254,24 @@
|
|||||||
// http://stackoverflow.com/questions/9286355/how-to-detect-only-the-native-android-browser
|
// http://stackoverflow.com/questions/9286355/how-to-detect-only-the-native-android-browser
|
||||||
var nua = navigator.userAgent;
|
var nua = navigator.userAgent;
|
||||||
return ((nua.indexOf('Mozilla/5.0') > -1 && nua.indexOf('Android ') > -1 && nua.indexOf('AppleWebKit') > -1) && !(nua.indexOf('Chrome') > -1));
|
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 = $('<div>');
|
||||||
|
|
||||||
|
$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;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user