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.

60 lines
2.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. br
  12. div#betstats
  13. span.uk-text-bold Betting is currently:
  14. #{bet_status}
  15. if bet_status === true
  16. span.uk-text-bold.uk-text-success  Active
  17. else
  18. span.uk-text-bold.uk-text-danger  Inactive
  19. if bet_board
  20. table.uk-table
  21. caption Current Betting Pool
  22. thead
  23. tr
  24. th Option
  25. th Total
  26. tbody
  27. each option in bet_board
  28. tr
  29. td !#{option.name}
  30. td #{option.total}
  31. br
  32. div.uk-width-1-2
  33. div.uk-panel.uk-panel-box
  34. table.uk-table.uk-table-hover.uk-table-striped
  35. caption Top 10 Potato Farmers
  36. thead
  37. tr
  38. th Viewer
  39. th Potatoes
  40. tbody
  41. each row in rows
  42. tr
  43. td #{row.user}
  44. td #{row.points}
  45. block postscript
  46. script.
  47. $(document).ready(function(){
  48. $.getJSON('https://api.twitch.tv/kraken/streams/#{title}?callback=?', function(data){
  49. if(data.stream) {
  50. $('#status').empty().append('online!');
  51. $("#streambox").append("<span>Game:</span> <span class='uk-text-bold uk-text-success'>"+data.stream.game+"</span><br/>");
  52. $("#streambox").append("<span>Viewers:</span> <span class='uk-text-bold uk-text-warning'>"+data.stream.viewers+"</span><br/>");
  53. $("#streambox").append("<br/><br/><img src='"+data.stream.preview.medium+"' />");;
  54. } else {
  55. $("#streambox").append("<h3 class='uk-text-danger'>Offline</h3>");
  56. $("#betstats").hide();
  57. }
  58. });
  59. });