1119 Privacy - Query Page and Dom.storage

handle localStorage being null

Signed-off-by: Chris Miceli <chrismiceli@outlook.com>
This commit is contained in:
Chris Miceli
2021-12-24 22:32:01 -06:00
parent cca2f78c10
commit 99c718296a
5 changed files with 21 additions and 12 deletions

View File

@@ -58,7 +58,9 @@ function countDown() {
} else {
ena.text("Enable");
piholeChanged("enabled");
localStorage.removeItem("countDownTarget");
if (localStorage) {
localStorage.removeItem("countDownTarget");
}
}
}
@@ -148,7 +150,7 @@ function initCheckboxRadioStyle() {
}
// Read from local storage, initialize if needed
var chkboxStyle = localStorage.getItem("theme_icheck");
var chkboxStyle = localStorage ? localStorage.getItem("theme_icheck") : null;
if (chkboxStyle === null) {
chkboxStyle = "primary";
}
@@ -172,7 +174,10 @@ function initCheckboxRadioStyle() {
function initCPUtemp() {
function setCPUtemp(unit) {
localStorage.setItem("tempunit", tempunit);
if (localStorage) {
localStorage.setItem("tempunit", tempunit);
}
var temperature = parseFloat($("#rawtemp").text());
var displaytemp = $("#tempdisplay");
if (!isNaN(temperature)) {
@@ -195,7 +200,7 @@ function initCPUtemp() {
}
// Read from local storage, initialize if needed
var tempunit = localStorage.getItem("tempunit");
var tempunit = localStorage ? localStorage.getItem("tempunit") : null;
if (tempunit === null) {
tempunit = "C";
}