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.
PackageHelper/www/assets/js/main.js

62 lines
1.4 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 $$ = Dom7;
// Detect platform and run platform-specific setup code
// for Cordova, NW.js, or the browser
initPlatform();
var app = new Framework7({
root: "#app",
name: "PackageHelper",
id: "com.netsyms.PackageHelper",
theme: "md",
card: {
swipeToClose: false
},
popup: {
backdrop: true
},
init: true,
initOnDeviceReady: false,
routes: routes
});
var mainView = app.views.create('.view-main', {
url: "/"
});
var router = mainView.router;
function restartApplication() {
window.location = "index.html";
}
router.on("pageInit", function (pagedata) {
pagedata.$el.find('script').each(function (el) {
if ($$(this).attr('src')) {
var s = document.createElement('script');
s.src = $$(this).attr('src');
$$('head').append(s);
} else {
eval($$(this).text());
}
});
});
router.on("routeChange", function (newRoute) {
console.log(newRoute);
if (newRoute == "home") {
router.refreshPage();
}
});
// Set alert radius to 100 meters by default
if (localStorage.getItem("alertradius") == null) {
localStorage.setItem("alertradius", 100);
}
router.navigate("/home");