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
+42 -6

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/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-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.mobile-1.3.2.min.js"></script>
<script src="js/jquery-ui-1.10.3.custom.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/jquery.ui.touch-punch.min.js"></script>
@@ -342,5 +366,3 @@
<div class="ui-loader-background"></div> <div class="ui-loader-background"></div>
</body> </body>
</html> </html>
<!DOCTYPE html>
+18 -4
View File
@@ -8,7 +8,21 @@ var customSelectPlaylistSongCallback = null;
var sessionId = ""; var sessionId = "";
var serverBaseAddress = ""; 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(); replaceTransitionHandler();
initTranslation(); initTranslation();
initPageLoadHandler(); initPageLoadHandler();
@@ -18,7 +32,7 @@ $(document).ready(function () {
initLoginPageHandler(); initLoginPageHandler();
initHeartbeat(); initHeartbeat();
initVideoPopup(); initVideoPopup();
}); }
function replaceTransitionHandler() { function replaceTransitionHandler() {
//Thx to http://stackoverflow.com/a/14096311 //Thx to http://stackoverflow.com/a/14096311
@@ -168,7 +182,7 @@ function initPageLoadHandler() {
}, function() { }, function() {
//Fail - do nothing //Fail - do nothing
}, { }, {
destinationType: Camera.DestinationType.DATA_URL, destinationType: navigator.camera.DestinationType.DATA_URL,
allowEdit: true, allowEdit: true,
correctOrientation: true, correctOrientation: true,
saveToPhotoAlbum: true saveToPhotoAlbum: true
@@ -800,7 +814,7 @@ function initMainPageHandler() {
}, function () { }, function () {
//Fail - do nothing //Fail - do nothing
}, { }, {
destinationType: Camera.DestinationType.DATA_URL, destinationType: navigator.camera.DestinationType.DATA_URL,
allowEdit: true, allowEdit: true,
correctOrientation: true, correctOrientation: true,
saveToPhotoAlbum: true saveToPhotoAlbum: true