mirror of
https://github.com/aljazceru/njump.git
synced 2026-01-07 00:24:33 +01:00
102 lines
3.3 KiB
HTML
102 lines
3.3 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
{{if eq .type "profile"}}
|
|
<title>Nostr Public Key {{.npub}}</title>
|
|
<meta property="og:site_name" content="{{.npub}}" />
|
|
<meta property="og:title" content="{{.title}}" />
|
|
{{ if .metadata.Picture }}
|
|
<meta property="og:image" content="{{.metadata.Picture}}" />
|
|
<meta property="twitter:image" content="{{.proxy}}{{.metadata.Picture}}" />
|
|
{{end}} {{ if .metadata.About }}
|
|
<meta property="og:description" content="{{.metadata.About}}" />
|
|
{{end}}
|
|
<meta property="twitter:card" content="summary" />
|
|
{{end}}
|
|
<!----------->
|
|
{{ if eq .type "event" }}
|
|
<title>Nostr Event {{.nevent}}</title>
|
|
<meta property="og:site_name" content="{{.authorLong}}" />
|
|
<meta property="og:title" content="{{.title}}" />
|
|
<meta name="twitter:title" content="{{.twitterTitle}}" />
|
|
<!---->
|
|
{{ if .textImageURL }}
|
|
<meta name="twitter:card" content="summary_large_image" />
|
|
<meta name="twitter:site" content="@nostrprotocol" />
|
|
<meta property="og:image" content="{{.textImageURL}}" />
|
|
<meta name="twitter:image" content="{{.textImageURL}}" />
|
|
{{ else }}
|
|
<!---->
|
|
<meta property="twitter:card" content="summary" />
|
|
{{ if .image }}
|
|
<meta property="og:image" content="{{.image}}" />
|
|
<meta name="twitter:image" content="{{.proxy}}{{.image}}" />
|
|
{{end}} {{ if .video }}
|
|
<meta property="og:video" content="{{.video}}" />
|
|
<meta property="og:video:secure_url" content="{{.video}}" />
|
|
<meta property="og:video:type" content="video/{{.videoType}}" />
|
|
{{end}}
|
|
<!---->
|
|
{{end}}
|
|
<meta property="og:description" content="{{.description}}" />
|
|
<meta name="twitter:description" content="{{.description}}" />
|
|
{{end}}
|
|
<!----------->
|
|
{{ if eq .type "address" }}
|
|
<title>Nostr Address {{.naddr}}</title>
|
|
{{end}}
|
|
<!----------->
|
|
|
|
<style>
|
|
body {
|
|
padding: 3%;
|
|
}
|
|
#event {
|
|
margin: 5% 0;
|
|
white-space: pre-wrap;
|
|
word-wrap: break-word;
|
|
word-break: break-all;
|
|
font-family: monospace;
|
|
font-size: 130%;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div>
|
|
open {{.type}} in {{range .clients}}<br />
|
|
<span style="color: #bbb"></span>
|
|
<a class="client" href="{{.url}}">{{.name}}</a> {{end}}
|
|
</div>
|
|
<div id="event">{{.eventJSON}}</div>
|
|
<div style="display: flex; justify-content: flex-end">
|
|
<span>
|
|
powered by <a href="https://git.fiatjaf.com/njump">njump</a>
|
|
</span>
|
|
</div>
|
|
<script>
|
|
const type = '{{.type}}'
|
|
let counts = []
|
|
let clients = document.querySelectorAll('.client')
|
|
for (let i = 0; i < clients.length; i++) {
|
|
let name = clients[i].innerText
|
|
let url = clients[i].href
|
|
let key = 'nj:' + type + ':' + name
|
|
let count = parseInt(localStorage.getItem(key) || 0)
|
|
clients[i].previousElementSibling.innerText = count
|
|
clients[i].addEventListener('click', () => {
|
|
localStorage.setItem(key, count + 1)
|
|
})
|
|
counts.push([count, name, url])
|
|
}
|
|
counts.sort((a, b) => b[0] - a[0])
|
|
let tailsum = counts.slice(1).reduce((acc, c) => acc + c[0], 0)
|
|
|
|
if (location.hash !== '#noredirect') {
|
|
if (counts[0][0] - tailsum > 10) {
|
|
location.href = counts[0][2]
|
|
}
|
|
}
|
|
</script>
|
|
</body>
|
|
</html>
|