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.

81 lines
3.4 KiB

  1. doctype html
  2. html(lang="en")
  3. head
  4. title= title
  5. link(rel='stylesheet', href='/lib/uikit/css/uikit.almost-flat.min.css')
  6. link(rel='stylesheet', href='/css/app.css')
  7. script(src='/lib/jquery.js')
  8. script(src='/lib/uikit/js/uikit.min.js')
  9. body
  10. div.uk-grid
  11. div.uk-width-1-1
  12. div.uk-grid
  13. div.uk-width-1-4
  14. img(src='/img/#{logo}')
  15. div.uk-width-2-4
  16. // bigimagelogo
  17. h1.uk-text-center #{title}<br/>#{slogan}
  18. div.uk-width-1-4
  19. img.flip(src='/img/#{logo}')
  20. div.uk-width-1-1
  21. nav.uk-navbar
  22. ul.uk-navbar-nav.uk-navbar-center
  23. li: a(href='http://www.twitch.tv/#{title}'): img(src='/img/twitch.png', alt='Stream')
  24. li: a(href='/') Home
  25. li: a(href='/ladder') Ladder
  26. li: a(href='#') Chat Stats
  27. li: a(href='http://www.twitter.com/#{twitter}'): img(src='/img/twitter.gif', alt='Twitter')
  28. div.uk-width-1-1
  29. div.uk-container.uk-container-center
  30. div.uk-grid
  31. br
  32. br
  33. div.uk-width-1-1
  34. div.uk-panel.uk-panel-box
  35. table.uk-table.uk-table-hover.uk-table-striped
  36. caption Potato Farmer Ladder Rankings
  37. thead
  38. tr
  39. th Viewer
  40. th Potatoes
  41. tbody
  42. ul.uk-pagination
  43. script.
  44. var perPage = 50,
  45. data = !{JSON.stringify(rows)};
  46. $(document).ready(function(){
  47. // Create pagination buttons
  48. for(var i = 1; i <= Math.ceil(data.length/perPage); i++) {
  49. var button = $('<li page='+i+'></li>').append('<a>'+i+'</a>');
  50. button.on('click', function(){
  51. //get page
  52. var z = $(this).attr('page');
  53. // cleanup
  54. var temp = $('.uk-active').attr('page');
  55. $('.uk-active').removeClass('uk-active').empty().append('<a>'+temp+'</a>');
  56. $('table > tbody').empty();
  57. $(this).addClass('uk-active').empty().append('<span>'+z+'</span>');
  58. // slice(a, b): a = (n*(x-1))+1, b = n*x where n = perPage and x=curerntPage (skip +1 at end of a for splice)
  59. var a = (perPage*(z-1)),
  60. b = perPage*z;
  61. data.slice(a, b).forEach(function(element, index, array){
  62. $('table > tbody').append($('<tr></tr>').append('<td>'+element.user+'</td><td>'+element.points+'</td>'));
  63. });
  64. });
  65. $('.uk-pagination').append(button);
  66. }
  67. $('ul.uk-pagination > li').first().click();
  68. });
  69. function createPaginationButton(button) {
  70. }