Close #10, improve loading experience on slow connections
This commit is contained in:
parent
968498894d
commit
fb4895b6aa
@ -10,7 +10,7 @@ html, body {
|
|||||||
.app-dock {
|
.app-dock {
|
||||||
margin: 0 auto 10px auto;
|
margin: 0 auto 10px auto;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-around;
|
justify-content: space-evenly;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
@ -78,4 +78,8 @@ span.navbar-brand {
|
|||||||
|
|
||||||
#navbar {
|
#navbar {
|
||||||
min-height: 56px;
|
min-height: 56px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.loading-text {
|
||||||
|
font-size: 18px;
|
||||||
}
|
}
|
@ -38,6 +38,8 @@
|
|||||||
<circle class="path" fill="none" stroke-width="6" stroke-linecap="round" cx="33" cy="33" r="30"></circle>
|
<circle class="path" fill="none" stroke-width="6" stroke-linecap="round" cx="33" cy="33" r="30"></circle>
|
||||||
</svg>
|
</svg>
|
||||||
</div>
|
</div>
|
||||||
|
<div style="width: 100%;"></div>
|
||||||
|
<p class="loading-text">Loading...</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -30,6 +30,7 @@ document.addEventListener("deviceready", function () {
|
|||||||
* succeeds.
|
* succeeds.
|
||||||
*/
|
*/
|
||||||
function getuserinfo(callback) {
|
function getuserinfo(callback) {
|
||||||
|
$(".loading-text").text("Loading account...");
|
||||||
$.post(localStorage.getItem("syncurl"), {
|
$.post(localStorage.getItem("syncurl"), {
|
||||||
username: localStorage.getItem("username"),
|
username: localStorage.getItem("username"),
|
||||||
key: localStorage.getItem("key"),
|
key: localStorage.getItem("key"),
|
||||||
@ -37,6 +38,7 @@ function getuserinfo(callback) {
|
|||||||
action: "user_info"
|
action: "user_info"
|
||||||
}, function (data) {
|
}, function (data) {
|
||||||
if (data.status === 'OK') {
|
if (data.status === 'OK') {
|
||||||
|
$(".loading-text").text("Loading...");
|
||||||
userinfo = data.info;
|
userinfo = data.info;
|
||||||
if (typeof callback == 'function') {
|
if (typeof callback == 'function') {
|
||||||
callback();
|
callback();
|
||||||
@ -196,7 +198,12 @@ function restartApplication() {
|
|||||||
// Handle back button to close things
|
// Handle back button to close things
|
||||||
document.addEventListener("backbutton", function (event) {
|
document.addEventListener("backbutton", function (event) {
|
||||||
if (localStorage.getItem("setupcomplete")) {
|
if (localStorage.getItem("setupcomplete")) {
|
||||||
if (_returnscreen != null) {
|
if ($("#appframe").length && historyctr > 0) {
|
||||||
|
console.log("going back");
|
||||||
|
var iframe = document.getElementById("appframe");
|
||||||
|
iframe.contentWindow.postMessage("goback", "*");
|
||||||
|
historyctr--;
|
||||||
|
} else if (_returnscreen != null) {
|
||||||
openscreen(_returnscreen, "FADE");
|
openscreen(_returnscreen, "FADE");
|
||||||
_returnscreen = null;
|
_returnscreen = null;
|
||||||
} else {
|
} else {
|
||||||
|
File diff suppressed because one or more lines are too long
@ -1,7 +1,9 @@
|
|||||||
<iframe id="appframe" src="views/appspinner.html" style="position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: 0px;"></iframe>
|
<iframe id="appframe" src="" style="position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: 0px;"></iframe>
|
||||||
|
<iframe id="loadframe" src="views/appspinner.html" style="position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: 0px; z-index: 999999;"></iframe>
|
||||||
|
|
||||||
<script src="js/material-palette.js"></script>
|
<script src="js/material-palette.js"></script>
|
||||||
<script>
|
<script>
|
||||||
|
var historyctr = -1;
|
||||||
/**
|
/**
|
||||||
* Open an app with native Android UI elements
|
* Open an app with native Android UI elements
|
||||||
* @param String id Application ID
|
* @param String id Application ID
|
||||||
@ -14,102 +16,121 @@
|
|||||||
* @returns {undefined}
|
* @returns {undefined}
|
||||||
*/
|
*/
|
||||||
function launchapp(id, api, url, icon, title, injectcode, shownavbar) {
|
function launchapp(id, api, url, icon, title, injectcode, shownavbar) {
|
||||||
if (typeof shownavbar === 'undefined' || shownavbar === false) {
|
if (typeof shownavbar === 'undefined' || shownavbar === false) {
|
||||||
setnavbar(false);
|
setnavbar(false);
|
||||||
} else {
|
} else {
|
||||||
setnavbar("app", title);
|
setnavbar("app", title);
|
||||||
$('#appframe').css('top', '75px');
|
$('#appframe').css('top', '75px');
|
||||||
}
|
}
|
||||||
$.post(url + api, {
|
$.post(url + api, {
|
||||||
username: localStorage.getItem("username"),
|
username: localStorage.getItem("username"),
|
||||||
key: localStorage.getItem("key"),
|
key: localStorage.getItem("key"),
|
||||||
password: localStorage.getItem("password"),
|
password: localStorage.getItem("password"),
|
||||||
action: "start_session"
|
action: "start_session"
|
||||||
}, function (data) {
|
}, function (data) {
|
||||||
if (data.status === 'OK') {
|
if (data.status === 'OK') {
|
||||||
if (typeof injectcode === 'undefined' || injectcode === true) {
|
document.getElementById("loadframe").contentWindow.postMessage("loginok", "*");
|
||||||
$('#appframe').on("load", function () {
|
if (typeof injectcode === 'undefined' || injectcode === true) {
|
||||||
$.get("css/sidemenu.css", function (style) {
|
$('#appframe').on("load", function () {
|
||||||
$('#appframe').contents().find('head').append("<style>" + style + "</style>");
|
$("#loadframe").fadeOut(300);
|
||||||
$.get("js/sidemenu.js", function (script) {
|
historyctr++;
|
||||||
script = script.replace("%%JQUERYFXOFF%%", !(localStorage.getItem("animations") === null || localStorage.getItem("animations") === "true"));
|
$.get("css/sidemenu.css", function (style) {
|
||||||
script = script.replace("%%USERNAME%%", userinfo.realname);
|
$('#appframe').contents().find('head').append("<style>" + style + "</style>");
|
||||||
script = script.replace("%%LOGO%%", icon);
|
$.get("js/jquery-ui.min.js", function (script) {
|
||||||
$('#appframe').contents().find('body').append("<script>" + script + "<\/script>");
|
$('#appframe').contents().find('body').append("<script>" + script + "<\/script>");
|
||||||
});
|
$.get("js/hammer.min.js", function (script) {
|
||||||
});
|
$('#appframe').contents().find('body').append("<script>" + script + "<\/script>");
|
||||||
});
|
$.get("js/sidemenu.js", function (script) {
|
||||||
} else {
|
script = script.replace("%%JQUERYFXOFF%%", !(localStorage.getItem("animations") === null || localStorage.getItem("animations") === "true"));
|
||||||
// Only inject minimal CSS
|
script = script.replace("%%USERNAME%%", userinfo.realname);
|
||||||
$('#appframe').on("load", function () {
|
script = script.replace("%%LOGO%%", icon);
|
||||||
$.get("css/inject_mini.css", function (style) {
|
$('#appframe').contents().find('body').append("<script>" + script + "<\/script>");
|
||||||
$('#appframe').contents().find('head').append("<style>" + style + "</style>");
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
});
|
||||||
$('#appframe').attr('src', url);
|
});
|
||||||
} else {
|
} else {
|
||||||
navigator.notification.alert(data.msg, null, "Error", 'Dismiss');
|
// Only inject minimal CSS
|
||||||
openscreen("home");
|
$('#appframe').on("load", function () {
|
||||||
}
|
$.get("css/inject_mini.css", function (style) {
|
||||||
}, "json").fail(function () {
|
$('#appframe').contents().find('head').append("<style>" + style + "</style>");
|
||||||
navigator.notification.alert("Could not connect to the server. Try again later.", null, "Error", 'Dismiss');
|
});
|
||||||
openscreen("home");
|
});
|
||||||
});
|
}
|
||||||
|
$('#appframe').attr('src', url);
|
||||||
|
} else {
|
||||||
|
navigator.notification.alert(data.msg, null, "Error", 'Dismiss');
|
||||||
|
openscreen("home");
|
||||||
|
}
|
||||||
|
}, "json").fail(function () {
|
||||||
|
navigator.notification.alert("Could not connect to the server. Try again later.", null, "Error", 'Dismiss');
|
||||||
|
openscreen("home");
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
var scanningactive = false;
|
var scanningactive = false;
|
||||||
|
var dedup = false;
|
||||||
window.addEventListener('message', function (event) {
|
window.addEventListener('message', function (event) {
|
||||||
console.log("app event: " + event.data);
|
console.log("app event: " + event.data);
|
||||||
if (event.data == "quit") {
|
setTimeout(function () {
|
||||||
openscreen("home");
|
dedup = false;
|
||||||
} else if (event.data.startsWith("setcolor ")) {
|
}, 500);
|
||||||
var color = event.data.split(" ", 2)[1];
|
if (dedup) {
|
||||||
if (cordova.platformId == 'android') {
|
return;
|
||||||
window.plugins.headerColor.tint(color);
|
|
||||||
for (var swatch in _PALETTE) {
|
|
||||||
if (color == _PALETTE[swatch]["shade_500"]) {
|
|
||||||
StatusBar.backgroundColorByHexString(_PALETTE[swatch]["shade_700"]);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
StatusBar.backgroundColorByHexString(color);
|
|
||||||
}
|
|
||||||
} else if (event.data.startsWith("scancode ")) {
|
|
||||||
var callbackcode = event.data.split(" ").slice(1).join(" ");
|
|
||||||
console.log("got scancode " + callbackcode);
|
|
||||||
try {
|
|
||||||
if (scanningactive) {
|
|
||||||
console.log("Scanner already active, ignoring request.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
scanningactive = true;
|
|
||||||
cordova.plugins.barcodeScanner.scan(
|
|
||||||
function (result) {
|
|
||||||
scanningactive = false;
|
|
||||||
if (!result.cancelled) {
|
|
||||||
var iframe = document.getElementById("appframe");
|
|
||||||
iframe.contentWindow.postMessage("coderesult~|~" + callbackcode + "~|~" + result.text, "*");
|
|
||||||
}
|
|
||||||
},
|
|
||||||
function (error) {
|
|
||||||
scanningactive = false;
|
|
||||||
navigator.notification.alert("Scanning failed: " + error, null, "Error", 'Dismiss');
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"showFlipCameraButton": true,
|
|
||||||
"prompt": "Scan Code"
|
|
||||||
}
|
|
||||||
);
|
|
||||||
} catch (ex) {
|
|
||||||
scanningactive = false;
|
|
||||||
navigator.notification.alert(ex.message, null, "Error", 'Dismiss');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
dedup = true;
|
||||||
|
if (event.data == "quit") {
|
||||||
|
openscreen("home");
|
||||||
|
} else if (event.data == "goneback") {
|
||||||
|
historyctr -= 1;
|
||||||
|
} else if (event.data.startsWith("setcolor ")) {
|
||||||
|
var color = event.data.split(" ", 2)[1];
|
||||||
|
if (cordova.platformId == 'android') {
|
||||||
|
window.plugins.headerColor.tint(color);
|
||||||
|
for (var swatch in _PALETTE) {
|
||||||
|
if (color == _PALETTE[swatch]["shade_500"]) {
|
||||||
|
StatusBar.backgroundColorByHexString(_PALETTE[swatch]["shade_700"]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
StatusBar.backgroundColorByHexString(color);
|
||||||
|
}
|
||||||
|
} else if (event.data.startsWith("scancode ")) {
|
||||||
|
var callbackcode = event.data.split(" ").slice(1).join(" ");
|
||||||
|
console.log("got scancode " + callbackcode);
|
||||||
|
try {
|
||||||
|
if (scanningactive) {
|
||||||
|
console.log("Scanner already active, ignoring request.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
scanningactive = true;
|
||||||
|
cordova.plugins.barcodeScanner.scan(
|
||||||
|
function (result) {
|
||||||
|
scanningactive = false;
|
||||||
|
if (!result.cancelled) {
|
||||||
|
var iframe = document.getElementById("appframe");
|
||||||
|
iframe.contentWindow.postMessage("coderesult~|~" + callbackcode + "~|~" + result.text, "*");
|
||||||
|
}
|
||||||
|
},
|
||||||
|
function (error) {
|
||||||
|
scanningactive = false;
|
||||||
|
navigator.notification.alert("Scanning failed: " + error, null, "Error", 'Dismiss');
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"showFlipCameraButton": true,
|
||||||
|
"prompt": "Scan Code"
|
||||||
|
}
|
||||||
|
);
|
||||||
|
} catch (ex) {
|
||||||
|
scanningactive = false;
|
||||||
|
navigator.notification.alert(ex.message, null, "Error", 'Dismiss');
|
||||||
|
}
|
||||||
|
}
|
||||||
}, false);
|
}, false);
|
||||||
|
|
||||||
if (userinfo == null) {
|
if (userinfo == null) {
|
||||||
getuserinfo();
|
getuserinfo();
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
@ -1,96 +1,141 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<title>Loading</title>
|
||||||
<head>
|
<meta charset="UTF-8">
|
||||||
<title>Loading</title>
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<meta charset="UTF-8">
|
<style>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
html, body {
|
||||||
<style>
|
height: 100%;
|
||||||
html, body {
|
background-color: white;
|
||||||
height: 100%;
|
font-family: "Roboto","Helvetica Neue",Helvetica,Arial,sans-serif;
|
||||||
}
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
|
|
||||||
.spinner {
|
.spinner {
|
||||||
-webkit-animation: rotator 1.4s linear infinite;
|
-webkit-animation: rotator 1.4s linear infinite;
|
||||||
animation: rotator 1.4s linear infinite;
|
animation: rotator 1.4s linear infinite;
|
||||||
}
|
}
|
||||||
|
|
||||||
@-webkit-keyframes rotator {
|
@-webkit-keyframes rotator {
|
||||||
0% {
|
0% {
|
||||||
-webkit-transform: rotate(0deg);
|
-webkit-transform: rotate(0deg);
|
||||||
transform: rotate(0deg);
|
transform: rotate(0deg);
|
||||||
}
|
}
|
||||||
100% {
|
100% {
|
||||||
-webkit-transform: rotate(270deg);
|
-webkit-transform: rotate(270deg);
|
||||||
transform: rotate(270deg);
|
transform: rotate(270deg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@keyframes rotator {
|
@keyframes rotator {
|
||||||
0% {
|
0% {
|
||||||
-webkit-transform: rotate(0deg);
|
-webkit-transform: rotate(0deg);
|
||||||
transform: rotate(0deg);
|
transform: rotate(0deg);
|
||||||
}
|
}
|
||||||
100% {
|
100% {
|
||||||
-webkit-transform: rotate(270deg);
|
-webkit-transform: rotate(270deg);
|
||||||
transform: rotate(270deg);
|
transform: rotate(270deg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.spinner .path {
|
.spinner .path {
|
||||||
stroke-dasharray: 187;
|
stroke-dasharray: 187;
|
||||||
stroke-dashoffset: 0;
|
stroke-dashoffset: 0;
|
||||||
-webkit-transform-origin: center;
|
-webkit-transform-origin: center;
|
||||||
transform-origin: center;
|
transform-origin: center;
|
||||||
-webkit-animation: dash 1.4s ease-in-out infinite, 5.6s ease-in-out infinite;
|
-webkit-animation: dash 1.4s ease-in-out infinite, 5.6s ease-in-out infinite;
|
||||||
animation: dash 1.4s ease-in-out infinite, 5.6s ease-in-out infinite;
|
animation: dash 1.4s ease-in-out infinite, 5.6s ease-in-out infinite;
|
||||||
stroke: #448aff;
|
stroke: #448aff;
|
||||||
}
|
}
|
||||||
|
|
||||||
@-webkit-keyframes dash {
|
@-webkit-keyframes dash {
|
||||||
0% {
|
0% {
|
||||||
stroke-dashoffset: 187;
|
stroke-dashoffset: 187;
|
||||||
}
|
}
|
||||||
50% {
|
50% {
|
||||||
stroke-dashoffset: 46.75;
|
stroke-dashoffset: 46.75;
|
||||||
-webkit-transform: rotate(135deg);
|
-webkit-transform: rotate(135deg);
|
||||||
transform: rotate(135deg);
|
transform: rotate(135deg);
|
||||||
}
|
}
|
||||||
100% {
|
100% {
|
||||||
stroke-dashoffset: 187;
|
stroke-dashoffset: 187;
|
||||||
-webkit-transform: rotate(450deg);
|
-webkit-transform: rotate(450deg);
|
||||||
transform: rotate(450deg);
|
transform: rotate(450deg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@keyframes dash {
|
@keyframes dash {
|
||||||
0% {
|
0% {
|
||||||
stroke-dashoffset: 187;
|
stroke-dashoffset: 187;
|
||||||
}
|
}
|
||||||
50% {
|
50% {
|
||||||
stroke-dashoffset: 46.75;
|
stroke-dashoffset: 46.75;
|
||||||
-webkit-transform: rotate(135deg);
|
-webkit-transform: rotate(135deg);
|
||||||
transform: rotate(135deg);
|
transform: rotate(135deg);
|
||||||
}
|
}
|
||||||
100% {
|
100% {
|
||||||
stroke-dashoffset: 187;
|
stroke-dashoffset: 187;
|
||||||
-webkit-transform: rotate(450deg);
|
-webkit-transform: rotate(450deg);
|
||||||
transform: rotate(450deg);
|
transform: rotate(450deg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
</style>
|
#statustext {
|
||||||
</head>
|
text-align: center;
|
||||||
<body>
|
}
|
||||||
<svg class="spinner" width="65px" height="65px" viewBox="0 0 66 66" xmlns="http://www.w3.org/2000/svg">
|
|
||||||
<circle class="path" fill="none" stroke-width="6" stroke-linecap="round" cx="33" cy="33" r="30"></circle>
|
#giveup {
|
||||||
</svg>
|
display: none;
|
||||||
|
margin-top: 5px;
|
||||||
<p>Logging in...</p>
|
border: none;
|
||||||
</body>
|
border-radius: 3px;
|
||||||
</html>
|
box-shadow: 1px 1px 4px rgba(0,0,0,0.4);
|
||||||
|
padding: 6px 16px;
|
||||||
|
font-size: 13px;
|
||||||
|
line-height: 1.846;
|
||||||
|
color: #fff;
|
||||||
|
background-color: #2196f3;
|
||||||
|
text-align: center;
|
||||||
|
vertical-align: middle;
|
||||||
|
touch-action: manipulation;
|
||||||
|
white-space: nowrap;
|
||||||
|
text-decoration: none;
|
||||||
|
box-sizing: border-box;
|
||||||
|
text-transform: uppercase;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<svg class="spinner" width="65px" height="65px" viewBox="0 0 66 66" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<circle class="path" fill="none" stroke-width="6" stroke-linecap="round" cx="33" cy="33" r="30"></circle>
|
||||||
|
</svg>
|
||||||
|
|
||||||
|
<p id="statustext">Logging in...</p>
|
||||||
|
<br />
|
||||||
|
<div id="giveup" onclick="parent.postMessage('quit', '*');">Give up</div>
|
||||||
|
<script>
|
||||||
|
window.addEventListener('message', function (event) {
|
||||||
|
if (event.data == "loginok") {
|
||||||
|
document.getElementById("statustext").innerHTML = "Loading...";
|
||||||
|
setTimeout(function () {
|
||||||
|
document.getElementById("statustext").innerHTML = "Still loading...";
|
||||||
|
}, 5000);
|
||||||
|
setTimeout(function () {
|
||||||
|
document.getElementById("statustext").innerHTML = "Just a moment...";
|
||||||
|
document.getElementById("giveup").style.display = "inline-block";
|
||||||
|
}, 10000);
|
||||||
|
setTimeout(function () {
|
||||||
|
document.getElementById("statustext").innerHTML = "Well this is awkward.";
|
||||||
|
}, 20000);
|
||||||
|
setTimeout(function () {
|
||||||
|
document.getElementById("statustext").innerHTML = "[fidgets nervously]";
|
||||||
|
}, 25000);
|
||||||
|
setTimeout(function () {
|
||||||
|
document.getElementById("statustext").innerHTML = "Either something is broken or your connection is too slow.";
|
||||||
|
}, 30000);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
@ -5,40 +5,44 @@
|
|||||||
<circle class="path" fill="none" stroke-width="6" stroke-linecap="round" cx="33" cy="33" r="30"></circle>
|
<circle class="path" fill="none" stroke-width="6" stroke-linecap="round" cx="33" cy="33" r="30"></circle>
|
||||||
</svg>
|
</svg>
|
||||||
</div>
|
</div>
|
||||||
|
<div style="width: 100%;"></div>
|
||||||
|
<p class="loading-text">Loading...</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
function loadapps() {
|
function loadapps() {
|
||||||
$.post(localStorage.getItem("syncurl"), {
|
$(".loading-text").html("Loading Apps...");
|
||||||
username: localStorage.getItem("username"),
|
$.post(localStorage.getItem("syncurl"), {
|
||||||
key: localStorage.getItem("key"),
|
username: localStorage.getItem("username"),
|
||||||
action: "listapps"
|
key: localStorage.getItem("key"),
|
||||||
}, function (data) {
|
action: "listapps"
|
||||||
if (data.status === 'OK') {
|
}, function (data) {
|
||||||
$('#app-dock').html("");
|
if (data.status === 'OK') {
|
||||||
Object.keys(data.apps).forEach(function (k) {
|
$("#loading-text").text("One moment...");
|
||||||
var app = data.apps[k];
|
$('#app-dock').html("");
|
||||||
var iconurl = app.icon;
|
Object.keys(data.apps).forEach(function (k) {
|
||||||
if (!app.icon.startsWith("http")) {
|
var app = data.apps[k];
|
||||||
iconurl = app.url + app.icon;
|
var iconurl = app.icon;
|
||||||
}
|
if (!app.icon.startsWith("http")) {
|
||||||
$("<div class=\"app-dock-item\" onclick=\"openapp('" + k + "', '" + app.mobileapi + "', '" + app.url + "', '" + iconurl + "', '" + app.title + "')\"><p><img src=\"" + iconurl + "\" class=\"img-responsive app-icon\" /><span>" + app.title + "</span></p></div>").hide().appendTo("#app-dock").fadeIn(200);
|
iconurl = app.url + app.icon;
|
||||||
});
|
}
|
||||||
} else {
|
$("<div class=\"app-dock-item\" onclick=\"openapp('" + k + "', '" + app.mobileapi + "', '" + app.url + "', '" + iconurl + "', '" + app.title + "')\"><p><img src=\"" + iconurl + "\" class=\"img-responsive app-icon\" /><span>" + app.title + "</span></p></div>").hide().appendTo("#app-dock").fadeIn(200);
|
||||||
navigator.notification.alert(data.msg, null, "Error", 'Dismiss');
|
});
|
||||||
openscreen("homeloaderror");
|
} else {
|
||||||
}
|
navigator.notification.alert(data.msg, null, "Error", 'Dismiss');
|
||||||
}, "json").fail(function () {
|
openscreen("homeloaderror");
|
||||||
navigator.notification.alert("Could not connect to the server. Try again later.", null, "Error", 'Dismiss');
|
}
|
||||||
openscreen("homeloaderror");
|
}, "json").fail(function () {
|
||||||
});
|
navigator.notification.alert("Could not connect to the server. Try again later.", null, "Error", 'Dismiss');
|
||||||
|
openscreen("homeloaderror");
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (localStorage.getItem('setupcomplete')) {
|
if (localStorage.getItem('setupcomplete')) {
|
||||||
setnavbar("home");
|
setnavbar("home");
|
||||||
loadapps();
|
loadapps();
|
||||||
} else {
|
} else {
|
||||||
openscreen("setup1");
|
openscreen("setup1");
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
Loading…
x
Reference in New Issue
Block a user