nfp_sites/nfp_moe/app/common.js

15 lines
497 B
JavaScript
Raw Normal View History

const DarkModeStorageName = 'nfp_sites_darkmode'
module.exports.darkIsOn = localStorage.getItem(DarkModeStorageName)
module.exports.toggleDarkMode = function() {
module.exports.darkIsOn = !module.exports.darkIsOn
if (this.darkIsOn) {
localStorage.setItem(DarkModeStorageName, true)
} else {
localStorage.removeItem(DarkModeStorageName)
}
document.body.className = (module.exports.darkIsOn ? 'nightmode ' : 'daymode ')
+ (window.supportsavif ? 'avifsupport' : 'jpegonly')
}