From 2db58930a6f8c955c4d437657bd07e2939a705f2 Mon Sep 17 00:00:00 2001 From: James Taylor Date: Sun, 16 Jun 2019 16:16:03 -0700 Subject: Convert watch page to flask framework --- youtube/templates/error.html | 17 ++++ youtube/templates/watch.html | 222 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 239 insertions(+) create mode 100644 youtube/templates/error.html create mode 100644 youtube/templates/watch.html (limited to 'youtube/templates') diff --git a/youtube/templates/error.html b/youtube/templates/error.html new file mode 100644 index 0000000..f253807 --- /dev/null +++ b/youtube/templates/error.html @@ -0,0 +1,17 @@ + + + + + Error + + + + + + +{{ header|safe }} +
+{{ error_message }} +
+ + diff --git a/youtube/templates/watch.html b/youtube/templates/watch.html new file mode 100644 index 0000000..7e83306 --- /dev/null +++ b/youtube/templates/watch.html @@ -0,0 +1,222 @@ + + + + + {{ title }} + + + + + + + +{{ header|safe }} +
+
+
+
+ + + +

{{ title }}

+{% if unlisted %} + Unlisted +{% endif %} +
Uploaded by {{ uploader }}
+ {{ views }} views + + + + +
+ +
+{% for format in download_formats %} + + {{ format['ext'] }} + {{ format['resolution'] }} + {{ format['note'] }} + +{% endfor %} +
+
+ + + {{ description }} +
+{{ music_list|safe }} +
+{{ comments|safe }} +
+ + + + + + +
+ + + + + + + -- cgit v1.2.3 From 1ba241186299df50a94efd3d410a4422bdc2d6c3 Mon Sep 17 00:00:00 2001 From: James Taylor Date: Mon, 17 Jun 2019 20:47:58 -0700 Subject: Inherit from base template --- youtube/templates/base.html | 111 +++++++++++++++++++++++++++++++++++++++++++ youtube/templates/error.html | 25 ++++------ youtube/templates/watch.html | 30 +++--------- 3 files changed, 126 insertions(+), 40 deletions(-) create mode 100644 youtube/templates/base.html (limited to 'youtube/templates') diff --git a/youtube/templates/base.html b/youtube/templates/base.html new file mode 100644 index 0000000..e98f972 --- /dev/null +++ b/youtube/templates/base.html @@ -0,0 +1,111 @@ + + + + + {% block page_title %}{% endblock %} + + + + + + + +
+ + +
+
+ + + {% for playlist_name in header_playlist_names %} + + {% endfor %} + + + +
+ Local playlists +
+
+
+{% block main %} +{% endblock %} +
+ + diff --git a/youtube/templates/error.html b/youtube/templates/error.html index f253807..1f33c44 100644 --- a/youtube/templates/error.html +++ b/youtube/templates/error.html @@ -1,17 +1,8 @@ - - - - - Error - - - - - - -{{ header|safe }} -
-{{ error_message }} -
- - +{% extends "base.html" %} + +{% block page_title %}Error{% endblock %} + +{% block main %} + {{ error_message }} +{% endblock %} + diff --git a/youtube/templates/watch.html b/youtube/templates/watch.html index 7e83306..f00413d 100644 --- a/youtube/templates/watch.html +++ b/youtube/templates/watch.html @@ -1,13 +1,6 @@ - - - - - {{ title }} - - - - - - - -{{ header|safe }} -
+{% endblock style %} + +{% block main %}
@@ -212,11 +203,4 @@ {{ related|safe }} -
- - - - - - - +{% endblock main %} -- cgit v1.2.3 From 1156b0998758ee803c7e8ae0cc2beb5181c232a3 Mon Sep 17 00:00:00 2001 From: James Taylor Date: Fri, 21 Jun 2019 21:41:41 -0700 Subject: Refactor search page --- youtube/templates/base.html | 4 +- youtube/templates/common_elements.html | 152 +++++++++++++++++++++++++++++++++ youtube/templates/search.html | 54 ++++++++++++ 3 files changed, 209 insertions(+), 1 deletion(-) create mode 100644 youtube/templates/common_elements.html create mode 100644 youtube/templates/search.html (limited to 'youtube/templates') diff --git a/youtube/templates/base.html b/youtube/templates/base.html index e98f972..eafd369 100644 --- a/youtube/templates/base.html +++ b/youtube/templates/base.html @@ -2,13 +2,14 @@ - {% block page_title %}{% endblock %} + {% block page_title %}{{ title }}{% endblock %} @@ -105,6 +106,7 @@
{% block main %} +{{ main }} {% endblock %}
diff --git a/youtube/templates/common_elements.html b/youtube/templates/common_elements.html new file mode 100644 index 0000000..9f2aa3f --- /dev/null +++ b/youtube/templates/common_elements.html @@ -0,0 +1,152 @@ +{% macro text_runs(runs) %} + {%- if runs[0] is mapping -%} + {%- for text_run in runs -%} + {%- if text_run.get("bold", false) -%} + {{ text_run["text"] }} + {%- elif text_run.get('italics', false) -%} + {{ text_run["text"] }} + {%- else -%} + {{ text_run["text"] }} + {%- endif -%} + {%- endfor -%} + {%- else -%} + {{ runs }} + {%- endif -%} +{% endmacro %} + +{% macro small_item(info) %} +
+
+ {% if info['type'] == 'video' %} + + + {{ info['duration'] }} + + {{ info['title'] }} + +
{{ info['author'] }}
+ {{ info['views'] }} + + {% elif info['type'] == 'playlist' %} + + +
+ {{ info['size'] }} +
+
+ {{ info['title'] }} + +
{{ info['author'] }}
+ {% else %} + Error: unsupported item type + {% endif %} +
+ {% if info['type'] == 'video' %} + + {% endif %} +
+{% endmacro %} + +{% macro get_stats(info) %} + {% if 'author_url' is in(info) %} +
By {{ info['author'] }}
+ {% else %} +
{{ info['author'] }}
+ {% endif %} + {% if 'views' is in(info) %} + {{ info['views'] }} + {% endif %} + {% if 'published' is in(info) %} + + {% endif %} +{% endmacro %} + + + +{% macro medium_item(info) %} +
+
+ {% if info['type'] == 'video' %} + + + {{ info['duration'] }} + + + {{ info['title'] }} + +
+ {{ get_stats(info) }} +
+ + {{ text_runs(info['description']) }} + {{ info['badges']|join(' | ') }} + {% elif info['type'] == 'playlist' %} + + +
+ {{ info['size'] }} +
+
+ + {{ info['title'] }} + +
+ {{ get_stats(info) }} +
+ {% elif info['type'] == 'channel' %} + + + + + {{ info['title'] }} + + {{ info['subscriber_count'] }} + {{ info['size'] }} + + {{ text_runs(info['description']) }} + {% else %} + Error: unsupported item type + {% endif %} +
+ {% if info['type'] == 'video' %} + + {% endif %} +
+{% endmacro %} + + +{% macro item(info) %} + {% if info['item_size'] == 'small' %} + {{ small_item(info) }} + {% elif info['item_size'] == 'medium' %} + {{ medium_item(info) }} + {% else %} + Error: Unknown item size + {% endif %} +{% endmacro %} + + + +{% macro page_buttons(estimated_pages, url, parameters_dictionary) %} + {% set current_page = parameters_dictionary.get('page', 1)|int %} + {% set parameters_dictionary = parameters_dictionary.to_dict() %} + {% if current_page is le(5) %} + {% set page_start = 1 %} + {% set page_end = [9, estimated_pages]|min %} + {% else %} + {% set page_start = current_page - 4 %} + {% set page_end = [current_page + 4, estimated_pages]|min %} + {% endif %} + + {% for page in range(page_start, page_end+1) %} + {% if page == current_page %} +
{{ page }}
+ {% else %} + {# IMPORTANT: Jinja SUCKS #} + {# https://stackoverflow.com/questions/36886650/how-to-add-a-new-entry-into-a-dictionary-object-while-using-jinja2 #} + {% set _ = parameters_dictionary.__setitem__('page', page) %} + {{ page }} + {% endif %} + {% endfor %} + +{% endmacro %} diff --git a/youtube/templates/search.html b/youtube/templates/search.html new file mode 100644 index 0000000..1086cfd --- /dev/null +++ b/youtube/templates/search.html @@ -0,0 +1,54 @@ +{% set search_box_value = query %} +{% extends "base.html" %} +{% block page_title %}{{ query + ' - Search' }}{% endblock %} +{% import "common_elements.html" as common_elements %} +{% block style %} + main{ + display:grid; + grid-template-columns: minmax(0px, 1fr) 800px minmax(0px,2fr); + max-width:100vw; + } + + + #number-of-results{ + font-weight:bold; + } + #result-info{ + grid-row: 1; + grid-column:2; + align-self:center; + } + .page-button-row{ + grid-column: 2; + justify-self: center; + } + + + .item-list{ + grid-row: 2; + grid-column: 2; + } + .badge{ + background-color:#cccccc; + } +{% endblock style %} + +{% block main %} +
+
Approximately {{ '{:,}'.format(estimated_results) }} results ({{ '{:,}'.format(estimated_pages) }} pages)
+{% if corrections['type'] == 'showing_results_for' %} +
Showing results for {{ corrections['corrected_query']|safe }}
+
Search instead for {{ corrections['original_query'] }}
+{% elif corrections['type'] == 'did_you_mean' %} +
Did you mean {{ corrections['corrected_query']|safe }}
+{% endif %} +
+
+ {% for info in results %} + {{ common_elements.item(info) }} + {% endfor %} +
+ +{% endblock main %} -- cgit v1.2.3 From 02962df0526cf265965c442bf9a261ceba55864e Mon Sep 17 00:00:00 2001 From: James Taylor Date: Fri, 21 Jun 2019 21:59:33 -0700 Subject: Refactor watch page related videos to use item rendering macro --- youtube/templates/watch.html | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'youtube/templates') diff --git a/youtube/templates/watch.html b/youtube/templates/watch.html index f00413d..122958c 100644 --- a/youtube/templates/watch.html +++ b/youtube/templates/watch.html @@ -1,4 +1,5 @@ {% extends "base.html" %} +{% import "common_elements.html" as common_elements %} {% block page_title %}{{ title }}{% endblock %} {% block style %} main{ @@ -200,7 +201,9 @@ {% endblock main %} -- cgit v1.2.3 From d105d4520ff0bf529cfb18c9c16a22900ab7f481 Mon Sep 17 00:00:00 2001 From: James Taylor Date: Thu, 4 Jul 2019 18:08:14 -0700 Subject: Convert playlist page to flask framework --- youtube/templates/playlist.html | 106 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 106 insertions(+) create mode 100644 youtube/templates/playlist.html (limited to 'youtube/templates') diff --git a/youtube/templates/playlist.html b/youtube/templates/playlist.html new file mode 100644 index 0000000..09e382b --- /dev/null +++ b/youtube/templates/playlist.html @@ -0,0 +1,106 @@ +{% extends "base.html" %} +{% block page_title %}{{ title + ' - Page ' + parameters_dictionary.get('page', '1') }}{% endblock %} +{% import "common_elements.html" as common_elements %} +{% block style %} + main{ + display:grid; + grid-template-columns: 3fr 1fr; + } + + + + #left{ + grid-column: 1; + grid-row: 1; + + display: grid; + grid-template-columns: 1fr 800px; + grid-template-rows: 0fr 1fr 0fr; + } + .playlist-metadata{ + grid-column:2; + grid-row:1; + + display:grid; + grid-template-columns: 0fr 1fr; + } + .playlist-thumbnail{ + grid-row: 1 / span 5; + grid-column:1; + justify-self:start; + width:250px; + margin-right: 10px; + } + .playlist-title{ + grid-row: 1; + grid-column:2; + } + .playlist-author{ + grid-row:2; + grid-column:2; + } + .playlist-stats{ + grid-row:3; + grid-column:2; + } + + .playlist-description{ + grid-row:4; + grid-column:2; + min-width:0px; + white-space: pre-line; + } + .page-button-row{ + grid-row: 3; + grid-column: 2; + justify-self: center; + } + + + #right{ + grid-column: 2; + grid-row: 1; + + } + #results{ + + grid-row: 2; + grid-column: 2; + margin-top:10px; + + display: grid; + grid-auto-rows: 0fr; + grid-row-gap: 10px; + + } +{% endblock style %} + +{% block main %} +
+ + +
+ {% for info in video_list %} + {{ common_elements.item(info) }} + {% endfor %} +
+ +
+{% endblock main %} + + + + + + -- cgit v1.2.3 From 315039bebd8d47820e3c0baeb7ac258db6741582 Mon Sep 17 00:00:00 2001 From: James Taylor Date: Thu, 4 Jul 2019 18:20:51 -0700 Subject: common_elements.html: accept missing description as blank --- youtube/templates/common_elements.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'youtube/templates') diff --git a/youtube/templates/common_elements.html b/youtube/templates/common_elements.html index 9f2aa3f..b140332 100644 --- a/youtube/templates/common_elements.html +++ b/youtube/templates/common_elements.html @@ -78,7 +78,7 @@ {{ get_stats(info) }} - {{ text_runs(info['description']) }} + {{ text_runs(info.get('description', '')) }} {{ info['badges']|join(' | ') }} {% elif info['type'] == 'playlist' %} -- cgit v1.2.3 From 64434b02ca50c2a6324caa1355559bd881ba687e Mon Sep 17 00:00:00 2001 From: James Taylor Date: Sat, 6 Jul 2019 18:36:09 -0700 Subject: Convert channel page to flask framework --- youtube/templates/channel.html | 144 +++++++++++++++++++++++++++++++++ youtube/templates/common_elements.html | 26 +++--- 2 files changed, 158 insertions(+), 12 deletions(-) create mode 100644 youtube/templates/channel.html (limited to 'youtube/templates') diff --git a/youtube/templates/channel.html b/youtube/templates/channel.html new file mode 100644 index 0000000..8a3f279 --- /dev/null +++ b/youtube/templates/channel.html @@ -0,0 +1,144 @@ +{% extends "base.html" %} +{% block page_title %}{{ channel_name + ' - Channel' }}{% endblock %} +{% import "common_elements.html" as common_elements %} +{% block style %} + main{ + display:grid; +{% if current_tab == 'about' %} + grid-template-rows: 0fr 0fr 1fr; + grid-template-columns: 0fr 1fr; +{% else %} + grid-template-rows: repeat(5, 0fr); + grid-template-columns: auto 1fr; +{% endif %} + } + main .avatar{ + grid-row:1; + grid-column:1; + height:200px; + width:200px; + } + main .title{ + grid-row:1; + grid-column:2; + } + main .channel-tabs{ + grid-row:2; + grid-column: 1 / span 2; + + display:grid; + grid-auto-flow: column; + justify-content:start; + + background-color: #aaaaaa; + padding: 3px; + } + #links-metadata{ + display: grid; + grid-auto-flow: column; + grid-column-gap: 10px; + grid-column: 1/span 2; + justify-content: start; + padding-top: 8px; + padding-bottom: 8px; + background-color: #bababa; + margin-bottom: 10px; + } + #number-of-results{ + font-weight:bold; + } + .item-grid{ + grid-row:4; + grid-column: 1 / span 2; + } + .item-list{ + width:1000px; + grid-column: 1 / span 2; + } + .page-button-row{ + grid-column: 1 / span 2; + } + .tab{ + padding: 5px 75px; + } + main .channel-info{ + grid-row: 3; + grid-column: 1 / span 3; + } + .description{ + white-space: pre-wrap; + min-width: 0; + + } +{% endblock style %} + +{% block main %} + +

{{ channel_name }}

+
+ {% if current_tab == 'about' %} +
+
    + {% for stat in stats %} +
  • {{ stat }}
  • + {% endfor %} +
+
+

Description

+ {{ common_elements.text_runs(description) }} +
+
    + {% for text, url in links %} +
  • {{ text }}
  • + {% endfor %} +
+
+ {% else %} + + + {% if current_tab != 'about' %} + + + {% if current_tab != 'playlists' %} + + {% endif %} + {% endif %} + + {% endif %} +{% endblock main %} diff --git a/youtube/templates/common_elements.html b/youtube/templates/common_elements.html index b140332..0843c4b 100644 --- a/youtube/templates/common_elements.html +++ b/youtube/templates/common_elements.html @@ -14,7 +14,7 @@ {%- endif -%} {% endmacro %} -{% macro small_item(info) %} +{% macro small_item(info, include_author=true) %}
{% if info['type'] == 'video' %} @@ -47,11 +47,13 @@
{% endmacro %} -{% macro get_stats(info) %} - {% if 'author_url' is in(info) %} -
By {{ info['author'] }}
- {% else %} -
{{ info['author'] }}
+{% macro get_stats(info, include_author=true) %} + {% if include_author %} + {% if 'author_url' is in(info) %} +
By {{ info['author'] }}
+ {% else %} +
{{ info['author'] }}
+ {% endif %} {% endif %} {% if 'views' is in(info) %} {{ info['views'] }} @@ -63,7 +65,7 @@ -{% macro medium_item(info) %} +{% macro medium_item(info, include_author=true) %}
{% if info['type'] == 'video' %} @@ -75,7 +77,7 @@ {{ info['title'] }}
- {{ get_stats(info) }} + {{ get_stats(info, include_author) }}
{{ text_runs(info.get('description', '')) }} @@ -91,7 +93,7 @@ {{ info['title'] }}
- {{ get_stats(info) }} + {{ get_stats(info, include_author) }}
{% elif info['type'] == 'channel' %} @@ -115,11 +117,11 @@ {% endmacro %} -{% macro item(info) %} +{% macro item(info, include_author=true) %} {% if info['item_size'] == 'small' %} - {{ small_item(info) }} + {{ small_item(info, include_author) }} {% elif info['item_size'] == 'medium' %} - {{ medium_item(info) }} + {{ medium_item(info, include_author) }} {% else %} Error: Unknown item size {% endif %} -- cgit v1.2.3 From 6261add37de1800c90b0942a77cca99baf0b1973 Mon Sep 17 00:00:00 2001 From: James Taylor Date: Sat, 6 Jul 2019 23:08:04 -0700 Subject: Convert local_playlist to flask framework --- youtube/templates/local_playlist.html | 57 +++++++++++++++++++++++++++++ youtube/templates/local_playlists_list.html | 16 ++++++++ 2 files changed, 73 insertions(+) create mode 100644 youtube/templates/local_playlist.html create mode 100644 youtube/templates/local_playlists_list.html (limited to 'youtube/templates') diff --git a/youtube/templates/local_playlist.html b/youtube/templates/local_playlist.html new file mode 100644 index 0000000..27928df --- /dev/null +++ b/youtube/templates/local_playlist.html @@ -0,0 +1,57 @@ +{% extends "base.html" %} +{% block page_title %}{{ playlist_name + ' - Local playlist' }}{% endblock %} +{% import "common_elements.html" as common_elements %} +{% block style %} + main{ + display:grid; + grid-template-columns: 3fr 1fr; + } + + + + #left{ + grid-column: 1; + grid-row: 1; + + display: grid; + grid-template-columns: 1fr 800px auto; + grid-template-rows: 0fr 1fr 0fr; + } + .playlist-title{ + grid-column:2; + } + #playlist-remove-button{ + grid-column:3; + align-self: center; + white-space: nowrap; + } + #results{ + + grid-row: 2; + grid-column: 2 / span 2; + + + display: grid; + grid-auto-rows: 0fr; + grid-row-gap: 10px; + + } + .page-button-row{ + grid-row: 3; + grid-column: 2; + justify-self: center; + } +{% endblock style %} + +{% block main %} +
+

{{ playlist_name }}

+ + +
+ {% for video_info in videos %} + {{ common_elements.item(video_info) }} + {% endfor %} +
+
+{% endblock main %} diff --git a/youtube/templates/local_playlists_list.html b/youtube/templates/local_playlists_list.html new file mode 100644 index 0000000..269c151 --- /dev/null +++ b/youtube/templates/local_playlists_list.html @@ -0,0 +1,16 @@ +{% extends "base.html" %} +{% block page_title %}Local playlists{% endblock %} + +{% block main %} +
+{% endblock main %} + + + + + + -- cgit v1.2.3 From b89d90a0d35a239ee4eb476eaf5e2d3404fe65ea Mon Sep 17 00:00:00 2001 From: James Taylor Date: Sun, 7 Jul 2019 17:29:25 -0700 Subject: watch_page: refactor music list into flask template --- youtube/templates/watch.html | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'youtube/templates') diff --git a/youtube/templates/watch.html b/youtube/templates/watch.html index 122958c..85c87ae 100644 --- a/youtube/templates/watch.html +++ b/youtube/templates/watch.html @@ -185,14 +185,31 @@ {{ format['resolution'] }} {{ format['note'] }} -{% endfor %} +{% endfor %}
{{ description }}
-{{ music_list|safe }} + {% if music_list.__len__() != 0 %} +
+ + + + {% for attribute in music_attributes %} + + {% endfor %} + + {% for track in music_list %} + + {% for attribute in music_attributes %} + + {% endfor %} + + {% endfor %} +
Music
{{ attribute }}
{{ track.get(attribute.lower(), '') }}
+ {% endif %}
{{ comments|safe }} -- cgit v1.2.3 From 728b2b73d49d9112b8874783e038d901244dd7d8 Mon Sep 17 00:00:00 2001 From: James Taylor Date: Sun, 7 Jul 2019 17:32:11 -0700 Subject: common_elements.html: Accept missing channel description as blank --- youtube/templates/common_elements.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'youtube/templates') diff --git a/youtube/templates/common_elements.html b/youtube/templates/common_elements.html index 0843c4b..a6921e1 100644 --- a/youtube/templates/common_elements.html +++ b/youtube/templates/common_elements.html @@ -105,7 +105,7 @@ {{ info['subscriber_count'] }} {{ info['size'] }} - {{ text_runs(info['description']) }} + {{ text_runs(info.get('description', '')) }} {% else %} Error: unsupported item type {% endif %} -- cgit v1.2.3 From 8cad77ad0d7e0a0d07629087e2ee1709688cb58d Mon Sep 17 00:00:00 2001 From: James Taylor Date: Fri, 19 Jul 2019 22:27:10 -0700 Subject: Convert comments to flask framework --- youtube/templates/comments.html | 47 ++++++++++++++++++++ youtube/templates/comments_page.html | 83 ++++++++++++++++++++++++++++++++++++ youtube/templates/watch.html | 6 ++- 3 files changed, 135 insertions(+), 1 deletion(-) create mode 100644 youtube/templates/comments.html create mode 100644 youtube/templates/comments_page.html (limited to 'youtube/templates') diff --git a/youtube/templates/comments.html b/youtube/templates/comments.html new file mode 100644 index 0000000..901190f --- /dev/null +++ b/youtube/templates/comments.html @@ -0,0 +1,47 @@ +{% import "common_elements.html" as common_elements %} + +{% macro render_comment(comment, include_avatar) %} +
+
+ + {% if include_avatar %} + + {% endif %} + +
+ {{ comment['author'] }} +
+ + {{ common_elements.text_runs(comment['text']) }} + + +
+ {{ comment['view_replies_text'] }} + {% if 'delete_url' is in comment %} + Delete + {% endif %} +
+
+ +
+{% endmacro %} + +{% macro video_comments(comments_info) %} +
+ +
+ {% for comment in comments_info['comments'] %} + {{ render_comment(comment, comments_info['include_avatars']) }} + {% endfor %} +
+ {% if 'more_comments_url' is in comments_info %} + More comments + {% endif %} +
+{% endmacro %} diff --git a/youtube/templates/comments_page.html b/youtube/templates/comments_page.html new file mode 100644 index 0000000..a77d2b4 --- /dev/null +++ b/youtube/templates/comments_page.html @@ -0,0 +1,83 @@ +{% extends "base.html" %} +{% import "comments.html" as comments %} + +{% block page_title %}{{ 'Replies' if comments_info['is_replies'] else 'Comments page ' + comments_info['page_number'] }}{% endblock %} + + +{% block style %} + main{ + display:grid; + grid-template-columns: 3fr 2fr; + } + #left{ + background-color:#bcbcbc; + + display: grid; + grid-column: 1; + grid-row: 1; + grid-template-columns: 1fr 640px; + grid-template-rows: 0fr 0fr 0fr; + } + .comments-area{ + grid-column:2; + } + .comment{ + width:640px; + } +{% endblock style %} + + +{% block main %} +
+
+ {% if not comments_info['is_replies'] %} + + {% endif %} + + +
+
+ + + Add account +
+ + {% if include_video_id_input %} + + {% endif %} + +
+ + {% if not comments_info['is_replies'] %} + + {% endif %} + +
+ {% for comment in comments_info['comments'] %} + {{ comments.render_comment(comment, comments_info['include_avatars']) }} + {% endfor %} +
+ {% if 'more_comments_url' is in comments_info %} + More comments + {% endif %} +
+
+{% endblock main %} + + diff --git a/youtube/templates/watch.html b/youtube/templates/watch.html index 85c87ae..d61997f 100644 --- a/youtube/templates/watch.html +++ b/youtube/templates/watch.html @@ -1,5 +1,6 @@ {% extends "base.html" %} {% import "common_elements.html" as common_elements %} +{% import "comments.html" as comments %} {% block page_title %}{{ title }}{% endblock %} {% block style %} main{ @@ -211,7 +212,10 @@ {% endif %}
-{{ comments|safe }} + + {% if comments_info %} + {{ comments.video_comments(comments_info) }} + {% endif %} -- cgit v1.2.3 From 167483af21fb252622170c4b5e3ae3ce81f58733 Mon Sep 17 00:00:00 2001 From: James Taylor Date: Sun, 21 Jul 2019 00:03:34 -0700 Subject: Convert login to flask framework and fix the login, and fix account display --- youtube/templates/comments_page.html | 2 +- youtube/templates/login.html | 60 ++++++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+), 1 deletion(-) create mode 100644 youtube/templates/login.html (limited to 'youtube/templates') diff --git a/youtube/templates/comments_page.html b/youtube/templates/comments_page.html index a77d2b4..302fcac 100644 --- a/youtube/templates/comments_page.html +++ b/youtube/templates/comments_page.html @@ -48,7 +48,7 @@ Add account diff --git a/youtube/templates/login.html b/youtube/templates/login.html new file mode 100644 index 0000000..49a5365 --- /dev/null +++ b/youtube/templates/login.html @@ -0,0 +1,60 @@ +{% extends "base.html" %} +{% block page_title %}Login{% endblock %} + +{% block style %} + main{ + display: grid; + grid-template-columns: minmax(0px, 3fr) 640px 40px 500px minmax(0px,2fr); + align-content: start; + grid-row-gap: 40px; + } + + main form{ + margin-top:20px; + grid-column:2; + display:grid; + justify-items: start; + align-content: start; + grid-row-gap: 10px; + } + + #username, #password{ + grid-column:2; + width: 250px; + } + #add-account-button{ + margin-top:20px; + } + #tor-note{ + grid-row:2; + grid-column:2; + background-color: #dddddd; + padding: 10px; + } +{% endblock style %} + +{% block main %} +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+ +
+
Note on using Tor to log in
+Using Tor to log in should only be done if the account was created using a proxy/VPN/Tor to begin with and hasn't been logged in using your IP. Otherwise, it's pointless since Google already knows who the account belongs to. When logging into a google account, it must be logged in using an IP address geographically close to the area where the account was created or where it is logged into regularly. If the account was created using an IP address in America and is logged into from an IP in Russia, Google will block the Russian IP from logging in, assume someone knows your password, lock the account, and make you change your password. If creating an account using Tor, you must remember the IP (or geographic region) it was created in, and only log in using that geographic region for the exit node. This can be accomplished by putting the desired IP in the torrc file to force Tor to use that exit node. Using the login cookie to post comments through Tor is perfectly safe, however. +
+{% endblock main %} + -- cgit v1.2.3 From fc295ac93d0ad6b0272aa94f2d2ea44002ecbc48 Mon Sep 17 00:00:00 2001 From: James Taylor Date: Sun, 21 Jul 2019 21:48:54 -0700 Subject: Convert comment posting system to flask framework --- youtube/templates/comments.html | 23 +++++++++++++++++++++++ youtube/templates/comments_page.html | 18 +----------------- youtube/templates/delete_comment.html | 26 ++++++++++++++++++++++++++ youtube/templates/post_comment.html | 30 ++++++++++++++++++++++++++++++ 4 files changed, 80 insertions(+), 17 deletions(-) create mode 100644 youtube/templates/delete_comment.html create mode 100644 youtube/templates/post_comment.html (limited to 'youtube/templates') diff --git a/youtube/templates/comments.html b/youtube/templates/comments.html index 901190f..82276b8 100644 --- a/youtube/templates/comments.html +++ b/youtube/templates/comments.html @@ -45,3 +45,26 @@ {% endif %} {% endmacro %} + +{% macro comment_posting_box(info) %} +
+
+ + + Add account +
+ + {% if info['include_video_id_input'] %} + + {% endif %} + +
+{% endmacro %} + + + + diff --git a/youtube/templates/comments_page.html b/youtube/templates/comments_page.html index 302fcac..c7947fa 100644 --- a/youtube/templates/comments_page.html +++ b/youtube/templates/comments_page.html @@ -42,23 +42,7 @@ {% endif %} - -
-
- - - Add account -
- - {% if include_video_id_input %} - - {% endif %} - -
+ {{ comments.comment_posting_box(comment_posting_box_info) }} {% if not comments_info['is_replies'] %} -
{{ description }}
+
{{ common_elements.text_runs(description) }}
-- cgit v1.2.3 From cb1c899a4570e8644dad572c7f00a3d96c844a2f Mon Sep 17 00:00:00 2001 From: James Taylor Date: Tue, 23 Jul 2019 22:55:15 -0700 Subject: channel: Add short description under channel name --- youtube/templates/channel.html | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'youtube/templates') diff --git a/youtube/templates/channel.html b/youtube/templates/channel.html index ffcf793..8293559 100644 --- a/youtube/templates/channel.html +++ b/youtube/templates/channel.html @@ -18,7 +18,7 @@ height:200px; width:200px; } - main .title{ + main .summary{ grid-row:1; grid-column:2; } @@ -77,7 +77,10 @@ {% block main %} -

{{ channel_name }}

+
+

{{ channel_name }}

+

{{ short_description }}

+
+ {% endblock main %} -- cgit v1.2.3