A Twitch.tv viewer reward and games system.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
1.5 KiB

  1. extends layout
  2. block content
  3. div.uk-grid
  4. br
  5. br
  6. div.uk-width-1-2
  7. div.uk-panel.uk-panel-box
  8. h2 #{title} is
  9. span#status offline.
  10. div#streambox
  11. div.uk-width-1-2
  12. div.uk-panel.uk-panel-box
  13. table.uk-table.uk-table-hover.uk-table-striped
  14. caption Top 10 Potato Farmers
  15. thead
  16. tr
  17. th Viewer
  18. th Potatoes
  19. tbody
  20. each row in rows
  21. tr
  22. td #{row.user}
  23. td #{row.points}
  24. block postscript
  25. script.
  26. $(document).ready(function(){
  27. $.getJSON('https://api.twitch.tv/kraken/streams/#{title}?callback=?', function(data){
  28. if(data.stream) {
  29. $('#status').empty().append('online!');
  30. $("#streambox").append("<span>Game:</span> <span class='uk-text-bold uk-text-success'>"+data.stream.game+"</span><br/>");
  31. $("#streambox").append("<span>Viewers:</span> <span class='uk-text-bold uk-text-warning'>"+data.stream.viewers+"</span><br/>");
  32. $("#streambox").append("<br/><br/><img src='"+data.stream.preview.medium+"' />");;
  33. } else {
  34. $("#streambox").append("<h3 class='uk-text-danger'>Offline</h3>");
  35. }
  36. });
  37. });