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
(PoC/WIP)Theme selection #69
Conversation
Great! About 1: How about just storing which additional css file should be loaded as a string like "css-halloween.css"? But then you'd have to be careful not to allow including a css from an untrusted domain. |
Maybe you could turn the select into a simple switch button that clearly shows which is on/off. |
Ready to be merged? Could it share the forum setting even though the forum is in forum.ddnet.tw instead of ddnet.tw? |
nope some cleanup to do i left some console.log calls and i think i need to handle the case when default_theme is set to something, will be soon tho EDIT : for the forum i don't know the link is as "/thefile.css" so if that file exists at the / of forum.ddnet.tw it should work |
Indeed i did not thought about the forum, it's on a different subdomain i'll have to rewrite the storage part for it to to use a cookie. code is way simpler but with limitations :
Are any of those problematic/needed ? To add a new theme just modify the available_theme variable.
Alright i'll start on the cookie storage part by tomorrow have a good day ! |
Thanks a lot, sounds all good to me :) |
http://foo.krkrkr.org/ - http://bar.krkrkr.org/ As long as the script is called in the page and somefile.css is at / of that domain/subdomain it should work, did not do extensive testing tho |
The switch stays on dark when you switch one to bright but still have the other tab open and press f5 there, even though the color changes. |
Should be fixed 👍 |
I'd like to merge it and see how it works in production. Anything you still want to clean up before that? |
nope i mean can change default_theme if you want the default to be halloween style otherwise it's fine. edit : demo not available atm server in maintenance for a defective memory module. |
@def- for example right now on ddnet.tw, https://ddnet.tw/ranks/ gets the halloween css but if i search my nickname https://ddnet.tw/players/-9835-/ i don't get that css. The /ranks directory does not exist in that repo, & the thing is /players exists and is apparently based on the default layout, where the css is included, so there's an issue here. Must have been generated before that halloween css were included or something like that, i don't know how that's organized in production |
Huge thanks! I'll fix it up for forum and scripts now :) |
Hm, doesn't seem to work with the forum. And it's a bit annoying that it first loads in the bright color and then switches to dark. |
Doesn't work on the forums because themes.js isn't at the forum / Yeah indeed the flickering can get annoying i'm gonna try to see if i can fix it as soon as i get a bit of free time |
Fixed, still not working. |
Actually the forum had its own halloween style, I guess it'll be hard to make that switch too. So no worries. |
Ah nope, that's also at //ddnet.tw/css-halloween.css. Should I symlink it or what's the easiest fix? |
As you wish either symlink it or otherwise themes.js could checks for the url and add "//ddnet.tw//css-halloween.css" if it is on the forums, same results i guess |
Great, works! Should I write a news article for this or should we wait to see if you can fix the flash first? |
yeah i'll try to fix that first, no needs for an article about that 👍 |
Ok solution to fix flickering basically involves adding the halloween style on post & default and enabling/disabling in using js instead of adding it only if needed edit: demo should work without flickering atm |
Live demo : http://krkrkr.org
Forum might not work atm (did not setup a phpbb clone yet)
So when a visitor comes if he doesn't have an already selected theme, this place a default object containing the default theme configuration in his browser storage.
He can switch themes using an html select thingy on the index, if he does the new theme configuration is applied & stored.
So far there is only one theme and it's just tweaks for the default one, so default is always on and the Halloween one gets enabled/disabled as needed.
To add a new theme you need to :
TODO :
Anyway, any thought ?