com.gwtplatform.mvp.FormFactor.gwt.xml Maven / Gradle / Ivy
= 0) {
var value = args.substring(start);
var begin = value.indexOf("=") + 1;
var end = value.indexOf("&");
if (end == -1) {
end = value.indexOf("#");
if (end == -1) {
end = value.length;
}
}
return value.substring(begin, end);
}
// Detect form factor from user agent.
var ua = navigator.userAgent.toLowerCase();
if (ua.indexOf("iphone") != -1 || ua.indexOf("ipod") != -1) {
return "mobile";
} else if (ua.indexOf("ipad") != -1) {
return "tablet";
} else if (ua.indexOf("android") != -1 ||
ua.indexOf("mobile") != -1) {
var dpi = 160;
var width = $wnd.screen.width / dpi;
var height = $wnd.screen.height / dpi;
var size = Math.sqrt(width*width + height*height);
return (size < 6) ? "mobile" : "tablet";
}
return "desktop";
]]>