Remember user preferrence in localStorage

This commit is contained in:
Misode
2019-12-20 19:04:32 +01:00
parent 828af07a8a
commit 9d038dc3bc
2 changed files with 6 additions and 1 deletions

View File

@@ -15,7 +15,7 @@
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css" integrity="sha384-GJzZqFGwb1QTTN6wy59ffF1BuGJpLSa9DkKMp0DgiMDm4iYMj70gZWKYbI706tWS" crossorigin="anonymous">
<link rel="stylesheet" href="custom.css">
</head>
<body data-style="light">
<body>
<nav class="navbar navbar-expand-md navbar-dark bg-dark">
<span id="descriptionSpan" class="navbar-brand mb-0 h1" data-i18n="description.loot-table"></span>
<button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#collapsibleNavbar">

View File

@@ -32,8 +32,13 @@ function changeVersion(version) {
});
}
changeTheme(localStorage.getItem('theme'))
function changeTheme(theme) {
if (theme === null) {
theme = 'light';
}
$('body').attr('data-style', theme);
localStorage.setItem('theme', theme);
}
function updateView() {