// Code generated by qtc from "statspage.qtpl". DO NOT EDIT.
// See https://github.com/valyala/quicktemplate for details.

//line templates/statspage.qtpl:1
package templates

//line templates/statspage.qtpl:1
import (
	qtio422016 "io"

	qt422016 "github.com/valyala/quicktemplate"
)

//line templates/statspage.qtpl:1
var (
	_ = qtio422016.Copy
	_ = qt422016.AcquireByteBuffer
)

//line templates/statspage.qtpl:2
type StatsPage struct {
	TotalBeats   string
	TotalDevices string
	TotalVisits  string
	TotalUptime  string
	ServerName   string
}

//line templates/statspage.qtpl:11
func (p *StatsPage) StreamTitle(qw422016 *qt422016.Writer) {
//line templates/statspage.qtpl:11
	qw422016.N().S(`
    Stats - `)
//line templates/statspage.qtpl:12
	qw422016.E().S(p.ServerName)
//line templates/statspage.qtpl:12
	qw422016.N().S(`
`)
//line templates/statspage.qtpl:13
}

//line templates/statspage.qtpl:13
func (p *StatsPage) WriteTitle(qq422016 qtio422016.Writer) {
//line templates/statspage.qtpl:13
	qw422016 := qt422016.AcquireWriter(qq422016)
//line templates/statspage.qtpl:13
	p.StreamTitle(qw422016)
//line templates/statspage.qtpl:13
	qt422016.ReleaseWriter(qw422016)
//line templates/statspage.qtpl:13
}

//line templates/statspage.qtpl:13
func (p *StatsPage) Title() string {
//line templates/statspage.qtpl:13
	qb422016 := qt422016.AcquireByteBuffer()
//line templates/statspage.qtpl:13
	p.WriteTitle(qb422016)
//line templates/statspage.qtpl:13
	qs422016 := string(qb422016.B)
//line templates/statspage.qtpl:13
	qt422016.ReleaseByteBuffer(qb422016)
//line templates/statspage.qtpl:13
	return qs422016
//line templates/statspage.qtpl:13
}

//line templates/statspage.qtpl:15
func (p *StatsPage) StreamHead(qw422016 *qt422016.Writer) {
//line templates/statspage.qtpl:15
	qw422016.N().S(`
<meta property="og:site_name" content="Stats - `)
//line templates/statspage.qtpl:16
	qw422016.E().S(p.ServerName)
//line templates/statspage.qtpl:16
	qw422016.N().S(`">
<meta property="og:description" content="Stats for `)
//line templates/statspage.qtpl:17
	qw422016.E().S(p.ServerName)
//line templates/statspage.qtpl:17
	qw422016.N().S(`"/>
<meta name="theme-color" content="#6495ED">
<script>
    window.onload = function () {
        setInterval(updateInfo, 1000)
    };

    async function updateInfo() {
        let response = await fetch("/api/stats?countVisit=false");
        let data = await response.json();

        await setInfo("TotalVisits", data.total_visits_formatted, "Total visits")
        await setInfo("TotalDevices", data.total_devices_formatted, "Total devices sending beats")
        await setInfo("TotalBeats", data.total_beats_formatted, "Total beats received")
        await setInfo("TotalUptime", data.total_uptime_formatted, "Total uptime")
    }

    async function setInfo(id, json, prefix) {
        document.getElementById(id).innerHTML = `)
//line templates/statspage.qtpl:17
	qw422016.N().S("`")
//line templates/statspage.qtpl:17
	qw422016.N().S(`${prefix}:<br>${json}`)
//line templates/statspage.qtpl:17
	qw422016.N().S("`")
//line templates/statspage.qtpl:17
	qw422016.N().S(`
    }
</script>
`)
//line templates/statspage.qtpl:38
}

//line templates/statspage.qtpl:38
func (p *StatsPage) WriteHead(qq422016 qtio422016.Writer) {
//line templates/statspage.qtpl:38
	qw422016 := qt422016.AcquireWriter(qq422016)
//line templates/statspage.qtpl:38
	p.StreamHead(qw422016)
//line templates/statspage.qtpl:38
	qt422016.ReleaseWriter(qw422016)
//line templates/statspage.qtpl:38
}

