diff --git a/js/platform.js b/js/platform.js index ee1e198133..ddb36191b0 100644 --- a/js/platform.js +++ b/js/platform.js @@ -1,17 +1,31 @@ (function(ionic) { ionic.Platform = { - PLATFORM_CLASS_MAP: { - 'ios7': 'ios7' - }, - annotate: function() { - var platform = this._checkPlatforms(); - platform && document.body.classList.add('platform-' + platform); - }, - _checkPlatforms: function() { - if(this.isIOS7()) { - return 'ios7'; + detect: function() { + var platforms = []; + + console.log('Checking platforms'); + var platform = this._checkPlatforms(platforms); + console.log('Got platforms', platforms); + + for(var i = 0; i < platforms.length; i++) { + document.body.classList.add('platform-' + platforms[i]); } + + }, + _checkPlatforms: function(platforms) { + if(this.isCordova()) { + platforms.push('cordova'); + } + if(this.isIOS7()) { + platforms.push('ios7'); + } + }, + + // Check if we are running in Cordova, which will have + // window.device available. + isCordova: function() { + return 'device' in window; }, isIOS7: function() { if(!window.device) { @@ -21,6 +35,5 @@ } } - ionic.Platform.annotate(); - + ionic.Platform.detect(); })(ionic = window.ionic || {});