/* 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 }, popover: { 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"; } /** * Generate a UUID. * From https://stackoverflow.com/a/2117523 * @returns {String} */ function uuidv4() { return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) { var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8); return v.toString(16); }); } 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("Info", "Navigating to ", newRoute.path); }); // Set alert radius to 100 meters by default if (localStorage.getItem("alertradius") == null) { localStorage.setItem("alertradius", 100); } // Set default alert sound volume if (localStorage.getItem("alertvolume") == null) { localStorage.setItem("alertvolume", 100); } if (localStorage.getItem("darktheme") == "true") { $("#app").addClass("theme-dark"); } initPlatform(); router.navigate("/home");