streamwatcher/templates/stream.html
2020-07-12 18:17:46 +00:00

66 lines
No EOL
2.8 KiB
HTML
Executable file

{{template "base" .}}
{{define "head"}}
<script src="/static/js/stream.js"></script>
{{end}}
{{define "content"}}
<div>
<canvas id="canvas" width="1280" height="720">Not supported</canvas>
<img src="{{ .GetCurrentColorURL }}" id="current_color_stream" hidden>
<img src="{{ .GetPreviousURL }}" width="425" height="240">
<img src="{{ .GetDebugURL }}" width="425" height="240">
<img src="{{ .GetCurrentURL }}" width="425" height="240">
</div>
<form action="/addWatchArea" method="GET" id="newWatchAreaForm">
<table class="pure-table pure-table-horizontal pure-table-striped">
<caption>Watches</caption>
<thead>
<tr>
<th>Name</th>
<th colspan="3">Color</th>
<th colspan="4">Area</th>
<th>Add/Remove</th>
</tr>
<tr>
<th></th>
<th>R</th>
<th>G</th>
<th>B</th>
<th>MinX</th>
<th>MinY</th>
<th>MaxX</th>
<th>MaxY</th>
<th></th>
</tr>
</thead>
<tbody id="watchAreas">
{{range $watchArea := .WatchAreas}}
<tr>
<td>{{ $watchArea.Name }}</td>
<td>{{ $watchArea.Color.R }}</td>
<td>{{ $watchArea.Color.G }}</td>
<td>{{ $watchArea.Color.B }}</td>
<td>{{ $watchArea.Area.Min.X }}</td>
<td>{{ $watchArea.Area.Min.Y }}</td>
<td>{{ $watchArea.Area.Max.X }}</td>
<td>{{ $watchArea.Area.Max.Y }}</td>
<td>Remove</td>
</tr>
{{end}}
</tbody>
</table>
</form>
<template id="newWatchAreaTemplate" hidden>
<tr id="addWatchAreaRow">
<td><input type="text" name="name" placeholder="Name"></td>
<td><input type="number" name="R" min="0" max="255" size="5" onchange="changeR(this)"></td>
<td><input type="number" name="G" min="0" max="255" size="5" onchange="changeG(this)"></td>
<td><input type="number" name="B" min="0" max="255" size="5" onchange="changeB(this)"></td>
<td><input type="number" name="x0" min="0" max="1280" size="5" onchange="changeX0(this)"></td>
<td><input type="number" name="y0" min="0" max="720" size="5" onchange="changeY0(this)"></td>
<td><input type="number" name="x1" min="0" max="1280" size="5" onchange="changeX1(this)"></td>
<td><input type="number" name="y1" min="0" max="720" size="5" onchange="changeY1(this)"></td>
<td><button type="button" class="pure-button pure-button-primary" onclick="submitNewArea()">Add</button></td>
</tr>
</template>
{{end}}