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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

PeterMK85’s picture

Great idea, on styling part the output needs an update. I'm interested in the usage of the font-icons.

Anonymous’s picture

I would be interested in seeing your solution, sgp913.

joelhsmith’s picture

@sgp913 I also think its a super cool idea. It would be nice to have the option to use images or webfonts.

sgp913’s picture

Hi 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.

Andreas Radloff’s picture

Version: 7.x-2.x-dev » 7.x-2.6
Status: Active » Needs review
FileSize
7.09 KB

I 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.

jorisx’s picture

Wow this looks really great and loads so much faster!
Great work, thanks for the patch !

sgp913’s picture

Great 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.

ysamoylenko’s picture

Status: Needs review » Reviewed & tested by the community

Hello @Andreas Radloff,

Thanks for your great patch.

It works as expected.

ysamoylenko’s picture

Status: Reviewed & tested by the community » Fixed

The patch was committed.

Thank you for your participation in the module development.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.