Commit Graph

18 Commits (46969c2a2e56a113e5b01a91465c2750228259ef)

Author SHA1 Message Date
shironeko 1aaf290814 handle auto theme correctly with the manual toggle
If the user used the manual toggle, they will not be able to get back to
auto since it will force set to light theme. This should fix that.
2 years ago
meow 2dead1a19b JS theme switching simplified 3 years ago
meow e18b10297b JS fixes: recursion in themes, keys for frame walking, JSON XHR and details-summary in IE11 3 years ago
meow fd66084388 js code rewrite. Themes rewritten, bugs fixed 3 years ago
meow 7dd699370f js code rewrite. Created _helpers.js with XHR and storage wrapper 3 years ago
meow dbb1e3f5d8 replace tabs to spaces 3 years ago
meow fafd4d9396 new lines in the end of file 3 years ago
meow 026ea52445 optional catchng is not supported by IE11 3 years ago
meow 7940e91cbe single quotes 3 years ago
meow eb7e48b059 use strict 3 years ago
Dimitris Apostolou 7e4690e43c
Fix typos 3 years ago
Théo Gaillard 73a142fd9b
fix: null ptr while loading/switching theme 3 years ago
saltycrys de777907f2 Apply dark theme immediately
Themes are now controlled with a class on the body element.

If a preference is set the body element will have either "dark-theme"
or "light-theme" class. If no preference is set or the preference is
empty the class will be "no-theme".

"dark-theme" and "light-theme" are handled by darktheme.css and
lighttheme.css respectively.

"no-theme" is handled by default.css where depending on the value of
"prefers-color-scheme" the styles corresponding to "dark-theme" or
"light-theme" are applied.

Unfortunately this means that both themes are duplicated, once in the
theme .css and once in default.css.
4 years ago
Kyle Copperfield a3045a3953
Use a MediaQueryListener to toggle on demand. Tested on OSX. (#925)
Closes #867.
5 years ago
psvenk f54fbd057e Add prefers-color-scheme support (#601)
* Add prefers-color-scheme support

This should fix <https://github.com/omarroth/invidious/issues/559>.
The cookie storage format has been changed from boolean
("true"/"false") to tri-state ("dark"/"light"/""), so that users
without a cookie set will get dark mode if they have enabled the dark
theme in their operating system. The code for handling the cookie
state, along with the user's operating system theme, has been factored
out into a new function `update_mode`, which is called both at window
load and at the "storage" event listener, because the "storage" event
listener is only trigerred when a change is made to the localStorage
from another tab/window (for more info - see
<https://stackoverflow.com/a/4679754>).
5 years ago
Omar Roth 17edfd6573
Shorten timeout for AJAX 6 years ago
Omar Roth 552f616305
Fix retry on timeout for AJAX requests 6 years ago
Omar Roth bfa488f77d
Add option to toggle theme without reload 6 years ago