Created
March 31, 2010 01:30
-
-
Save chendo/349825 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.Widget.Trending: class TrendingWidget extends Widget | |
constructor: (config) -> | |
Widget.Trending.instance: this | |
@template: """ | |
<div class='widget small trending'> | |
<ul> | |
{{#topics}} | |
<li class='down'>{{name}}</li> | |
{{/topics}} | |
</ul> | |
</div> | |
""" | |
config['refreshRate']: config['refreshRate'] || '5s' | |
super config | |
tick: -> | |
$.getScript("http://search.twitter.com/trends/current.json?callback=Widget.Trending.instance.tickResponse") | |
tickResponse: (data) -> | |
for date, trends of data['trends'] | |
data.topics = trends | |
@renderView(data) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment