forked from Netsyms/PackageHelper
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.
98 lines
3.5 KiB
JavaScript
98 lines
3.5 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/.
|
|
*/
|
|
|
|
|
|
$('.item-content[data-setting=darktheme] .toggle input').on("change", function () {
|
|
var checked = $(this).prop('checked');
|
|
localStorage.setItem("darktheme", checked);
|
|
|
|
if (localStorage.getItem("darktheme") == "true") {
|
|
$("#app").addClass("theme-dark");
|
|
} else {
|
|
$("#app").removeClass("theme-dark");
|
|
}
|
|
});
|
|
|
|
$('.item-content[data-setting=showhelp] .toggle input').on("change", function () {
|
|
var checked = $(this).prop('checked');
|
|
localStorage.setItem("show_help", checked);
|
|
});
|
|
|
|
$('.item-link[data-setting=units] select').on("change", function () {
|
|
localStorage.setItem("units", $('.item-link[data-setting=units] select').val());
|
|
});
|
|
|
|
$('.item-link[data-setting=trackzoom] select').on("change", function () {
|
|
localStorage.setItem("trackzoom", $('.item-link[data-setting=trackzoom] select').val());
|
|
});
|
|
|
|
$('.item-content[data-setting=wakelock] .toggle input').on("change", function () {
|
|
var checked = $(this).prop('checked');
|
|
localStorage.setItem("wakelock", checked);
|
|
|
|
if (platform_type == "cordova") {
|
|
if (localStorage.getItem("wakelock") == "true") {
|
|
window.powerManagement.acquire(function () {
|
|
console.log("Info", 'Wakelock acquired');
|
|
}, function () {
|
|
console.log("Warn", 'Failed to acquire wakelock');
|
|
});
|
|
} else {
|
|
window.powerManagement.release(function () {
|
|
console.log("Info", 'Wakelock released');
|
|
}, function () {
|
|
console.log("Warn", 'Failed to release wakelock');
|
|
});
|
|
}
|
|
} else {
|
|
app.toast.show({
|
|
text: "This setting won't do anything on your device.",
|
|
position: "bottom",
|
|
destroyOnClose: true,
|
|
closeTimeout: 1000 * 10
|
|
});
|
|
}
|
|
});
|
|
|
|
$('.item-content[data-setting=alertvolume] .range-slider').on('range:changed', function (e, range) {
|
|
var val = app.range.get(".item-content[data-setting=alertvolume] .range-slider").getValue();
|
|
localStorage.setItem("alertvolume", val);
|
|
setVolume("alert", val);
|
|
playSound("alert");
|
|
});
|
|
|
|
$('.item-content[data-setting=alertradius] .range-slider').on('range:changed', function (e, range) {
|
|
var val = app.range.get(".item-content[data-setting=alertradius] .range-slider").getValue();
|
|
localStorage.setItem("alertradius", val);
|
|
});
|
|
|
|
$('.item-content[data-setting=alertinterval] .range-slider').on('range:changed', function (e, range) {
|
|
var val = app.range.get(".item-content[data-setting=alertinterval] .range-slider").getValue();
|
|
localStorage.setItem("alertinterval", val);
|
|
});
|
|
|
|
$('.item-link[data-setting=mapsource] select').on("change", function () {
|
|
localStorage.setItem("mapsource", $('.item-link[data-setting=mapsource] select').val());
|
|
|
|
reloadMap();
|
|
});
|
|
|
|
$('.item-content[data-setting=maptype] .toggle input').on("change", function () {
|
|
var checked = $(this).prop('checked');
|
|
localStorage.setItem("maptype", checked ? "leaflet" : "mapbox");
|
|
|
|
maptype = checked ? "leaflet" : "mapbox";
|
|
|
|
reloadMap();
|
|
});
|
|
|
|
$('.item-link[data-setting=alertsound] select').on("change", function () {
|
|
localStorage.setItem("alertsound", $('.item-link[data-setting=alertsound] select').val());
|
|
// Reload sound effect stuff to apply new sound
|
|
initSFX();
|
|
// Play the selected sound
|
|
playSound("alert");
|
|
}); |