gopherproxy/template.go

30 lines
725 B
Go
Raw Normal View History

package gopherproxy
2016-09-22 02:51:46 +00:00
var tpltext = `<!doctype html>
<html>
2016-09-22 02:51:46 +00:00
<head>
<meta charset="utf-8">
2017-09-16 06:10:17 +00:00
<meta name="viewport" content="width=device-width, initial-scale=1" />
2016-09-22 02:51:46 +00:00
<title>{{.Title}}</title>
</head>
<body>
2017-09-16 06:10:17 +00:00
<section>
2016-09-22 02:51:46 +00:00
<pre>
2016-09-22 14:02:59 +00:00
{{range .Lines}} {{if .Link}}({{.Type}}) <a class="{{ .Type }}" href="{{.Link}}">{{.Text}}</a>{{else}} {{.Text}}{{end}}
2016-09-22 02:51:46 +00:00
{{end}}</pre>
2017-09-16 06:10:17 +00:00
</section>
2016-09-22 14:02:59 +00:00
<script type="text/javascript">
var qry=document.getElementsByClassName('QRY')
var i=qry.length
while (i--) {
qry[i].addEventListener('click', function(e) {
e.preventDefault();
var resp=prompt("Please enter required input: ", "")
if (resp !== "") window.location = e.target.href + "?" + resp
return false;
})
}
2016-09-22 14:02:59 +00:00
</script>
2016-09-22 02:51:46 +00:00
</body>
</html>`