//line templates/statspage.qtpl:38
func (p *StatsPage) Head() string {
//line templates/statspage.qtpl:38
	qb422016 := qt422016.AcquireByteBuffer()
//line templates/statspage.qtpl:38
	p.WriteHead(qb422016)
//line templates/statspage.qtpl:38
	qs422016 := string(qb422016.B)
//line templates/statspage.qtpl:38
	qt422016.ReleaseByteBuffer(qb422016)
//line templates/statspage.qtpl:38
	return qs422016
//line templates/statspage.qtpl:38
}

//line templates/statspage.qtpl:40
func (p *StatsPage) StreamBody(qw422016 *qt422016.Writer) {
//line templates/statspage.qtpl:40
	qw422016.N().S(`
    <div class="spacer"></div>
    <div class="pure-g preamble">
        <div class="pure-g-u-0 pure-u-lg-1-6"></div>
        <div class="pure-u-1 pure-u-lg-4-6">
            <p class="center">
                Statistics for `)
//line templates/statspage.qtpl:46
	qw422016.E().S(p.ServerName)
//line templates/statspage.qtpl:46
	qw422016.N().S(`
            </p>
        </div>
        <div class="pure-g-u-0 pure-u-lg-1-6"></div>
    </div>
    <div class="pure-g times">
        <div class="pure-u-0 pure-u-lg-1-6"></div>
        <div class="pure-u-1 pure-u-lg-1-6">
            <p class="center" id="TotalVisits">Total visits:<br>`)
//line templates/statspage.qtpl:54
	qw422016.E().S(p.TotalVisits)
//line templates/statspage.qtpl:54
	qw422016.N().S(`</p>
        </div>
        <div class="pure-u-1 pure-u-lg-1-6">
            <p class="center" id="TotalDevices">Total devices sending beats:<br>`)
//line templates/statspage.qtpl:57
	qw422016.E().S(p.TotalDevices)
//line templates/statspage.qtpl:57
	qw422016.N().S(`</p>
        </div>
        <div class="pure-u-1 pure-u-lg-1-6">
            <p class="center" id="TotalBeats">Total beats received:<br>`)
//line templates/statspage.qtpl:60
	qw422016.E().S(p.TotalBeats)
//line templates/statspage.qtpl:60
	qw422016.N().S(`</p>
        </div>
        <div class="pure-u-1 pure-u-lg-1-6">
            <p class="center" id="TotalUptime">Total uptime:<br>`)
//line templates/statspage.qtpl:63
	qw422016.E().S(p.TotalUptime)
//line templates/statspage.qtpl:63
	qw422016.N().S(`</p>
        </div>
        <div class="pure-u-0 pure-u-lg-1-6"></div>
    </div>
    <div class="spacer"></div>
    <div class="pure-g links">
        <div class="pure-g-u-0 pure-u-lg-1-6"></div>
        <div class="pure-u-1 pure-u-lg-4-6">
            <p class="center">
                <a href="/">Main Page</a> - <a href="/privacy">Privacy Policy</a>
            </p>
        </div>
        <div class="pure-g-u-0 pure-u-lg-1-6"></div>
    </div>
`)
//line templates/statspage.qtpl:77
}

//line templates/statspage.qtpl:77
func (p *StatsPage) WriteBody(qq422016 qtio422016.Writer) {
//line templates/statspage.qtpl:77
	qw422016 := qt422016.AcquireWriter(qq422016)
//line templates/statspage.qtpl:77
	p.StreamBody(qw422016)
//line templates/statspage.qtpl:77
	qt422016.ReleaseWriter(qw422016)
//line templates/statspage.qtpl:77
}

//line templates/statspage.qtpl:77
func (p *StatsPage) Body() string {
//line templates/statspage.qtpl:77
	qb422016 := qt422016.AcquireByteBuffer()
//line templates/statspage.qtpl:77
	p.WriteBody(qb422016)
//line templates/statspage.qtpl:77
	qs422016 := string(qb422016.B)
//line templates/statspage.qtpl:77
	qt422016.ReleaseByteBuffer(qb422016)
//line templates/statspage.qtpl:77
	return qs422016
//line templates/statspage.qtpl:77
}
