Moved javascript after img tag

This commit is contained in:
Seednode 2022-11-09 21:25:04 -06:00
parent a9b2af3e18
commit ac67d710c8
1 changed files with 9 additions and 9 deletions

View File

@ -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>`