blob: 5936e6cab43985fe420147a6f174a964795bcea9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>home | mediasync</title>
<link rel="stylesheet" href="/static/main.css">
</head>
<body>
<form action="/host_room" method="post">
<input name="_csrf_token" type="hidden" value="<%= Plug.CSRFProtection.get_csrf_token() %>">
<label for="host_room_input_video_url">video url:</label>
<input name="video_url" id="host_room_input_video_url" type="url"
maxlength="<%= Application.get_env(:mediasync, :max_video_url_size) %>" required><br>
<script>
"use strict";
/* The built-in validation for <input type="url"> seems very half-hearted in my
testing (Firefox 127.0.2), so let's replace it with something complete. */
(() => {
const checkURLInputValidity = (urlInput) => {
if (URL.canParse(urlInput.value)) {
urlInput.setCustomValidity("");
} else {
urlInput.setCustomValidity("Please enter a valid URL.");
}
urlInput.reportValidity();
};
const urlInput = document.querySelector("input#host_room_input_video_url");
checkURLInputValidity(urlInput);
urlInput.addEventListener("input", e => checkURLInputValidity(e.target));
})();
</script>
<input type="submit" value="host room">
</form>
</body>
</html>
|