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