From 5554d5afff3e8bad1d59616c3e9c6f6f7bcd7b1b Mon Sep 17 00:00:00 2001 From: James Taylor Date: Sat, 4 Apr 2020 22:52:09 -0700 Subject: Add playlist sidebar for videos in playlist, including autoplay --- youtube/templates/common_elements.html | 8 +- youtube/templates/watch.html | 229 +++++++++++++++++++++++++++++---- 2 files changed, 212 insertions(+), 25 deletions(-) (limited to 'youtube/templates') diff --git a/youtube/templates/common_elements.html b/youtube/templates/common_elements.html index 58580a3..0587ce3 100644 --- a/youtube/templates/common_elements.html +++ b/youtube/templates/common_elements.html @@ -14,14 +14,18 @@ {%- endif -%} {% endmacro %} -{% macro item(info, description=false, horizontal=true, include_author=true, include_badges=true) %} +{% macro item(info, description=false, horizontal=true, include_author=true, include_badges=true, lazy_load=false) %}
{% if info['error'] %} {{ info['error'] }} {% else %}
- + {% if lazy_load %} + + {% else %} + + {% endif %} {% if info['type'] != 'channel' %}
{{ (info['video_count']|commatize + ' videos') if info['type'] == 'playlist' else info['duration'] }} diff --git a/youtube/templates/watch.html b/youtube/templates/watch.html index 27e1986..f47c337 100644 --- a/youtube/templates/watch.html +++ b/youtube/templates/watch.html @@ -37,7 +37,7 @@ margin-bottom: 10px; background-color: var(--video-background-color); } - .related-videos-outer{ + .side-videos{ grid-row: 2 /span 3; width: 400px; } @@ -50,7 +50,7 @@ width: 640px; grid-column: 2; } - .related-videos-outer{ + .side-videos{ grid-row: 1 /span 4; } {% endif %} @@ -183,20 +183,54 @@ .comment{ width:640px; } - .related-videos-outer{ + + .side-videos{ grid-column: 4; max-width: 640px; } - .related-videos-inner{ - padding-top: 10px; - display: grid; - grid-auto-rows: 90px; - grid-row-gap: 10px; - } - .thumbnail-box{ /* overides rule in shared.css */ - height: 90px !important; - width: 120px !important; + .playlist{ + border-style: solid; + border-width: 2px; + border-color: lightgray; + margin-bottom: 10px; + } + .playlist-header{ + background-color: var(--interface-color); + padding: 3px; + border-bottom-style: solid; + border-bottom-width: 2px; + border-bottom-color: lightgray; + } + .playlist-header h3{ + margin: 2px; + } + .playlist-metadata{ + list-style: none; + padding: 0px; + margin: 0px; + } + .playlist-metadata li{ + display: inline; + margin: 2px; + } + .playlist-videos{ + height: 300px; + overflow-y: scroll; + display: grid; + grid-auto-rows: 90px; + grid-row-gap: 10px; + padding-top: 10px; + } + .related-videos-inner{ + padding-top: 10px; + display: grid; + grid-auto-rows: 90px; + grid-row-gap: 10px; } + .thumbnail-box{ /* overides rule in shared.css */ + height: 90px !important; + width: 120px !important; + } /* Put related vids below videos when window is too small */ /* 1100px instead of 1080 because W3C is full of idiots who include scrollbar width */ @@ -204,7 +238,7 @@ main{ grid-template-columns: 1fr 640px 40px 1fr; } - .related-videos-outer{ + .side-videos{ margin-top: 10px; grid-column: 2; grid-row: 3; @@ -345,16 +379,165 @@
- {% if related_videos_mode != 0 %} - - {% endif %} +
+ {% if playlist %} +
+
+

{{ playlist['title'] }}

+ +
+ + {% if playlist['current_index'] is not none %} + + {% endif %} + {% if playlist['id'] is not none %} + + {% endif %} +
+ {% endif %} + + {% if related_videos_mode != 0 %} + + {% endif %} +
{% if comments_mode != 0 %} {% if comments_disabled %} -- cgit v1.2.3