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.

113 lines
3.3 KiB
JavaScript

/*
* 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: '/home',
templateUrl: './pages/home.html',
name: 'home',
keepAlive: true,
on: {
pageAfterIn: function () {
function tryToLoadHomePage() {
if (typeof loadHomePage != "function") {
setTimeout(tryToLoadHomePage, 500);
} else {
loadHomePage(function () {});
}
}
tryToLoadHomePage();
}
}
},
{
path: '/inventory',
templateUrl: './pages/inventory.html',
name: 'inventory',
keepAlive: true,
on: {
pageAfterIn: function () {
function tryToLoadInventory() {
if (typeof loadInventory != "function") {
setTimeout(loadInventory, 500);
} else {
loadInventory(function () {});
}
}
tryToLoadInventory();
}
}
},
{
path: '/signin',
url: './pages/signin.html',
name: 'signin'
},
{
path: '/chooseteam',
templateUrl: './pages/chooseteam.html',
name: 'chooseteam',
options: {
context: {
teams: SETTINGS['teams']
}
}
},
{
path: '/settings',
name: 'settings',
templateUrl: './pages/settings.html',
on: {
pageAfterIn: function () {
function tryToLoadSettings() {
if (typeof loadSettings != "function") {
setTimeout(loadSettings, 500);
} else {
loadSettings();
}
}
tryToLoadSettings();
}
}
},
{
path: '/credits',
name: 'credits',
async: function (routeTo, routeFrom, resolve, reject) {
$.ajax({
url: 'code-credits.txt',
dataType: 'text',
type: 'GET',
async: true,
success: function (codecredits) {
$.ajax({
url: 'art-credits.html',
dataType: 'text',
type: 'GET',
async: true,
success: function (artcredits) {
resolve({
templateUrl: './pages/credits.html'
}, {
context: {
artcredits: artcredits,
codecredits: codecredits
}
});
},
error: function (jqXHR, status, errorThrown) {
reject();
}
});
},
error: function (jqXHR, status, errorThrown) {
reject();
}
});
}
}
];