channel.html 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. {% if current_tab == 'search' %}
  2. {% set page_title = search_box_value + ' - Page ' + page_number|string %}
  3. {% else %}
  4. {% set page_title = channel_name|string + ' - Channel' %}
  5. {% endif %}
  6. {% extends "base.html" %}
  7. {% import "common_elements.html" as common_elements %}
  8. {% block style %}
  9. <link href="/youtube.com/static/message_box.css" rel="stylesheet">
  10. <link href="/youtube.com/static/channel.css" rel="stylesheet">
  11. {% endblock style %}
  12. {% block main %}
  13. <div class="author-container">
  14. <div class="author">
  15. <img alt="{{ channel_name }}" src="{{ avatar }}">
  16. <h2>{{ channel_name }}</h2>
  17. </div>
  18. <div class="summary">
  19. <p>{{ short_description }}</p>
  20. </div>
  21. <div class="subscribe">
  22. <form method="POST" action="/youtube.com/subscriptions" class="subscribe-unsubscribe">
  23. <input class="btn-subscribe" type="submit" value="{{ 'Unsubscribe' if subscribed else 'Subscribe' }}">
  24. <input type="hidden" name="channel_id" value="{{ channel_id }}">
  25. <input type="hidden" name="channel_name" value="{{ channel_name }}">
  26. <input type="hidden" name="action" value="{{ 'unsubscribe' if subscribed else 'subscribe' }}">
  27. </form>
  28. </div>
  29. </div>
  30. <hr/>
  31. <nav class="channel-tabs">
  32. {% for tab_name in ('Videos', 'Shorts', 'Streams', 'Playlists', 'About') %}
  33. {% if tab_name.lower() == current_tab %}
  34. <a class="tab page-button">{{ tab_name }}</a>
  35. {% else %}
  36. <a class="tab page-button" href="{{ channel_url + '/' + tab_name.lower() }}">{{ tab_name }}</a>
  37. {% endif %}
  38. {% endfor %}
  39. <form class="channel-search" action="{{ channel_url + '/search' }}">
  40. <input type="search" name="query" class="search-box" value="{{ search_box_value }}">
  41. <button type="submit" value="Search" class="search-button">Search</button>
  42. </form>
  43. </nav>
  44. {% if current_tab == 'about' %}
  45. <div class="channel-info">
  46. <ul>
  47. {% for (before_text, stat, after_text) in [
  48. ('Joined ', date_joined, ''),
  49. ('', approx_view_count, ' views'),
  50. ('', approx_subscriber_count, ' subscribers'),
  51. ('', approx_video_count, ' videos'),
  52. ('Country: ', country, ''),
  53. ('Canonical Url: ', canonical_url, ''),
  54. ] %}
  55. {% if stat %}
  56. <li>{{ before_text + stat|string + after_text }}</li>
  57. {% endif %}
  58. {% endfor %}
  59. </ul>
  60. <hr>
  61. <h3>Description</h3>
  62. <div class="description">{{ common_elements.text_runs(description) }}</div>
  63. <hr>
  64. <ul>
  65. {% for text, url in links %}
  66. {% if url %}
  67. <li><a href="{{ url }}">{{ text }}</a></li>
  68. {% else %}
  69. <li>{{ text }}</li>
  70. {% endif %}
  71. {% endfor %}
  72. </ul>
  73. </div>
  74. {% else %}
  75. <!-- new-->
  76. <div id="links-metadata">
  77. {% if current_tab in ('videos', 'shorts', 'streams') %}
  78. {% set sorts = [('1', 'views'), ('2', 'oldest'), ('3', 'newest'), ('4', 'newest - no shorts'),] %}
  79. <div id="number-of-results">{{ number_of_videos }} videos</div>
  80. {% elif current_tab == 'playlists' %}
  81. {% set sorts = [('2', 'oldest'), ('3', 'newest'), ('4', 'last video added')] %}
  82. {% if items %}
  83. <h2 class="page-number">Page {{ page_number }}</h2>
  84. {% else %}
  85. <h2 class="page-number">No items</h2>
  86. {% endif %}
  87. {% elif current_tab == 'search' %}
  88. {% if items %}
  89. <h2 class="page-number">Page {{ page_number }}</h2>
  90. {% else %}
  91. <h2 class="page-number">No results</h2>
  92. {% endif %}
  93. {% else %}
  94. {% set sorts = [] %}
  95. {% endif %}
  96. {% for sort_number, sort_name in sorts %}
  97. {% if sort_number == current_sort.__str__() %}
  98. <a class="sort-button">{{ 'Sorted by ' + sort_name }}</a>
  99. {% else %}
  100. <a class="sort-button" href="{{ channel_url + '/' + current_tab + '?sort=' + sort_number }}">{{ 'Sort by ' + sort_name }}</a>
  101. {% endif %}
  102. {% endfor %}
  103. </div>
  104. <div class="video-container {{ current_tab + '-content'}}">
  105. {% for item_info in items %}
  106. {{ common_elements.item(item_info, include_author=false) }}
  107. {% endfor %}
  108. </div>
  109. <hr/>
  110. <footer class="pagination-container">
  111. {% if current_tab in ('videos', 'shorts', 'streams') %}
  112. <nav class="pagination-list">
  113. {{ common_elements.page_buttons(number_of_pages, channel_url + '/' + current_tab, parameters_dictionary, include_ends=(current_sort.__str__() in '34')) }}
  114. </nav>
  115. {% elif current_tab == 'playlists' or current_tab == 'search' %}
  116. <nav class="next-previous-button-row">
  117. {{ common_elements.next_previous_buttons(is_last_page, channel_url + '/' + current_tab, parameters_dictionary) }}
  118. </nav>
  119. {% endif %}
  120. </footer>
  121. <!-- /new-->
  122. {% endif %}
  123. {% endblock main %}