mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
platform detect updates
This commit is contained in:
10
dist/js/ionic-angular.js
vendored
10
dist/js/ionic-angular.js
vendored
@@ -435,15 +435,7 @@ angular.module('ionic.service.platform', [])
|
||||
|
||||
// We need to do some stuff as soon as we know the platform,
|
||||
// like adjust header margins for iOS 7, etc.
|
||||
setTimeout(function afterReadyWait() {
|
||||
if(isReady() && ionic.Platform.detect()) {
|
||||
return;
|
||||
} else {
|
||||
setTimeout(afterReadyWait, 50);
|
||||
}
|
||||
}, 10);
|
||||
|
||||
|
||||
ionic.Platform.detect();
|
||||
|
||||
|
||||
return {
|
||||
|
||||
2
dist/js/ionic-angular.min.js
vendored
2
dist/js/ionic-angular.min.js
vendored
File diff suppressed because one or more lines are too long
40
dist/js/ionic.js
vendored
40
dist/js/ionic.js
vendored
@@ -1737,27 +1737,34 @@ window.ionic = {
|
||||
(function(ionic) {
|
||||
|
||||
ionic.Platform = {
|
||||
|
||||
detect: function() {
|
||||
var platforms = [];
|
||||
|
||||
var domReady = function() {
|
||||
// run when the DOM is ready
|
||||
document.addEventListener("deviceready", deviceReady, false);
|
||||
document.removeEventListener("DOMContentLoaded", domReady, false);
|
||||
};
|
||||
document.addEventListener("DOMContentLoaded", domReady, false);
|
||||
|
||||
var didDetect = this._checkPlatforms(platforms);
|
||||
var deviceReady = function() {
|
||||
// run when cordova is fully loaded
|
||||
var platforms = [];
|
||||
ionic.Platform._checkPlatforms(platforms);
|
||||
|
||||
var classify = function() {
|
||||
if(!document.body) { return; }
|
||||
|
||||
for(var i = 0; i < platforms.length; i++) {
|
||||
document.body.classList.add('platform-' + platforms[i]);
|
||||
if(platforms.length) {
|
||||
// only change the body class if we got platform info
|
||||
var bodyClass = document.body.className;
|
||||
for(var i = 0; i < platforms.length; i++) {
|
||||
bodyClass += ' platform-' + platforms[i];
|
||||
}
|
||||
document.body.className = bodyClass;
|
||||
}
|
||||
document.removeEventListener("deviceready", deviceReady, false);
|
||||
};
|
||||
|
||||
document.addEventListener( "DOMContentLoaded", function(){
|
||||
classify();
|
||||
});
|
||||
|
||||
classify();
|
||||
|
||||
return didDetect;
|
||||
},
|
||||
|
||||
_checkPlatforms: function(platforms) {
|
||||
if(this.isCordova()) {
|
||||
platforms.push('cordova');
|
||||
@@ -1773,10 +1780,7 @@ window.ionic = {
|
||||
}
|
||||
|
||||
// Return whether we detected anything
|
||||
if(platforms.length === 0) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
return (platforms.length > 0);
|
||||
},
|
||||
|
||||
// Check if we are running in Cordova, which will have
|
||||
|
||||
4
dist/js/ionic.min.js
vendored
4
dist/js/ionic.min.js
vendored
File diff suppressed because one or more lines are too long
10
js/ext/angular/src/service/ionicPlatform.js
vendored
10
js/ext/angular/src/service/ionicPlatform.js
vendored
@@ -27,15 +27,7 @@ angular.module('ionic.service.platform', [])
|
||||
|
||||
// We need to do some stuff as soon as we know the platform,
|
||||
// like adjust header margins for iOS 7, etc.
|
||||
setTimeout(function afterReadyWait() {
|
||||
if(isReady() && ionic.Platform.detect()) {
|
||||
return;
|
||||
} else {
|
||||
setTimeout(afterReadyWait, 50);
|
||||
}
|
||||
}, 10);
|
||||
|
||||
|
||||
ionic.Platform.detect();
|
||||
|
||||
|
||||
return {
|
||||
|
||||
@@ -1,27 +1,34 @@
|
||||
(function(ionic) {
|
||||
|
||||
ionic.Platform = {
|
||||
|
||||
detect: function() {
|
||||
var platforms = [];
|
||||
|
||||
var domReady = function() {
|
||||
// run when the DOM is ready
|
||||
document.addEventListener("deviceready", deviceReady, false);
|
||||
document.removeEventListener("DOMContentLoaded", domReady, false);
|
||||
};
|
||||
document.addEventListener("DOMContentLoaded", domReady, false);
|
||||
|
||||
var didDetect = this._checkPlatforms(platforms);
|
||||
var deviceReady = function() {
|
||||
// run when cordova is fully loaded
|
||||
var platforms = [];
|
||||
ionic.Platform._checkPlatforms(platforms);
|
||||
|
||||
var classify = function() {
|
||||
if(!document.body) { return; }
|
||||
|
||||
for(var i = 0; i < platforms.length; i++) {
|
||||
document.body.classList.add('platform-' + platforms[i]);
|
||||
if(platforms.length) {
|
||||
// only change the body class if we got platform info
|
||||
var bodyClass = document.body.className;
|
||||
for(var i = 0; i < platforms.length; i++) {
|
||||
bodyClass += ' platform-' + platforms[i];
|
||||
}
|
||||
document.body.className = bodyClass;
|
||||
}
|
||||
document.removeEventListener("deviceready", deviceReady, false);
|
||||
};
|
||||
|
||||
document.addEventListener( "DOMContentLoaded", function(){
|
||||
classify();
|
||||
});
|
||||
|
||||
classify();
|
||||
|
||||
return didDetect;
|
||||
},
|
||||
|
||||
_checkPlatforms: function(platforms) {
|
||||
if(this.isCordova()) {
|
||||
platforms.push('cordova');
|
||||
@@ -37,10 +44,7 @@
|
||||
}
|
||||
|
||||
// Return whether we detected anything
|
||||
if(platforms.length === 0) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
return (platforms.length > 0);
|
||||
},
|
||||
|
||||
// Check if we are running in Cordova, which will have
|
||||
|
||||
Reference in New Issue
Block a user