/* * DEVICE AND BROWSER DETECTION ================================================== */ if(typeof VMM != 'undefined' && typeof VMM.Browser == 'undefined') { VMM.Browser = { init: function () { this.browser = this.searchString(this.dataBrowser) || "An unknown browser"; this.version = this.searchVersion(navigator.userAgent) || this.searchVersion(navigator.appVersion) || "an unknown version"; this.OS = this.searchString(this.dataOS) || "an unknown OS"; this.device = this.searchDevice(navigator.userAgent); this.orientation = this.searchOrientation(window.orientation); }, searchOrientation: function(orientation) { var orient = ""; if ( orientation == 0 || orientation == 180) { orient = "portrait"; } else if ( orientation == 90 || orientation == -90) { orient = "landscape"; } else { orient = "normal"; } return orient; }, searchDevice: function(d) { var device = ""; if (d.match(/Android/i) || d.match(/iPhone|iPod/i)) { device = "mobile"; } else if (d.match(/iPad/i)) { device = "tablet"; } else if (d.match(/BlackBerry/i) || d.match(/IEMobile/i)) { device = "other mobile"; } else { device = "desktop"; } return device; }, searchString: function (data) { for (var i=0;i