Add setting to enable/disable video hotkeys

This commit is contained in:
James Taylor 2020-09-09 18:53:11 -07:00
parent 75171b7bd5
commit c2ca47c5d3
3 changed files with 16 additions and 10 deletions

View File

@ -108,6 +108,13 @@ For security reasons, enabling this is not recommended.''',
], ],
}), }),
('use_video_hotkeys', {
'label': 'Enable video hotkeys',
'type': bool,
'default': True,
'comment': '',
}),
('theme', { ('theme', {
'type': int, 'type': int,
'default': 0, 'default': 0,

View File

@ -48,7 +48,7 @@
width: 150px; width: 150px;
} }
{% if theater_mode %} {% if settings.theater_mode %}
video{ video{
grid-column: 1 / span 5; grid-column: 1 / span 5;
justify-self: center; justify-self: center;
@ -582,8 +582,8 @@ Reload without invidious (for usage of new identity button).</a>
</div> </div>
{% endif %} {% endif %}
{% if related_videos_mode != 0 %} {% if settings.related_videos_mode != 0 %}
<details class="related-videos-outer" {{'open' if related_videos_mode == 1 else ''}}> <details class="related-videos-outer" {{'open' if settings.related_videos_mode == 1 else ''}}>
<summary>Related Videos</summary> <summary>Related Videos</summary>
<nav class="related-videos-inner"> <nav class="related-videos-inner">
{% for info in related %} {% for info in related %}
@ -594,11 +594,11 @@ Reload without invidious (for usage of new identity button).</a>
{% endif %} {% endif %}
</div> </div>
{% if comments_mode != 0 %} {% if settings.comments_mode != 0 %}
{% if comments_disabled %} {% if comments_disabled %}
<div class="comments-area-outer comments-disabled">Comments disabled</div> <div class="comments-area-outer comments-disabled">Comments disabled</div>
{% else %} {% else %}
<details class="comments-area-outer" {{'open' if comments_mode == 1 else ''}}> <details class="comments-area-outer" {{'open' if settings.comments_mode == 1 else ''}}>
<summary>{{ comment_count|commatize }} comment{{'s' if comment_count != 1 else ''}}</summary> <summary>{{ comment_count|commatize }} comment{{'s' if comment_count != 1 else ''}}</summary>
<section class="comments-area-inner comments-area"> <section class="comments-area-inner comments-area">
{% if comments_info %} {% if comments_info %}
@ -608,6 +608,7 @@ Reload without invidious (for usage of new identity button).</a>
</details> </details>
{% endif %} {% endif %}
{% endif %} {% endif %}
{% if settings.use_video_hotkeys %}
<script src="/youtube.com/static/js/hotkeys.js"></script> <script src="/youtube.com/static/js/hotkeys.js"></script>
{% endif %}
{% endblock main %} {% endblock main %}

View File

@ -499,9 +499,7 @@ def get_watch_page(video_id=None):
comment_count = info['comment_count'], comment_count = info['comment_count'],
comments_disabled = info['comments_disabled'], comments_disabled = info['comments_disabled'],
theater_mode = settings.theater_mode, settings = settings,
related_videos_mode = settings.related_videos_mode,
comments_mode = settings.comments_mode,
video_height = video_height, video_height = video_height,
theater_video_target_width = theater_video_target_width, theater_video_target_width = theater_video_target_width,