diff --git a/main.go b/main.go index c95abb9..be64be8 100755 --- a/main.go +++ b/main.go @@ -41,16 +41,20 @@ func (server Server) index(w http.ResponseWriter, r *http.Request) { } streamTemplate, err := template.ParseFiles(streamHTML, baseHTML) + watchAreasJSON, _ := json.Marshal(stream.WatchAreas) + if err != nil { log.Println(err) return } streamTemplate.Execute(w, struct { - Streams map[string]*Stream - Stream *Stream + Streams map[string]*Stream + Stream *Stream + WatchAreasJSON string }{ server.Streams, stream, + string(watchAreasJSON[:]), }) } diff --git a/static/js/stream.js b/static/js/stream.js index 366e1cb..3047707 100755 --- a/static/js/stream.js +++ b/static/js/stream.js @@ -40,6 +40,7 @@ let watchArea = new WatchArea( let watchAreas = []; document.addEventListener("DOMContentLoaded", function(){ + loadWatchAreas(); canvas = document.getElementById("canvas"); ctx = canvas.getContext("2d"); src = document.getElementById("current_color_stream"); diff --git a/templates/stream.html b/templates/stream.html index ba52a4b..7f62518 100755 --- a/templates/stream.html +++ b/templates/stream.html @@ -83,14 +83,17 @@ {{end}} \ No newline at end of file