Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// @flow
import MobileDetect from 'mobile-detect';
/* Trivial case */
// $ExpectError
MobileDetect.foo();
const detect = new MobileDetect('');
detect.mobile();
detect.mobileGrade();
detect.os();
detect.phone();
detect.tablet();
detect.userAgent();
detect.userAgents();
detect.version('Mobile');
detect.versionStr('Mobile');
detect.isPhoneSized(1024);
// $ExpectError
detect.foo();
_getPlatform() {
const ua = window.navigator.userAgent
const md = new MobileDetect(ua);
client.platform.isMobile = (md.mobile() !== null); // true if phone or tablet
client.platform.os = (() => {
let os = md.os();
if (os === 'AndroidOS') {
return 'android';
} else if (os === 'iOS') {
return 'ios';
} else {
return 'other';
}
})();
}
_definePlatform() {
const ua = window.navigator.userAgent
const md = new MobileDetect(ua);
client.platform.isMobile = (md.mobile() !== null); // true if phone or tablet
client.platform.os = (function() {
const os = md.os();
if (os === 'AndroidOS')
return 'android';
else if (os === 'iOS')
return 'ios';
else
return 'other';
})();
}
}
}
if(fs.existsSync(path.resolve(options.projectRootPath, 'node_modules', 'pellet', 'node_modules', 'messageformat'))) {
externalDependencies.messageformat = path.join('pellet', 'node_modules', 'messageformat');
} else {
externalDependencies.messageformat = path.resolve(__dirname, '..', 'node_modules', 'messageformat');
}
if(fs.existsSync(path.resolve(options.projectRootPath, 'node_modules', 'pellet', 'node_modules', 'superagent'))) {
externalDependencies.superagent = path.join('pellet', 'node_modules', 'superagent');
} else {
externalDependencies.superagent = path.resolve(__dirname, '..', 'node_modules', 'superagent');
}
if (fs.existsSync(path.resolve(options.projectRootPath, 'node_modules', 'pellet', 'node_modules', 'mobile-detect', 'mobile-detect.min.js'))) {
externalDependencies['mobile-detect/mobile-detect.min.js'] = path.join('pellet', 'node_modules', 'mobile-detect', 'mobile-detect.min.js');
} else {
externalDependencies['mobile-detect/mobile-detect.min.js'] = path.resolve(__dirname, '..', 'node_modules', 'mobile-detect', 'mobile-detect.min.js');
}
} else {
externalDependencies = {
React: 'react/addons',
react: 'react/addons',
intl: 'intl',
superagent:'superagent',
messageformat: 'messageformat',
ejs: 'ejs'
};
//if (!fs.existsSync(path.resolve(__dirname, '..', 'node_modules', 'mobile-detect', 'mobile-detect.min.js'))) {
// externalDependencies['mobile-detect/mobile-detect.min.js'] = path.resolve(__dirname, '..', 'node_modules', 'mobile-detect', 'mobile-detect.min.js');
//}
function Sniffer (...opts) {
this.classes = ''
this.debug = (opts[0].debug)
this.embedded = false
this._mobileSniffer = new MobileDetect(window.navigator.userAgent)
}
const getMedia = (userAgent: string, userAgentDevice: string) => {
const isAtSmallUp = true;
let isMobile = true;
let isTablet = false;
if (userAgentDevice) {
isMobile =
userAgentDevice === 'smartphone' ||
userAgentDevice === 'mobilebot' ||
userAgentDevice === 'mobile';
isTablet = userAgentDevice === 'tablet';
} else {
const mobileDetect = new MobileDetect(userAgent);
isMobile = Boolean(mobileDetect.phone());
isTablet = Boolean(mobileDetect.tablet());
}
return {
isAtSmallUp,
isAtMediumUp: isTablet || !isMobile,
isAtLargeUp: !isMobile && !isTablet,
};
};
render() {
const argState = this.accessor.getQueryObject();
let { focusedInput, startDate, endDate, initialVisibleMonth } = this.state;
/**
* These functions can return null so check for bool true.
*/
const md = new MobileDetect(window.navigator.userAgent);
const isMobile = md.mobile() || md.phone();
const numberOfMonths = isMobile ? 1 : 2;
if (this.noArgs && argState[this.props.id] !== undefined && Object.keys(argState[this.props.id]).length > 0) {
if (typeof argState[this.props.id].min !== undefined) {
startDate = moment(argState[this.props.id].min)
initialVisibleMonth = () => startDate
}
endDate = (typeof argState[this.props.id].max !== undefined) ? moment(argState[this.props.id].max) : null
}
return (
<div>
</div>
created() {
var md = new MobileDetect(window.navigator.userAgent);
this.$store.state.mobile = md.mobile();
}
}
skyboxContainer2RotZ: 175, //ajust X value to rotate sky into position according to long
skyboxRotX: 54,
skyboxRotY: 326,
skyboxRotZ: 347
};
var defaultWaterSide = THREE.FrontSide;
var debugOn = false;
var pointClouds = [];
var spriteContainer;
var md = new MobileDetect(window.navigator.userAgent);
var androidVersion = md.versionStr('Android');
var iOSVersion = md.versionStr('iOS')
var oldAndroid = (androidVersion !== null && cmpVersions(androidVersion,'5', '.') < 0);
var oldIOS = (iOSVersion !== null && cmpVersions(iOSVersion,'9', '_') < 0);
var canHandleOrientation = false;
(function() {
var originalGetExtensionFunction = WebGLRenderingContext.prototype.getExtension;
componentDidMount() {
let userAgent = window.navigator.userAgent;
let mobile = new MobileDetect(userAgent);
this.setState({isMobile: (mobile.phone() !== null ) ? true : false});
}