]> code.octet-stream.net Git - broadcaster/blob - server/templates/playlist.html
d778250ac609e5ba1e1b8147c34ca79ad4c5520f
[broadcaster] / server / templates / playlist.html
1
2 <script type="text/javascript">
3 function deleteItem(sender) {
4 sender.parentNode.remove();
5 }
6 function addItem() {
7 const p = document.createElement('p');
8 const temp = document.getElementById('item-template');
9 p.innerHTML = temp.innerHTML;
10 const marker = document.getElementById('add-item');
11 const parent = marker.parentNode;
12 parent.insertBefore(p, marker);
13 }
14 </script>
15
16 <h1>A specific playlist</h1>
17 <h2>
18 {{if .Playlist.Id}}
19 Edit Playlist
20 {{else}}
21 Create New Playlist
22 {{end}}
23 </h2>
24 <form action="/playlists/submit" method="POST">
25 <input type="hidden" name="playlistId" value="{{.Playlist.Id}}">
26 <p>
27 <input type="checkbox" id="playlistEnabled" name="playlistEnabled" value="1" {{if .Playlist.Enabled}} checked {{end}}>
28 <label for="playlistEnabled">Playlist enabled?</label><br>
29 </p>
30 <p>
31 <label for="playlistName">Name:</label>
32 <input type="text" id="playlistName" name="playlistName" value="{{.Playlist.Name}}">
33 </p>
34 <p>
35 <label for="playlistStartTime">Transmission Start:</label>
36 <input type="datetime-local" id="playlistStartTime" name="playlistStartTime" value="{{.Playlist.StartTime}}">
37 </p>
38 <h3>Playlist Items</h3>
39 {{range .Entries}}
40 <p>
41 Wait until
42 <input type="text" name="delaySeconds" value="{{.DelaySeconds}}">
43 seconds from
44 <select name="isRelative">
45 <option value="1">previous item</option>
46 <option value="0" {{if not .IsRelative}} selected="selected" {{end}}>start of transmission</option>
47 </select>
48 then play
49 <select name="filename">{{$f := .Filename}}
50 <option value="">(no file selected)</option>
51 {{range $.Files}}
52 <option value="{{.}}" {{if eq . $f }} selected="selected" {{end}}>{{.}}</option>
53 {{end}}
54 </select>
55 <a href="#" onclick="deleteItem(this)">(Delete Item)</a>
56 </p>
57 {{end}}
58 <p>
59 <a href="#" onclick="addItem()" id="add-item">Add Item</a>
60 </p>
61 <p>
62 <input type="submit" value="Save Playlist">
63 </p>
64 </form>
65 {{if .Playlist.Id}}
66 <h3>Delete</h3>
67 <form action="/playlists/delete" method="POST">
68 <input type="hidden" name="playlistId" value="{{.Playlist.Id}}">
69 <p>
70 <input type="submit" value="Delete Playlist">
71 </p>
72 </form>
73 {{end}}
74 <template id="item-template">
75 Wait until
76 <input type="text" name="delaySeconds" value="0">
77 seconds from
78 <select name="isRelative">
79 <option value="1">previous item</option>
80 <option value="0">start of transmission</option>
81 </select>
82 then play
83 <select name="filename">
84 <option value="">(no file selected)</option>
85 {{range $.Files}}
86 <option value="{{.}}">{{.}}</option>
87 {{end}}
88 </select>
89 <a href="#" onclick="deleteItem(this)">(Delete Item)</a>
90 </template>