Browse Source

Added orientation

pull/23/merge
Zach Wise 13 years ago
parent
commit
665a26a2e9
  1. 11
      source/js/VMM.Browser.js

11
source/js/VMM.Browser.js

@ -10,7 +10,16 @@ if(typeof VMM != 'undefined' && typeof VMM.Browser == 'undefined') {
|| "an unknown version"; || "an unknown version";
this.OS = this.searchString(this.dataOS) || "an unknown OS"; this.OS = this.searchString(this.dataOS) || "an unknown OS";
this.device = this.searchDevice(navigator.userAgent); this.device = this.searchDevice(navigator.userAgent);
this.orientation = this.searchOrientation(window.orientation);
},
searchOrientation: function(orientation) {
if ( orientation == 0 || orientation == 180) {
return "portrait";
} else if ( orientation == 90 || orientation == -90) {
return "landscape";
} else {
return "normal";
}
}, },
searchDevice: function(d) { searchDevice: function(d) {
if (d.match(/Android/i) || d.match(/iPhone|iPod/i)) { if (d.match(/Android/i) || d.match(/iPhone|iPod/i)) {

Loading…
Cancel
Save