Saving dark-mode into the config json.

This commit is contained in:
Anonymus Raccoon
2019-05-25 20:06:59 +02:00
parent 13916a075e
commit 73de41b2af
7 changed files with 27 additions and 20 deletions

View File

@@ -48,18 +48,4 @@
shell.openExternal(event.currentTarget.href);
});
if($("#body").hasClass("dark-mode"))
{
$(".switch").find("input[type=checkbox]").prop("checked", true);
}
$(".switch").find("input[type=checkbox]").on("change",function() {
var checked = $(this).prop("checked");
if(checked)
$("#body").addClass("dark-mode");
else
$("#body").removeClass("dark-mode");
});
</script>

View File

@@ -13,6 +13,7 @@
<script src="../js/electron-specific.js"></script> <!--Using this script because electrons scripts cant be compiled-->
<script src="../js/index.js"></script>
</head>
<body id="body">
<header style="height: 56px;">

4
dist/js/index.js vendored

File diff suppressed because one or more lines are too long

View File

@@ -67,7 +67,7 @@ function handleArgs(arg)
{
var token = arg.substring(arg.lastIndexOf("id/") + 3);
log.log("Token: " + token);
var store = new Store("account");
var store = new Store("config");
store.set("steam", token);
}
}

View File

@@ -4,7 +4,6 @@ import { Game, launcher } from "./Game";
export function LoadGames(): Game[]
{
const Store = require("../js/store");
const userAgent = navigator.userAgent.toLowerCase();
var isElectron = userAgent.indexOf(" electron/") > -1;
if (isElectron)

View File

@@ -6,7 +6,7 @@ export function getSteamToken(): string
if (isElectron)
{
const Store = require("../js/store");
const tknStore = new Store("account");
const tknStore = new Store("config");
const tkn = tknStore.get("steam");
return tkn != null ? tkn : "76561198196430655";
}

View File

@@ -1,9 +1,17 @@
// import $ from "jquery"; //Using global scope jquery instead beacause it make a huge file if we use this.
import { setup } from "./Carousel";
import { populateGrid } from "./Library"
const Store = require("../js/store");
$(function ()
{
const config = new Store("config");
if(config.get("dark-mode"))
{
$("#body").addClass("dark-mode");
}
home();
document.getElementById("title").onclick = () => { home() };
@@ -32,8 +40,21 @@ function openSearch()
function openSettings()
{
$("#content").load("fragments/settings.html", () =>
{
{
$(".switch").find("input[type=checkbox]").on("change",function() {
var checked = $(this).prop("checked");
if(checked)
$("#body").addClass("dark-mode");
else
$("#body").removeClass("dark-mode");
const store = new Store("config");
store.set("dark-mode", checked);
});
if($("#body").hasClass("dark-mode"))
$(".switch").find("input[type=checkbox]").prop("checked", true);
});
document.getElementById("title").innerHTML = "<i class='icon fas fa-arrow-left'></i> Settings";
}