diff --git a/www/assets/js/main.js b/www/assets/js/main.js index 9f3b73b..04b95e5 100644 --- a/www/assets/js/main.js +++ b/www/assets/js/main.js @@ -62,7 +62,7 @@ if (localStorage.getItem("alertradius") == null) { localStorage.setItem("alertradius", 100); } -if (localStorage.getItem("darktheme") == true) { +if (localStorage.getItem("darktheme") == "true") { $("#app").addClass("theme-dark"); } diff --git a/www/assets/js/settings.js b/www/assets/js/settings.js new file mode 100644 index 0000000..60c0adf --- /dev/null +++ b/www/assets/js/settings.js @@ -0,0 +1,18 @@ +/* + * 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'); + console.log(checked); + localStorage.setItem("darktheme", checked); + + if (localStorage.getItem("darktheme") == "true") { + $("#app").addClass("theme-dark"); + } else { + $("#app").removeClass("theme-dark"); + } +}) \ No newline at end of file diff --git a/www/pages/home.html b/www/pages/home.html index 35d5ebf..f2d5906 100644 --- a/www/pages/home.html +++ b/www/pages/home.html @@ -54,11 +54,10 @@
  • - +
    -
    Setup
    - +
    Settings
  • diff --git a/www/pages/settings.html b/www/pages/settings.html index 018854e..62d7ac8 100644 --- a/www/pages/settings.html +++ b/www/pages/settings.html @@ -6,25 +6,54 @@ +
    -
    -
    -
      -
    -
    +
    +
      + {{#each settings}} +
    • + {{#if toggle}} +
      +
      +
      +
      + {{title}} +
      +
      + +
      +
      +
      {{text}}
      +
      +
      + {{else}} +
      +
      +
      +
      {{title}}
      +
      +
      {{text}}
      +
      +
      + {{/if}} +
    • + {{/each}} +
    -
    - - - -
    - - +
    \ No newline at end of file diff --git a/www/routes.js b/www/routes.js index 4e96eee..aba0951 100644 --- a/www/routes.js +++ b/www/routes.js @@ -65,5 +65,44 @@ var routes = [ } } } - } + }, + { + path: '/settings', + name: 'settings', + async: function (routeTo, routeFrom, resolve, reject) { + resolve({ + templateUrl: './pages/settings.html' + }, { + context: { + settings: [ + { + setting: "darktheme", + title: "Use dark theme", + text: "", + toggle: true, + checked: localStorage.getItem("darktheme") == "true", + onclick: "" + }, + { + setting: "versions", + title: "PackageHelper app v1.0.0", + text: "Copyright © 2019 Netsyms Technologies. Licensed under the Mozilla Public License 2.0.", + onclick: "" + }, + { + setting: "opensource", + title: "Open Source Information", + text: "", + onclick: "router.navigate('/credits')" + }, + { + setting: "privacy", + title: "Privacy Policy and Terms", + text: "", + onclick: "openBrowser('https://netsyms.com/legal?pk_campaign=PackageHelpterApp')" + }] + } + }); + } + }, ]; \ No newline at end of file