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
+47 -11

No files matched your search

+29 -7
View File
@@ -4,12 +4,36 @@
<title>Vocaluxe</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="css/jquery.mobile-1.3.2.min.css" />
<link rel="stylesheet" href="css/style.css" />
<link rel="stylesheet" href="css/style.css" />
<script src="js/jquery-1.9.1.min.js"></script>
<script src="js/jquery.mobile-1.3.2.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>
<script src="js/i18next-1.7.1.min.js"></script>
<script src="js/i18next-1.7.1.min.js"></script>
<script src="js/main.js"></script>
</head>
<body>
@@ -340,7 +364,5 @@
<!-- /page -->
<div class="ui-loader-background"></div>
</body>
</html>
<!DOCTYPE html>
</body>
</html>
+18 -4
View File
@@ -8,7 +8,21 @@ var customSelectPlaylistSongCallback = null;
var sessionId = "";
var serverBaseAddress = "";
$(document).ready(function () {
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