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.

121 lines
5.0 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. {% set latest_news = get_latest_news() %}
  8. <div class="uk-grid">
  9. <div id="events_large" class="uk-width-1-2 uk-visible-large uk-panel uk-panel-space">
  10. {% include "events_widget.html" %}
  11. </div>
  12. <div id="teamspeak" class="uk-width-large-1-2 uk-width-medium-1-1 uk-panel uk-panel-box uk-text-center">
  13. <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>
  14. <h1 class="uk-panel-title">Teamspeak</h1>
  15. <div class="uk-grid uk-margin-bottom">
  16. <div class="uk-width-1-3 uk-panel">
  17. <h3>Users<br/><span class="ts_num">{{ ts3_current_clients() }}</span></h3>
  18. </div>
  19. <div class="uk-width-1-3 uk-panel">
  20. <h3 class="uk-text-success">Online</h3>
  21. </div>
  22. <div class="uk-width-1-3 uk-panel">
  23. <h3>Countries<br/><span class="ts_num">{{ ts3_countries_active(teamspeak_data) }}</span></h3>
  24. </div>
  25. </div>
  26. <a class="uk-button uk-button-success uk-width-1-1" href="ts3server://voice.dotanoobs.com"><i class="uk-icon-microphone"></i> Connect</a>
  27. <a class="uk-button uk-width-1-1 uk-margin" href="{{ url_for('teamspeak') }}"><i class="uk-icon-globe"></i> Stats</a>
  28. <a class="uk-button uk-width-1-1" href="http://www.teamspeak.com/?page=downloads"><i class="uk-icon-download"></i> Download</a>
  29. <div id="tsviewer" class="uk-modal uk-text-left">
  30. <div class="uk-modal-dialog">
  31. <a class="uk-modal-close uk-close"></a>
  32. {{ ts3_viewer() | safe }}
  33. </div>
  34. </div>
  35. </div>
  36. <div id="events_small" class="uk-width-1-1 uk-hidden-large uk-panel uk-panel-space">
  37. {% include "events_widget.html" %}
  38. </div>
  39. <div id="streams" class="uk-width-1-1 uk-text-center uk-panel">
  40. </div>
  41. <div class="uk-width-1-1 uk-panel uk-panel-header uk-panel-space">
  42. <h1 class="uk-panel-title">News and Announcements</h1>
  43. {% for news in latest_news %}
  44. <article class="uk-article dn-news-article">
  45. <h4 class="uk-article-title" title="{{ news['title'] }}"><a href="{{ news['url'] }}">{{ news['title'] }}</a></h4>
  46. <p class="uk-article-meta">{{ news['date'] }}</p>
  47. <p>{{ news['text'] | shorten }}</p>
  48. </article>
  49. {% endfor %}
  50. </div>
  51. </div>
  52. {% endcache %}
  53. {% endblock %}
  54. {% block pagescripts %}
  55. <script>
  56. $(document).ready(function() {
  57. if ($('#events_large > dl').length < 1) {
  58. var msg = "<h2>Events</h2><em>No events planned for the near future. Suggest one on the forum!</em>"
  59. $('#events_small').append(msg);
  60. $('#events_large').append(msg);
  61. }
  62. {% cache 60*5 %}
  63. // Add the streams
  64. var stream_url = "https://api.twitch.tv/kraken/streams/";
  65. var channels = ["dotanoobs", "bearhugdota", "kreejaffakree", "prettypenguins", "shaneomad"];
  66. for (var idx in channels) {
  67. $.getJSON(stream_url+channels[idx]+"?callback=?", function(data) {
  68. if (data.stream) {
  69. var $a = $("<a href='"+data.stream.channel.url+"'></a>");
  70. var $strm = $("<div class='dn-streamer uk-text-success uk-panel uk-panel-box' id='"+data.stream.channel.name+"'></div>");
  71. $strm.append("<p class='uk-text-bold'>" + data.stream.channel.display_name + "</p>");
  72. $strm.append("<img src='" + data.stream.preview.small + "' />");
  73. $strm.append("<p><i class='uk-icon-male'></i> "+data.stream.viewers+"</p>");
  74. $a.append($strm);
  75. $("#streams").prepend($a);
  76. } else {
  77. $.getJSON(data._links.channel+"?callback=?", function(data) {
  78. var $a = $("<a href='"+data.url+"'></a>");
  79. var $strm = $("<div class='dn-streamer-offline uk-text-success uk-panel uk-panel-box' id='"+data.name+"'></div>");
  80. $strm.append("<p class='uk-text-bold'>" + data.display_name + "</p>");
  81. $strm.append("<img src='" + data.logo + "' />");
  82. $strm.append("<p class='dn-offline'>Offline</p>");
  83. $a.append($strm);
  84. $("#streams").append($a);
  85. });
  86. }
  87. });
  88. }
  89. {% endcache %}
  90. $("#streams").on({
  91. mouseover: function() {
  92. $(this).addClass('dn-streamer-hover');
  93. },
  94. mouseleave: function() {
  95. $(this).removeClass('dn-streamer-hover');
  96. }
  97. }, "div");
  98. });
  99. </script>
  100. {% endblock %}