
Show HN: Simple JavaScript Weather Plugin with JQuery Dependencies Removed - a12k
https://a12k.io/reallysimpleweather
======
a12k
I was working on a project and found a plugin that was perfect. Unfortunately
my project didn't use jQuery and the plugin was built on jQuery. I didn't want
to add another dependency. I noticed the plugin was licensed under MIT, so I
thought I would fork it and refactor it to remove jQuery dependencies, which I
did. Thought I would share.

------
dvh
I think the demo would be more readable when you would use
JSON.stringify(data, undefined, 4) a put it in PRE element, with flat
structure in plaintext it's indented randomly depending on the name of
attribute which is kida kard to read, with JSON you see what belongs where,
not to mention the rendering code would be much simpler, like this:

reallySimpleWeather.weather({location: 'Bend, OR', woeid: '', unit: 'f',
success: function(w) {
console.log(document.getElementById('weather').innerHTML = JSON.stringify(w,
undefined, 4))} }); document.getElementById('weather').style.whiteSpace='pre';

------
elbigbad
I'm using the jquery simpleweather for a chrome extension at the moment. This
looks like a direct replacement. I'm using jquery elsewhere in the extension,
but as long as this works the same I see no reason not to switch, one fewer
thing to worry about breaking my extension in the future.

~~~
Feuilles_Mortes
If it ain't broke...

~~~
a12k
To be fair, I did change it to be a drop in replacement. Fewer dependencies is
always good, especially in the plugin itself.

To test this, I went through all the examples on the original project with
jQuery and dropped in the new file and changed the original call and all the
demos work great with those two minor changes.

------
ohyoutravel
I don't see any reason why jquery should have been in the original library in
the first place and you can still use jquery on the front end with this, so
really a good improvement. kudos!

------
jusuchin
I like it... will have to look and play around with it. Any chance it could be
hooked up to utilize the WeatherUnderground API?

~~~
a12k
It's too late to edit my own post so I'll just reply again. I went ahead and
started work on the Weather Underground API. It generally works so far, and
will automatically use the WU API if a WU API key is provided.

Work in progress:

[https://github.com/a12k/reallySimpleWeather/tree/wundergroun...](https://github.com/a12k/reallySimpleWeather/tree/wunderground-
api)

