-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Fix issue2534 #2658
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Fix issue2534 #2658
Changes from 20 commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
aa38b1f
Multi tab WIP
gregueiras 1d21bb1
Values are now saved
gregueiras e137424
Format
gregueiras 1419c71
Border added
gregueiras 8be0ea6
Scheduled Theme default configuration
gregueiras f38fef2
ThemeManager Created
gregueiras 0f8c627
Fixed checkbox
gregueiras 36b97fc
Interface Improved
gregueiras 3366297
Fixed default theme thumb background
gregueiras ceed178
Inverted thumb order
gregueiras 8b54f5a
Removed colons and semi colons
gregueiras cd53a65
Code Style Improvements
gregueiras 7034e7b
Delete Slider.styl
gregueiras a19ff67
Unit tests added
gregueiras b91a76b
Merge branch 'master' into fixIssue2534
gregueiras d4123ee
Merge branch 'master' of https://github.com/BoostIO/Boostnote into fi…
gregueiras 9c3f34f
Fix Lint Errors
gregueiras 8a6df8b
Remove comment
gregueiras 38ed5b8
Remove handleSlider
gregueiras 48c8164
Fix scheduled theme change timing
gregueiras e1c95fb
Fix Saving Configuration Bug
gregueiras 4915c54
Merge branch 'master' into fixIssue2534
gregueiras File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| const chooseTheme = ui => { | ||
| if (!ui.enableScheduleTheme) { | ||
| return | ||
| } | ||
|
|
||
| const start = parseInt(ui.scheduleStart) | ||
| const end = parseInt(ui.scheduleEnd) | ||
|
|
||
| const now = new Date() | ||
| const minutes = now.getHours() * 60 + now.getMinutes() | ||
|
|
||
| const isEndAfterStart = end > start | ||
| const isBetweenStartAndEnd = minutes >= start && minutes < end | ||
| const isBetweenEndAndStart = minutes >= start || minutes < end | ||
|
|
||
| if ( | ||
| (isEndAfterStart && isBetweenStartAndEnd) || | ||
| (!isEndAfterStart && isBetweenEndAndStart) | ||
| ) { | ||
| if (ui.theme !== ui.scheduledTheme) { | ||
| ui.defaultTheme = ui.theme | ||
| ui.theme = ui.scheduledTheme | ||
| applyTheme(ui.theme) | ||
| } | ||
| } else { | ||
| if (ui.theme !== ui.defaultTheme) { | ||
| ui.theme = ui.defaultTheme | ||
| applyTheme(ui.theme) | ||
| } | ||
| } | ||
| } | ||
|
|
||
| const applyTheme = theme => { | ||
| const supportedThemes = [ | ||
| 'dark', | ||
| 'white', | ||
| 'solarized-dark', | ||
| 'monokai', | ||
| 'dracula' | ||
| ] | ||
| if (supportedThemes.indexOf(theme) !== -1) { | ||
| document.body.setAttribute('data-theme', theme) | ||
| } else { | ||
| document.body.setAttribute('data-theme', 'default') | ||
| } | ||
| } | ||
|
|
||
| module.exports = { | ||
| chooseTheme, | ||
| applyTheme | ||
| } | ||
This file contains hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've fixed the problem. It was just the way I was comparing the dates. If you scheduled the change to happen at 15:30, it would change only at 15:31.