DotaNoobs main site.
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.

132 lines
5.7 KiB

  1. {% extends "layout.html" %}
  2. {% block head %} <link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='css/ts3_viewer.css') }}"> {% endblock %}
  3. {% block title %}Dota Noobs{% endblock %}
  4. {% block content %}
  5. {#{% cache 60*5 %}#}
  6. {% set teamspeak_data = get_teamspeak_window() %}
  7. <div class="uk-grid">
  8. <div class="uk-width-large-1-2 uk-width-medium-1-1 uk-panel uk-panel-space">
  9. <h1 class="uk-panel-title">Events</h1>
  10. {#
  11. {% if active_event %}
  12. <article class="uk-article">
  13. <h4>Right Now</h4>
  14. <a href="{{ url_for('event_summary', eventid=active_event._id) }}">{{ active_event.name }}</a>
  15. <p class="uk-article-meta">Ends at: {{ timestamp_to_js_date(active_event.end_time) }}</p>
  16. </article>
  17. {% endif %}
  18. {% if upcoming_event %}
  19. <article class="uk-article">
  20. <h4>Next Event</h4>
  21. <a href="{{ url_for('event_summary', eventid=upcoming_event._id) }}">{{ upcoming_event.name }}</a>
  22. <p class="uk-article-meta">Starts at: {{ timestamp_to_js_date(upcoming_event.start_time) }}</p>
  23. </article>
  24. {% else %}
  25. <em>No events planned for the near future. Suggest one on the forum!</em>
  26. {% endif %}
  27. #}
  28. <em>No events planned for the near future. Suggest one on the forum!</em>
  29. </div>
  30. <div class="uk-width-large-1-2 uk-width-medium-1-1 uk-panel uk-panel-box uk-text-center">
  31. <a href="#" data-uk-modal="{target: '#tsviewer'}"><div class="uk-badge uk-panel-badge uk-badge-success"><i class="uk-icon-user"></i> Users</div></a>
  32. <h1 class="uk-panel-title">Teamspeak</h1>
  33. <div class="uk-grid uk-margin-bottom">
  34. <div class="uk-width-1-3 uk-panel">
  35. <h3>Users<br/><span class="ts_num">{{ ts3_current_clients() }}</span></h3>
  36. </div>
  37. <div class="uk-width-1-3 uk-panel">
  38. <h3 class="uk-text-success">Online</h3>
  39. </div>
  40. <div class="uk-width-1-3 uk-panel">
  41. <h3>Countries<br/><span class="ts_num">{{ ts3_countries_active(teamspeak_data) }}</span></h3>
  42. </div>
  43. </div>
  44. <a class="uk-button uk-button-success uk-width-1-1" href="ts3server://voice.dotanoobs.com"><i class="uk-icon-microphone"></i> Connect</a>
  45. <a class="uk-button uk-width-1-1 uk-margin" href="{{ url_for('teamspeak') }}"><i class="uk-icon-globe"></i> Stats</a>
  46. <a class="uk-button uk-width-1-1" href="http://www.teamspeak.com/?page=downloads"><i class="uk-icon-download"></i> Download</a>
  47. <div id="tsviewer" class="uk-modal uk-text-left">
  48. <div class="uk-modal-dialog">
  49. <a class="uk-modal-close uk-close"></a>
  50. {{ ts3_viewer() | safe }}
  51. </div>
  52. </div>
  53. </div>
  54. <div id="streams" class="uk-width-1-1 uk-text-center uk-panel uk-panel-space">
  55. </div>
  56. <div class="uk-width-1-1 uk-panel uk-panel-header">
  57. <h4 class="uk-panel-title">News and Announcements</h4>
  58. {% for news in latest_news %}
  59. <article class="uk-article dn-news-article">
  60. <h4 class="uk-article-title" title="{{ news['title'] }}"><a href="{{ news['url'] }}">{{ news['title'] }}</a></h4>
  61. <p class="uk-article-meta">{{ news['date'] }}</p>
  62. <p>{{ news['text'] | shorten }}</p>
  63. </article>
  64. {% endfor %}
  65. </div>
  66. </div>
  67. {#{% endcache %}#}
  68. {% endblock %}
  69. {% block pagescripts %}
  70. <script>
  71. {% cache 60*5 %}
  72. $(document).ready(function() {
  73. // Add the streams
  74. var stream_url = "https://api.twitch.tv/kraken/streams/";
  75. var channels = ["dotanoobs", "bearhugdota", "kreejaffakree", "prettypenguins", "shaneomad"];
  76. for (var idx in channels) {
  77. $.getJSON(stream_url+channels[idx]+"?callback=?", function(data) {
  78. if (data.stream) {
  79. var $a = $("<a href='"+data.stream.channel.url+"'></a>");
  80. var $strm = $("<div class='dn-streamer uk-text-success uk-panel uk-panel-box' id='"+data.stream.channel.name+"'></div>");
  81. $strm.append("<p class='uk-text-bold'>" + data.stream.channel.display_name + "</p>");
  82. $strm.append("<img src='" + data.stream.preview.small + "' />");
  83. $strm.append("<p><i class='uk-icon-male'></i> "+data.stream.viewers+"</p>");
  84. $a.append($strm);
  85. $("#streams").prepend($a);
  86. } else {
  87. $.getJSON(data._links.channel+"?callback=?", function(data) {
  88. var $a = $("<a href='"+data.url+"'></a>");
  89. var $strm = $("<div class='dn-streamer-offline uk-text-success uk-panel uk-panel-box' id='"+data.name+"'></div>");
  90. $strm.append("<p class='uk-text-bold'>" + data.display_name + "</p>");
  91. $strm.append("<img src='" + data.logo + "' />");
  92. $strm.append("<p class='dn-offline'>Offline</p>");
  93. $a.append($strm);
  94. $("#streams").append($a);
  95. });
  96. }
  97. });
  98. }
  99. {% endcache %}
  100. $(".dn-streamer, .dn-streamer-offline").on({
  101. mouseover: function() {
  102. $(this).addClass('dn-streamer-hover');
  103. },
  104. mouseleave: function() {
  105. $(this).removeClass('dn-streamer-hover');
  106. }
  107. }, "div");
  108. // Localize the events
  109. $('.date').each( function( index ) {
  110. var d = new Date($(this).text());
  111. $(this).text( d.toLocaleDateString() + ' @ ' + d.toLocaleTimeString() );
  112. });
  113. });
  114. </script>
  115. {% endblock %}