Webserver: -fix: initialisation is broken with phonegap

This commit is contained in:
lukeIam committed 2013-12-13 18:03:05 +01:00
1 parent 71f4dda358
commit a1d3e368cc
2 files changed
+41 -5

No files matched your search

+24 -2
View File
@@ -6,6 +6,30 @@
<link rel="stylesheet" href="css/jquery.mobile-1.3.2.min.css" />
<link rel="stylesheet" href="css/style.css" />
<script src="js/jquery-1.9.1.min.js"></script>
<script src="phonegap.js"></script>
<script>
if (document.location.protocol == "file:") {
if(typeof (window.deviceAndJqmLoaded) == "undefined"){
window.deviceAndJqmLoaded = $.Deferred();
}
var jqmready = $.Deferred();
var deviceready = $.Deferred();
$(document).bind("mobileinit", function(){
jqmready.resolve();
});
function deviceIsReady() {
deviceready.resolve();
}
document.addEventListener("deviceready", deviceIsReady, false);
$.when(jqmready, deviceready).then(function(){
window.deviceAndJqmLoaded.resolve();
});
}
</script>
<script src="js/jquery.mobile-1.3.2.min.js"></script>
<script src="js/jquery-ui-1.10.3.custom.min.js"></script>
<script src="js/jquery.ui.touch-punch.min.js"></script>
@@ -342,5 +366,3 @@
<div class="ui-loader-background"></div>
</body>
</html>
<!DOCTYPE html>
+17 -3
View File
@@ -8,7 +8,21 @@ var customSelectPlaylistSongCallback = null;
var sessionId = "";
var serverBaseAddress = "";
if (document.location.protocol == "file:") {
if(typeof (window.deviceAndJqmLoaded) == "undefined"){
window.deviceAndJqmLoaded = $.Deferred();
}
window.deviceAndJqmLoaded.done(function(){
start();
})
} else {
$(document).ready(function () {
start();
});
}
function start() {
replaceTransitionHandler();
initTranslation();
initPageLoadHandler();
@@ -18,7 +32,7 @@ $(document).ready(function () {
initLoginPageHandler();
initHeartbeat();
initVideoPopup();
});
}
function replaceTransitionHandler() {
//Thx to http://stackoverflow.com/a/14096311
@@ -168,7 +182,7 @@ function initPageLoadHandler() {
}, function() {
//Fail - do nothing
}, {
destinationType: Camera.DestinationType.DATA_URL,
destinationType: navigator.camera.DestinationType.DATA_URL,
allowEdit: true,
correctOrientation: true,
saveToPhotoAlbum: true
@@ -800,7 +814,7 @@ function initMainPageHandler() {
}, function () {
//Fail - do nothing
}, {
destinationType: Camera.DestinationType.DATA_URL,
destinationType: navigator.camera.DestinationType.DATA_URL,
allowEdit: true,
correctOrientation: true,
saveToPhotoAlbum: true