You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

250 lines
9.3 KiB
JavaScript

/*
* Copyright 2020 Netsyms Technologies.
* 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/.
*/
var routes = [
{
path: "/",
name: "main",
url: "pages/main.html",
tabs: [
{
path: '/',
id: 'discover-tab',
url: "pages/tabs/discover.html"
},
{
path: '/map',
id: 'map-tab',
url: "pages/tabs/map.html"
},
{
path: '/myprofile',
id: 'myprofile-tab',
url: "pages/tabs/myprofile.html"
}
]
},
{
path: '/welcome',
name: 'welcome',
templateUrl: "pages/welcome.html"
},
{
path: '/profile',
name: 'profile',
templateUrl: "pages/profile.html"
},
{
path: '/settings',
name: 'settings',
async: function (routeTo, routeFrom, resolve, reject) {
var settings = [];
if (getStorage("username") != null && getStorage("password") != null) {
settings.push(
{
setting: "account",
title: "Account",
text: "Logged in as " + getStorage("username")
},
{
setting: "logout",
title: "",
text: "Log out",
link: true,
onclick: "logout()"
}
);
} else {
settings.push(
{
setting: "login",
title: "Log In / Sign Up",
text: "Sign up or log in to vote or create a profile.",
onclick: "router.navigate('/login')",
link: true
}
);
}
settings.push(
{
setting: "maps",
title: "Map",
text: "Change map settings.",
onclick: "router.navigate('/settings/maps')",
link: true
},
{
setting: "display",
title: "Display and Appearance",
text: "Change the app theme.",
onclick: "router.navigate('/settings/display')",
link: true
}
);
settings.push(
{
setting: "versions",
title: "Lecte app v" + app_version,
text: "Copyright © 2020 David Seyler and Netsyms Technologies. Licensed under the Mozilla Public License 2.0.",
onclick: ""
},
{
setting: "opensource",
title: "Credits and open source info",
text: "",
onclick: "router.navigate('/credits')",
link: true
},
{
setting: "privacy",
title: "Privacy policy and legal",
text: "",
onclick: "openBrowser('https://netsyms.com/legal?pk_campaign=LecteApp')",
link: true
});
resolve({
templateUrl: './pages/settings.html'
}, {
context: {
page_title: "Settings",
settings: settings
}
});
},
routes: [
{
path: '/maps',
name: 'settings',
async: function (routeTo, routeFrom, resolve, reject) {
var mapstyles = [];
for (var id in SETTINGS.maptileurls) {
if (SETTINGS.maptileurls.hasOwnProperty(id)) {
mapstyles.push({
value: id,
label: SETTINGS.maptileurls[id].name,
selected: getStorage("mapsource") == id
});
}
}
var settings = [
{
setting: "mapsource",
title: "Map style",
select: true,
options: mapstyles,
text: "Choose which map style to use."
},
{
setting: "units",
title: "Measurement units",
select: true,
options: [
{
value: "metric",
label: "Meters/Kilometers",
selected: getStorage("units") == "metric"
},
{
value: "imperial",
label: "Feet/Miles",
selected: getStorage("units") == "imperial"
}
]
},
{
setting: "mapscale",
title: "Map Scale Ruler",
text: "Show a scale in the corner of the map.",
toggle: true,
checked: getStorage("mapscale") !== "false",
onclick: ""
},
{
setting: "maptype",
title: "Alternative map",
text: "Turn this on if you have problems with the map.",
toggle: true,
checked: getStorage("maptype") == "leaflet",
onclick: ""
}
];
resolve({
templateUrl: './pages/settings.html'
}, {
context: {
page_title: "Map Settings",
settings: settings
}
});
}
},
{
path: '/display',
name: 'settings',
async: function (routeTo, routeFrom, resolve, reject) {
var settings = [
{
setting: "apptheme",
title: "Color theme",
select: true,
options: [
{
value: "auto",
label: "Auto",
selected: getStorage("apptheme") == null || getStorage("apptheme") == "auto"
},
{
value: "dark",
label: "Dark",
selected: getStorage("apptheme") == "dark"
},
{
value: "light",
label: "Light",
selected: getStorage("apptheme") == "light"
}
]
},
{
setting: "animation",
title: "Animations",
select: true,
options: [
{
value: "auto",
label: "On",
selected: getStorage("animation") == null || getStorage("animation") == "auto" || getStorage("animation") == "on"
},
{
value: "off",
label: "Off",
selected: getStorage("animation") == "off"
}
]
}
];
resolve({
templateUrl: './pages/settings.html'
}, {
context: {
page_title: "Display Settings",
settings: settings
}
});
}
}
]
},
{
path: '/credits',
url: './pages/credits.html',
name: 'credits'
}
];