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:
psvenk 2019-07-29 12:27:26 -04:00 committed by Omar Roth
parent 854e9f61c4
commit 23f01c451b
No known key found for this signature in database
GPG Key ID: B8254FB7EC3D37F2

View File

@ -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);
}