-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #148 from medyo/develop
implement: dnd mode
- Loading branch information
Showing
31 changed files
with
679 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,22 @@ | ||
// Blocking script to avoid the initial background flickering (switching from light to dark) | ||
// https://stackoverflow.com/a/63033934/3495717 | ||
|
||
function isDNDModeActive(DNDDuration) { | ||
if (DNDDuration === 'always') { | ||
return true | ||
} else if (typeof DNDDuration === 'object') { | ||
return Boolean(DNDDuration.value && DNDDuration.countdown - new Date().getTime() > 0) | ||
} else { | ||
return false | ||
} | ||
} | ||
try { | ||
var theme = JSON.parse(localStorage.preferences_storage).theme || 'dark' | ||
var state = JSON.parse(localStorage.preferences_storage).state | ||
var theme = state.theme || 'dark' | ||
document.documentElement.classList.add(theme) | ||
} catch (e) { | ||
console.log(e) | ||
} | ||
|
||
var DNDDuration = state.DNDDuration || 'never' | ||
if (isDNDModeActive(DNDDuration)) { | ||
document.documentElement.classList.add('dndState') | ||
} | ||
} catch (e) {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.