Improve settings, add OTP countdown
This commit is contained in:
parent
ee5e2b4a50
commit
6f79fb7b2a
@ -14,12 +14,12 @@ var app = new Framework7({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
var router = app.router;
|
|
||||||
|
|
||||||
var mainView = app.views.create('.view-main', {
|
var mainView = app.views.create('.view-main', {
|
||||||
url: "/"
|
url: "/"
|
||||||
});
|
});
|
||||||
|
|
||||||
|
var router = mainView.router;
|
||||||
|
|
||||||
var loadingProgressDialog;
|
var loadingProgressDialog;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -124,3 +124,16 @@ document.addEventListener("deviceready", function () {
|
|||||||
}
|
}
|
||||||
setTimeout(navigator.splashscreen.hide, 500);
|
setTimeout(navigator.splashscreen.hide, 500);
|
||||||
}, false);
|
}, false);
|
||||||
|
|
||||||
|
router.on("pageBeforeIn", function (pagedata) {
|
||||||
|
app.progressbar.hide();
|
||||||
|
});
|
||||||
|
|
||||||
|
router.on("pageInit", function (pagedata) {
|
||||||
|
app.progressbar.hide();
|
||||||
|
switch (pagedata.name) {
|
||||||
|
case "settings":
|
||||||
|
updateSettingsData();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
});
|
@ -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) {
|
function loadOTPPage(reload) {
|
||||||
var ls_text = localStorage.getItem("otp");
|
var ls_text = localStorage.getItem("otp");
|
||||||
if (ls_text === null || ls_text == "") {
|
if (ls_text === null || ls_text == "") {
|
||||||
@ -59,7 +67,7 @@ function loadOTPPage(reload) {
|
|||||||
|
|
||||||
function refreshCountdown() {
|
function refreshCountdown() {
|
||||||
var percent = ((30 - ((new Date).getSeconds() % 30)) / 30) * 100;
|
var percent = ((30 - ((new Date).getSeconds() % 30)) / 30) * 100;
|
||||||
$("#countdown").css("width", percent + "%");
|
setProgressBar(percent);
|
||||||
}
|
}
|
||||||
|
|
||||||
function refreshCodes() {
|
function refreshCodes() {
|
||||||
|
@ -84,6 +84,17 @@ function updateSettingsData() {
|
|||||||
|
|
||||||
function getSettingsTemplateData() {
|
function getSettingsTemplateData() {
|
||||||
return [
|
return [
|
||||||
|
{
|
||||||
|
setting: "userinfo",
|
||||||
|
title: '<i class="fa fa-user"></i> <span id="username">Not logged in</span>',
|
||||||
|
text: '<i class="fa fa-key"></i> Pairing Code: <span id="pairingkey">None</span><br /><i class="fa fa-server"></i> Server: <span id="syncurl">None</span>',
|
||||||
|
onclick: ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
setting: "accounts",
|
||||||
|
title: "Manage and switch accounts",
|
||||||
|
onclick: "openAccountPicker()"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
setting: "updatepassword",
|
setting: "updatepassword",
|
||||||
title: "Update Password",
|
title: "Update Password",
|
||||||
@ -116,3 +127,12 @@ function getSettingsTemplateData() {
|
|||||||
}
|
}
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function loadSettingsPage() {
|
||||||
|
router.navigate("/settings", {
|
||||||
|
context: {
|
||||||
|
settings: getSettingsTemplateData()
|
||||||
|
},
|
||||||
|
});
|
||||||
|
updateSettingsData();
|
||||||
|
}
|
@ -15,7 +15,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="page-content">
|
<div class="page-content">
|
||||||
<div class="list media-list no-hairlines">
|
<div class="list media-list">
|
||||||
<ul>
|
<ul>
|
||||||
{{#each settings}}
|
{{#each settings}}
|
||||||
<li class="item-content" data-setting="{{setting}}" onclick="{{onclick}}">
|
<li class="item-content" data-setting="{{setting}}" onclick="{{onclick}}">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user