Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

Titanium Detectors based on: https://gist.github.com/FokkeZB/5497028

View detect.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
var platformName = Ti.Platform.name;
exports.android = (platformName === 'android');
exports.ios = (platformName === 'iPhone OS');
exports.mobileweb = (platformName === 'mobileweb');
 
var deployType = Ti.App.deployType;
exports.development = (deployType === 'development');
exports.test = (deployType === 'test');
exports.production = (deployType === 'production');
 
 
function isTabletFallback() {
return !(Math.min(
Ti.Platform.displayCaps.platformHeight,
Ti.Platform.displayCaps.platformWidth
) < 700);
}
 
exports.tablet = (function() {
if (OS_IOS) {
return Ti.Platform.osname === 'ipad';
}
if (OS_ANDROID) {
var psc = Ti.Platform.Android.physicalSizeCategory;
return psc === Ti.Platform.Android.PHYSICAL_SIZE_CATEGORY_LARGE ||
psc === Ti.Platform.Android.PHYSICAL_SIZE_CATEGORY_XLARGE;
}
if (OS_MOBILEWEB) {
return !(Math.min(
Ti.Platform.displayCaps.platformHeight,
Ti.Platform.displayCaps.platformWidth
) < 400);
}
return isTabletFallback();
 
}());
 
exports.handheld = !exports.isTablet;

Good work, the line 19 and the line 38 must be the same exports.isTablet or exports.tablet
Thanks for sharing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.