Skip to content

Commit 87079b0

Browse files
bazilinskyyclaude
andcommitted
add_video form: carry the video's length, limit the time inputs to it
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 3de0cbb commit 87079b0

1 file changed

Lines changed: 5 additions & 31 deletions

File tree

‎templates/add_video.html‎

Lines changed: 5 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
margin: 0; /* remove extra margin */
3434
overflow: hidden; /* prevent text overflow */
3535
}
36+
.hint { color: #666; font-size: 12px; margin-left: 6px; }
3637
.message {
3738
color: green;
3839
margin-top: 20px;
@@ -328,35 +329,6 @@
328329

329330
});
330331
</script>
331-
<style>
332-
html[data-theme=dark]{filter:invert(.9) hue-rotate(180deg);background:#fff}
333-
html[data-theme=dark] img,html[data-theme=dark] iframe,html[data-theme=dark] video,
334-
html[data-theme=dark] .leaflet-container,html[data-theme=dark] .locmap,html[data-theme=dark] .routemap
335-
{filter:invert(1) hue-rotate(180deg)}
336-
#theme{position:fixed;right:12px;bottom:12px;z-index:9999;padding:6px 10px;border:1px solid #bbb;border-radius:16px;
337-
background:#fff;color:#222;font-size:13px;cursor:pointer}
338-
</style>
339-
<script>
340-
// dark unless switched to light; a cookie, not localStorage: the hub and each review page run on their own port,
341-
// and cookies are shared across the ports of a host
342-
(function () {
343-
const m = document.cookie.match(/(?:^|; )theme=(dark|light)/);
344-
document.documentElement.dataset.theme = m ? m[1] : 'dark';
345-
addEventListener('DOMContentLoaded', () => {
346-
const b = document.createElement('button');
347-
b.id = 'theme';
348-
const label = () => { b.textContent = document.documentElement.dataset.theme === 'dark' ? '☀️ Light' : '🌙 Dark'; };
349-
b.onclick = () => {
350-
const t = document.documentElement.dataset.theme === 'dark' ? 'light' : 'dark';
351-
document.documentElement.dataset.theme = t;
352-
document.cookie = `theme=${t}; path=/; max-age=31536000; SameSite=Lax`;
353-
label();
354-
};
355-
label();
356-
document.body.appendChild(b);
357-
});
358-
})();
359-
</script>
360332
</head>
361333
<body>
362334
<div class="container">
@@ -657,6 +629,7 @@ <h3>{{ message | safe }}</h3>
657629
<input type="hidden" name="video_url" value="{{ video_url }}">
658630
<input type="hidden" name="yt_description" value="{{ yt_description }}">
659631
<input type="hidden" name="yt_upload_date" value="{{ yt_upload_date }}">
632+
<input type="hidden" name="video_length" value="{{ video_length or '' }}">
660633

661634
<div class="form-group">
662635
<label for="time_of_day">Time of day:</label>
@@ -696,12 +669,13 @@ <h3>{{ message | safe }}</h3>
696669
</div>
697670
<div class="form-group">
698671
<label for="start_time">Start time (seconds):</label>
699-
<input type="number" id="start_time" name="start_time" value="{{ start_time_input }}" required min="0" step="1">
672+
<input type="number" id="start_time" name="start_time" value="{{ start_time_input }}" required min="0" step="1"{% if video_length %} max="{{ video_length - 1 }}"{% endif %}>
700673
</div>
701674

702675
<div class="form-group">
703676
<label for="end_time">End time (seconds):</label>
704-
<input type="number" id="end_time" name="end_time" value="{{ end_time_input }}" required min="1" step="1">
677+
<input type="number" id="end_time" name="end_time" value="{{ end_time_input }}" required min="1" step="1"{% if video_length %} max="{{ video_length }}"{% endif %}>
678+
{% if video_length %}<span class="hint">video: {{ video_length }} s</span>{% endif %}
705679
</div>
706680

707681
<div class="form-group">

0 commit comments

Comments
 (0)