hats-domains/template.html
Chandler Swift c57cc6ad12
Add workaround for 39hats.com
For some reason, 39hats.com returns a nil registrant. Ideally, I'd like
to figure out _why_ there's not something returned, but in the meantime
we can just check if it's empty and skip it.
2021-10-19 00:02:49 -05:00

85 lines
2.6 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{n}hats.com domains</title>
<style>
body { max-width: 800px; font-family: sans-serif; margin: auto; }
dt { font-weight: bold; }
img { max-width: 100%; box-shadow: 0 0 10px 10px lightgray; }
img:hover { box-shadow: 0 0 10px 10px darkgray}
h3 { margin-top: 100px; }
.errors { padding: 0.5rem; border: 1px solid #f5c6cb; color: #721c24; background: #f8d7da; }
* { line-height: 1.5em; }
</style>
</head>
<body>
<h1>{n}hats.com domains</h1>
<p><em>Last updated {{(index . 0).FetchTime.Format "Jan 2, 2006" }}</em></p>
{{ $errors := false -}}
{{- range . -}}
{{- with .Error -}}
{{- $errors = true -}}
{{- end -}}
{{- end -}}
{{- if $errors -}}
<div class="errors">
<h4>Errors occurred during processing</h3>
<ol>
{{- range . -}}
{{- if .Error }}
<li>{{.DomainName}}: {{.Error}}</li>
{{ end -}}
{{- end -}}
</ol>
</div>
{{end}}
<h3>Summary</h3>
<ul>
{{range .}}
{{if not .Error}}
{{if .Available}}
<li><a href="#{{.DomainName}}">{{.DomainName}}</a> &ndash; Available!</li>
{{else}}
<li><a href="#{{.DomainName}}">{{.DomainName}}</a> &ndash; Registered since {{(parseTime .DomainInfo.CreatedDate).Format "Jan 2, 2006" }}</li>
{{end}}
{{end}}
{{end}}
</ul>
{{range .}}
{{if not .Error}}
<h3 id="{{.DomainName}}">{{.DomainName}}</h3>
<dl>
<dt>Fetched</dt>
<dd>{{.FetchTime.Format "Jan 2, 2006 15:04:05 -0700" }}</dd>
{{if not .Available}}
<dt>Owner</dt>
{{if .Registrant}}
<dd><a href="mailto:{{.Registrant.Email}}">{{.Registrant.Name}} &lt;{{.Registrant.Email}}&gt</a></dd>
{{else}}
<dd>Information unavailable</dd>
{{end}}
<dt>Since</dt>
<dd>{{(parseTime .DomainInfo.CreatedDate).Format "Jan 2, 2006" }}</dd>
{{end}}
{{with .Title}}
<dt>Title</dt>
<dd>{{.}}</dd>
{{end}}
{{with .Notes}}
<dt>Notes</dt>
<dd>{{.}}</dd>
{{end}}
</dl>
{{if .ScreenshotURL}}
<a href="http://{{.DomainName}}">
<img src="{{.ScreenshotURL}}" alt="screenshot of {{.DomainName}} as of {{.FetchTime.Format "Jan 2, 2006 15:04:05 -0700" }}">
</a>
{{end}}
{{end}}
{{end}}
</body>
</html>