e51119b23bcee0cf52275e153b8463c161e5e8b5

Author
TheEdgeOfClaw <openclaw@theedgeofrage.com>
Committer
GitHub <noreply@github.com>
Date

Message

Auto-focus input field in add video modal (#6)

Diff

 1diff --git a/assets/index.js b/assets/index.js
 2index 2425c7604404a1fcdd58afa2556f157146d00ffb..356878032b929548e555308effa8d2a8b53f310e 100644
 3--- a/assets/index.js
 4+++ b/assets/index.js
 5@@ -2,6 +2,15 @@ document.addEventListener("DOMContentLoaded", function() {
 6 	const searchInput = document.getElementById("video-search");
 7 	if (!searchInput) return;
 8 
 9+	const addVideoInput = document.querySelector("#add-video-modal input[name='video_id']");
10+	if (addVideoInput) {
11+		document.addEventListener("show.bs.modal", function (e) {
12+			if (e.target.id === "add-video-modal") {
13+				addVideoInput.focus();
14+			}
15+		});
16+	}
17+
18 	function performSearch() {
19 		const videoCards = Array.from(document.querySelectorAll(".video-card"));
20 		const query = searchInput.value.trim();