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.
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!
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.
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.
I don't see why not, if there is interest. I really just refactored it to work with my project without jQuery. I'll take a look, maybe make the choice of API selectable.
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.
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:
9 comments
[ 3.2 ms ] story [ 31.5 ms ] threadTo 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.
Work in progress:
https://github.com/a12k/reallySimpleWeather/tree/wundergroun...
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';