From a1d3e368cc68f3de2274bd742fb621dd1740e6b7 Mon Sep 17 00:00:00 2001 From: lukeIam Date: Fri, 29 Nov 2013 14:26:04 +0100 Subject: [PATCH] Webserver: -fix: initialisation is broken with phonegap --- Vocaluxe/Website/index.html | 36 +++++++++++++++++++++++++++++------- Vocaluxe/Website/js/main.js | 22 ++++++++++++++++++---- 2 files changed, 47 insertions(+), 11 deletions(-) diff --git a/Vocaluxe/Website/index.html b/Vocaluxe/Website/index.html index 4d0edef6..e22e9502 100644 --- a/Vocaluxe/Website/index.html +++ b/Vocaluxe/Website/index.html @@ -4,12 +4,36 @@ Vocaluxe - + - + + + - + @@ -340,7 +364,5 @@
- - - - + + \ No newline at end of file diff --git a/Vocaluxe/Website/js/main.js b/Vocaluxe/Website/js/main.js index c3a523ab..39760925 100644 --- a/Vocaluxe/Website/js/main.js +++ b/Vocaluxe/Website/js/main.js @@ -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