Hi all,
Being a huge fan of web fonts, I went through the module and replaced the icons I encounter most with those from Meteocons. To be honest, the icons included in the set here weren't a match to the design for this project I'm working on and there were frankly too many icons that were extremely similar and that seemed confusing.
http://www.alessioatzeni.com/meteocons/
It's a free web font that includes nice images (as text) for various weather conditions. I had a difficult time trying to pick through the code, but eventually I got something together for my use. My question is if anyone else was interested in using web fonts instead of a zillion different icons. If anyone else is interested, I can share what I have here and hopefully someone can integrate it properly. Everything is done using pure CSS using classes, but I think a better approach is to use HTML5 data- attributes. Not to mention the module could be slimmed down significantly in the HTML (the version I have I believe is from January 2013-ish and was a little too bloat-y for my liking). For myself, I prefer to do as much as possible in CSS.
I'll paste an example for everyone to see what I'm talking about. I used css :before and :after and "content" to display the condition, along with the web font above it. It loads immediately as well.
.weatherIcon.day:before { content: "B"; }
.weatherIcon.day.few:before, .weatherIcon.day.broken:before { content: "H"; }
I won't waste anyone's time if nobody is interested, but if someone is, please let me know and I'll share what I have. Keep in mind I'm not familiar with how to contribute but I will give it my best shot.
-----
Regardless of whether or not everyone wants to move to a CSS web font, I think moving to a CSS solution for the icons is a necessity instead of hardcoding.
Comment | File | Size | Author |
---|---|---|---|
#5 | weather-using-meteocons_2162619_5.patch | 7.09 KB | Andreas Radloff |
Comments
Comment #1
PeterMK85 CreditAttribution: PeterMK85 commentedGreat idea, on styling part the output needs an update. I'm interested in the usage of the font-icons.
Comment #2
Anonymous (not verified) CreditAttribution: Anonymous commentedI would be interested in seeing your solution, sgp913.
Comment #3
joelhsmith CreditAttribution: joelhsmith commented@sgp913 I also think its a super cool idea. It would be nice to have the option to use images or webfonts.
Comment #4
sgp913 CreditAttribution: sgp913 commentedHi everyone, sorry, I've been a bit busy recently. The site that I'm using this on is currently undergoing a redesign, and my hacks don't fit properly into the new design as I had used it for the old one. Instead of "re-hacking", I will try to do it more properly. I don't know if it's ok to directly include the Meteocons font in the module, I'm assuming it's not, so I need to figure out how to use libraries properly or find a CDN source we can all just link to (preferable).
Is there a "better" web font for weather besides Meteocons? I'm not particularly tied to that one, just thought it looked nice.
Comment #5
Andreas Radloff CreditAttribution: Andreas Radloff commentedI went ahead and implemented this. Here's a patch agains current version (7.x-2.6). The font needs to be downloaded separately. There's now a setting to enable the icon font.
Comment #6
jorisx CreditAttribution: jorisx commentedWow this looks really great and loads so much faster!
Great work, thanks for the patch !
Comment #7
sgp913 CreditAttribution: sgp913 commentedGreat job with the patch, my apologies for not getting on it fast enough.
Actually...the reason why I gave up on this is because I started using https://www.drupal.org/project/simpleweather instead. It's simpler, no cron jobs, and all I needed was just the current weather condition anyway.
Comment #8
ysamoylenko CreditAttribution: ysamoylenko at EPAM Systems commentedHello @Andreas Radloff,
Thanks for your great patch.
It works as expected.
Comment #10
ysamoylenko CreditAttribution: ysamoylenko at EPAM Systems commentedThe patch was committed.
Thank you for your participation in the module development.