fix lint errors
This commit is contained in:
+20
-13
@@ -663,7 +663,9 @@ function storedCustomColorPreference() {
|
||||
try {
|
||||
const local = window.localStorage.getItem(customColorKey)
|
||||
if (local && /^#[0-9a-fA-F]{6}$/.test(local)) return local
|
||||
} catch { }
|
||||
} catch {
|
||||
// Ignore unavailable localStorage.
|
||||
}
|
||||
|
||||
return ''
|
||||
}
|
||||
@@ -673,13 +675,17 @@ function persistCustomColorPreference(color) {
|
||||
writeCookie(customColorCookie, color)
|
||||
try {
|
||||
window.localStorage.setItem(customColorKey, color)
|
||||
} catch { }
|
||||
} catch {
|
||||
// Ignore unavailable localStorage.
|
||||
}
|
||||
return color
|
||||
} else {
|
||||
writeCookie(customColorCookie, '')
|
||||
try {
|
||||
window.localStorage.removeItem(customColorKey)
|
||||
} catch { }
|
||||
} catch {
|
||||
// Ignore unavailable localStorage.
|
||||
}
|
||||
return ''
|
||||
}
|
||||
}
|
||||
@@ -700,7 +706,9 @@ function storedCustomColors() {
|
||||
}
|
||||
return result
|
||||
}
|
||||
} catch { }
|
||||
} catch {
|
||||
// Ignore invalid stored color JSON.
|
||||
}
|
||||
return {}
|
||||
}
|
||||
|
||||
@@ -713,7 +721,9 @@ function storedCustomColors() {
|
||||
try {
|
||||
const local = window.localStorage.getItem(customColorsKey)
|
||||
if (local) return parse(local)
|
||||
} catch { }
|
||||
} catch {
|
||||
// Ignore unavailable localStorage.
|
||||
}
|
||||
|
||||
return {}
|
||||
}
|
||||
@@ -725,7 +735,11 @@ function persistCustomColors(colors) {
|
||||
}
|
||||
const json = JSON.stringify(filtered)
|
||||
writeCookie(customColorsCookie, json)
|
||||
try { window.localStorage.setItem(customColorsKey, json) } catch { }
|
||||
try {
|
||||
window.localStorage.setItem(customColorsKey, json)
|
||||
} catch {
|
||||
// Ignore unavailable localStorage.
|
||||
}
|
||||
return filtered
|
||||
}
|
||||
|
||||
@@ -3453,13 +3467,6 @@ function SettingsPage({ theme, onThemeChange, customColor, onCustomColorChange,
|
||||
if (preset.color) setDraftColor(preset.color)
|
||||
}
|
||||
|
||||
function handleColorInput(value) {
|
||||
setDraftColor(value)
|
||||
if (/^#[0-9a-fA-F]{6}$/.test(value)) {
|
||||
onCustomColorChange(value)
|
||||
}
|
||||
}
|
||||
|
||||
function handleColorPickerChange(value) {
|
||||
setDraftColor(value)
|
||||
onCustomColorChange(value)
|
||||
|
||||
Reference in New Issue
Block a user