Commit Graph

17 Commits (8a44bd11d2abab8c9203d6dc3c3d5824e5e26327)

Author SHA1 Message Date
meow 2dead1a19b JS theme switching simplified 2 years ago
meow e18b10297b JS fixes: recursion in themes, keys for frame walking, JSON XHR and details-summary in IE11 2 years ago
meow fd66084388 js code rewrite. Themes rewritten, bugs fixed 2 years ago
meow 7dd699370f js code rewrite. Created _helpers.js with XHR and storage wrapper 2 years ago
meow dbb1e3f5d8 replace tabs to spaces 2 years ago
meow fafd4d9396 new lines in the end of file 2 years ago
meow 026ea52445 optional catchng is not supported by IE11 2 years ago
meow 7940e91cbe single quotes 2 years ago
meow eb7e48b059 use strict 2 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 5 years ago
Omar Roth 552f616305
Fix retry on timeout for AJAX requests 5 years ago
Omar Roth bfa488f77d
Add option to toggle theme without reload 5 years ago