Skip to content

Instantly share code, notes, and snippets.

@chendo
Created March 31, 2010 01:30
Show Gist options
  • Save chendo/349825 to your computer and use it in GitHub Desktop.
Save chendo/349825 to your computer and use it in GitHub Desktop.
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