Moved javascript after img tag
This commit is contained in:
parent
a9b2af3e18
commit
ac67d710c8
18
cmd/web.go
18
cmd/web.go
|
@ -209,28 +209,28 @@ func serveHtml(w http.ResponseWriter, r *http.Request, filePath, dimensions stri
|
||||||
htmlBody += `</title>
|
htmlBody += `</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
`
|
<a href="/`
|
||||||
|
htmlBody += queryParams
|
||||||
|
htmlBody += `"><img src="`
|
||||||
|
htmlBody += generateFilePath(filePath)
|
||||||
|
htmlBody += `"></img></a>`
|
||||||
if refreshInterval != "0" {
|
if refreshInterval != "0" {
|
||||||
r, err := strconv.Atoi(refreshInterval)
|
r, err := strconv.Atoi(refreshInterval)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
refreshTimer := strconv.Itoa(r * 1000)
|
refreshTimer := strconv.Itoa(r * 1000)
|
||||||
htmlBody += ` <script>
|
htmlBody += `
|
||||||
|
<script>
|
||||||
setTimeout(function(){
|
setTimeout(function(){
|
||||||
window.location.href = '`
|
window.location.href = '`
|
||||||
htmlBody += fmt.Sprintf("/%v", queryParams)
|
htmlBody += fmt.Sprintf("/%v", queryParams)
|
||||||
htmlBody += `';
|
htmlBody += `';
|
||||||
},`
|
},`
|
||||||
htmlBody += fmt.Sprintf("%v);\n", refreshTimer)
|
htmlBody += fmt.Sprintf("%v);\n", refreshTimer)
|
||||||
htmlBody += ` </script>
|
htmlBody += ` </script>`
|
||||||
`
|
|
||||||
}
|
}
|
||||||
htmlBody += ` <a href="/`
|
htmlBody += `
|
||||||
htmlBody += queryParams
|
|
||||||
htmlBody += `"><img src="`
|
|
||||||
htmlBody += generateFilePath(filePath)
|
|
||||||
htmlBody += `"></img></a>
|
|
||||||
</body>
|
</body>
|
||||||
</html>`
|
</html>`
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue