diff --git a/www/js/main.js b/www/js/main.js index fe291b2..527e80f 100644 --- a/www/js/main.js +++ b/www/js/main.js @@ -14,12 +14,12 @@ var app = new Framework7({ } }); -var router = app.router; - var mainView = app.views.create('.view-main', { url: "/" }); +var router = mainView.router; + var loadingProgressDialog; /** @@ -123,4 +123,17 @@ document.addEventListener("deviceready", function () { }) } setTimeout(navigator.splashscreen.hide, 500); -}, false); \ No newline at end of file +}, false); + +router.on("pageBeforeIn", function (pagedata) { + app.progressbar.hide(); +}); + +router.on("pageInit", function (pagedata) { + app.progressbar.hide(); + switch (pagedata.name) { + case "settings": + updateSettingsData(); + break; + } +}); \ No newline at end of file diff --git a/www/js/otp.js b/www/js/otp.js index d547bc0..6a5d773 100644 --- a/www/js/otp.js +++ b/www/js/otp.js @@ -42,6 +42,14 @@ function parseOTP(jsontext, reload) { } } +function setProgressBar(percent) { + if (mainView.router.currentRoute.name == "otp") { + app.progressbar.show(percent, app.theme === 'md' ? 'yellow' : 'blue'); + } else { + app.progressbar.hide(); + } +} + function loadOTPPage(reload) { var ls_text = localStorage.getItem("otp"); if (ls_text === null || ls_text == "") { @@ -59,7 +67,7 @@ function loadOTPPage(reload) { function refreshCountdown() { var percent = ((30 - ((new Date).getSeconds() % 30)) / 30) * 100; - $("#countdown").css("width", percent + "%"); + setProgressBar(percent); } function refreshCodes() { diff --git a/www/js/settings.js b/www/js/settings.js index 9ee14ca..6d25ad5 100644 --- a/www/js/settings.js +++ b/www/js/settings.js @@ -84,6 +84,17 @@ function updateSettingsData() { function getSettingsTemplateData() { return [ + { + setting: "userinfo", + title: ' Not logged in', + text: ' Pairing Code: None
Server: None', + onclick: "" + }, + { + setting: "accounts", + title: "Manage and switch accounts", + onclick: "openAccountPicker()" + }, { setting: "updatepassword", title: "Update Password", @@ -115,4 +126,13 @@ function getSettingsTemplateData() { onclick: "cordova.InAppBrowser.open('https://netsyms.biz/mobile-privacy-policy', '_blank', 'location=yes')" } ]; +} + +function loadSettingsPage() { + router.navigate("/settings", { + context: { + settings: getSettingsTemplateData() + }, + }); + updateSettingsData(); } \ No newline at end of file diff --git a/www/pages/settings.html b/www/pages/settings.html index b3e5a2f..e32051e 100644 --- a/www/pages/settings.html +++ b/www/pages/settings.html @@ -15,7 +15,7 @@
-
+
    {{#each settings}}