2
0

TwitterSearch.st 744 B

123456789101112131415161718192021222324252627282930
  1. Object subclass: #TwitterSearch
  2. instanceVariableNames: ''
  3. category: 'Examples'!
  4. !TwitterSearch methodsFor: 'not yet classified'!
  5. query: aQueryString
  6. | result |
  7. result := jQuery
  8. ajax: 'http://search.twitter.com/search.json?rpp=5&q=', aQueryString
  9. options: #{
  10. 'type' -> 'GET'.
  11. 'success' -> [ :tmp | self success: (tmp results)].
  12. 'error' -> [window alert: 'error'].
  13. 'dataType' -> 'jsonp'
  14. }.
  15. !
  16. success: tweets
  17. | wall table tr |
  18. wall := '#playground'.
  19. table := (HTMLCanvas onJQuery: (wall asJQuery)) table.
  20. table element id: 'twitterwall'.
  21. tweets do: [ :tweet |
  22. tr := HTMLCanvas new tr.
  23. table append: tr.
  24. Tweet openAt: tr with: tweet
  25. ].
  26. ! !