You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by mm...@apache.org on 2013/03/04 18:27:42 UTC
[1/2] spec commit: Fixing issue with mobile spec not loading js when
PLATFORM unavailable
Fixing issue with mobile spec not loading js when PLATFORM unavailable
Project: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/commit/fd2a5b50
Tree: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/tree/fd2a5b50
Diff: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/diff/fd2a5b50
Branch: refs/heads/master
Commit: fd2a5b50acc80681fc2b09dcd234354f3408f5d7
Parents: 224aaa4
Author: Michal Mocny <mm...@gmail.com>
Authored: Mon Mar 4 12:27:00 2013 -0500
Committer: Michal Mocny <mm...@gmail.com>
Committed: Mon Mar 4 12:27:00 2013 -0500
----------------------------------------------------------------------
cordova.js | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/fd2a5b50/cordova.js
----------------------------------------------------------------------
diff --git a/cordova.js b/cordova.js
index 88aa5ac..d98d26c 100644
--- a/cordova.js
+++ b/cordova.js
@@ -26,21 +26,21 @@ var scripts = document.getElementsByTagName('script');
var currentPath = scripts[scripts.length - 1].src;
var platformCordovaPath = currentPath.replace("cordova.js", "cordova." + PLAT + ".js");
var versionCordovaPath = currentPath.replace("cordova.js", "cordova-" + VERSION + ".js");
-var cordovaPath;
+var cordovaPath = versionCordovaPath;
(function() {
var xhr = new XMLHttpRequest();
xhr.open("GET", platformCordovaPath, false);
xhr.onreadystatechange = function() {
- if (this.readyState != this.DONE) {
- return;
+ if (this.readyState == this.DONE && this.responseText.length > 0) {
+ cordovaPath = platformCordovaPath;
}
- cordovaPath = (this.responseText.length > 0) ? platformCordovaPath : versionCordovaPath;
};
xhr.send(null);
})();
if (!window._doNotWriteCordovaScript) {
+ console.log(cordovaPath);
document.write('<script type="text/javascript" charset="utf-8" src="' + cordovaPath + '"></script>');
}