/* * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ function loadHomePage() { $.post(localStorage.getItem("syncurl"), { username: localStorage.getItem("username"), key: localStorage.getItem("key"), action: "listapps" }, function (data) { if (data.status === 'OK') { loadingProgressDialog.setProgress(80); var appcards = []; Object.keys(data.apps).forEach(function (k) { var app = data.apps[k]; var iconurl = app.icon; if (!app.icon.startsWith("http")) { iconurl = app.url + app.icon; } if (!app.card) { return; } appcards.push({ api: app.mobileapi, url: app.url, icon: iconurl, title: app.title, text: app.card.string, color: app.card.color }); }); loadingProgressDialog.setProgress(90); router.navigate("/home", { context: { appcards: appcards } }); $(".view-main").on("click", "#applist .applist-item", function () { launchapp($(this).data("api"), $(this).data("url"), $(this).data("icon"), $(this).data("title")); }); loadingProgressDialog.setProgress(100); loadingProgressDialog.close(); } else { loadingProgressDialog.close(); app.dialog.alert(data.msg, "Error", function () { restartApplication(); }); } }, "json").fail(function () { loadingProgressDialog.close(); app.dialog.alert("Could not connect to the server. Try again later.", "Error", function () { restartApplication(); }); }); }