mirror of
https://github.com/iv-org/invidious.git
synced 2025-08-03 19:28:29 +00:00
Change double equals to triple equals
Use strict equality, to avoid type coercion and conform to JS best practices (as suggested by @leonklingele).
This commit is contained in:
parent
854e9f61c4
commit
23f01c451b
@ -17,7 +17,7 @@ toggle_theme.addEventListener('click', function () {
|
||||
});
|
||||
|
||||
window.addEventListener('storage', function (e) {
|
||||
if (e.key == 'dark_mode') {
|
||||
if (e.key === 'dark_mode') {
|
||||
update_mode(e.newValue);
|
||||
}
|
||||
});
|
||||
@ -38,11 +38,11 @@ function set_mode (bool) {
|
||||
}
|
||||
|
||||
function update_mode (mode) {
|
||||
if (mode == 'true' /* for backwards compatibility */ || mode == 'dark') {
|
||||
if (mode === 'true' /* for backwards compatibility */ || mode === 'dark') {
|
||||
// If dark mode preference set
|
||||
set_mode(true);
|
||||
}
|
||||
else if (mode != 'light' && window.matchMedia('(prefers-color-scheme: dark)').matches) {
|
||||
else if (mode !== 'light' && window.matchMedia('(prefers-color-scheme: dark)').matches) {
|
||||
// If no preference set, but the browser tells us that the operating system has a dark theme
|
||||
set_mode(true);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user