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.

83 lines
3.5 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 Rank
  40. th Viewer
  41. th Potatoes
  42. tbody
  43. ul.uk-pagination
  44. script.
  45. var perPage = 50,
  46. data = !{JSON.stringify(rows)};
  47. $(document).ready(function(){
  48. // Create pagination buttons
  49. for(var i = 1; i <= Math.ceil(data.length/perPage); i++) {
  50. var button = $('<li page='+i+'></li>').append('<a>'+i+'</a>');
  51. button.on('click', function(){
  52. //get page
  53. var z = $(this).attr('page');
  54. // cleanup
  55. var temp = $('.uk-active').attr('page');
  56. $('.uk-active').removeClass('uk-active').empty().append('<a>'+temp+'</a>');
  57. $('table > tbody').empty();
  58. $(this).addClass('uk-active').empty().append('<span>'+z+'</span>');
  59. // 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)
  60. var a = (perPage*(z-1)),
  61. b = perPage*z,
  62. pstart = z-1;
  63. data.slice(a, b).forEach(function(element, index, array){
  64. $('table > tbody').append($('<tr></tr>').append('<td>'+(a+index+1)+'</td><td>'+element.user+'</td><td>'+element.points+'</td>'));
  65. });
  66. });
  67. $('.uk-pagination').append(button);
  68. }
  69. $('ul.uk-pagination > li').first().click();
  70. });
  71. function createPaginationButton(button) {
  72. }