/* * 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 settings = [ { setting: "litemode", title: "Use alternate map", text: "Replace the 3D map with a lightweight power-saving 2D version.", icon: "game-icon game-icon-treasure-map", color: "yellow", type: "toggle", restart: true }, { setting: "nickname", title: "Nickname", text: "Change your player name.", icon: "fas fa-user-edit", color: "blue", onclick: "changeNickname()", type: "link" }, { setting: "munzee", title: "Link Munzee account", text: "Scan Munzee codes from inside TerranQuest.", icon: "fas fa-qrcode", color: "green", onclick: "openBrowser('" + SETTINGS["munzee_url"] + "?username=" + localStorage.getItem("username") + "&password=" + localStorage.getItem("password") + "')", type: "link" }, { setting: "opensource", title: "Credits", text: "See information on third-party code and artwork used in TerranQuest.", icon: "game-icon game-icon-spell-book", color: "lightblue", onclick: "router.navigate('/credits')", type: "link" }, { setting: "privacy", title: "Privacy Policy", text: "Know what data we collect and what your rights are.", icon: "game-icon game-icon-spy", color: "purple", onclick: "openBrowser('" + SETTINGS["terms_of_service_url"] + "')", type: "link" }, { setting: "account", title: "Sign out", text: "Disconnect this device and open the sign in screen.", icon: "game-icon game-icon-exit-door", color: "red", onclick: "logout()", type: "link" }, { setting: "versions", title: "TerranQuest v" + app_version, text: "Copyright © 2014-2019 Netsyms Technologies. License: Mozilla Public License 2.0.", icon: "far fa-copyright margin-vertical", color: "gray", onclick: "" } ]; function changeNickname() { app.dialog.prompt('New Name', function (name) { callAPI("changenick", { nick: name }, function (success) { app.dialog.alert('You are now known as ' + success.name); }, function (error) { app.dialog.alert(error); }); }); } function loadSettings() { $("#settings-bin").html(""); settings.forEach(function (item) { $("#settings-bin").append('
  • ' + (item.type == "link" ? '' : '') + '
    ' + '
    ' + ' ' + '
    ' + '
    ' + '
    ' + ' ' + item.title + ' ' + '
    ' + '
    ' + (item.type == "toggle" ? '' : '') + '
    ' + '
    ' + '
    ' + (item.type == "link" ? '
    ' : '') + '
  • ' ); if (item.type == "toggle") { var toggle = app.toggle.create({ el: "#settings-bin li[data-setting=" + item.setting + "] .toggle", on: { change: function () { // Don't do anything if the setting isn't actually changed if ((localStorage.getItem(item.setting) == "true") == this.checked) { return; } localStorage.setItem(item.setting, this.checked); if (item.restart == true) { app.dialog.preloader('Applying changes...'); setTimeout(restartApplication, 1000); } } } }); if ((localStorage.getItem(item.setting) == "true") != toggle.checked) { toggle.toggle(); } } }); }