mirror of
https://github.com/aljazceru/njump.git
synced 2026-01-31 19:54:29 +01:00
Fix missing code in 8ab0cfca
This commit is contained in:
@@ -17,6 +17,7 @@ import (
|
||||
|
||||
type Event struct {
|
||||
Npub string
|
||||
NpubShort string
|
||||
Nevent string
|
||||
Content string
|
||||
CreatedAt string
|
||||
|
||||
@@ -51,7 +51,8 @@ func renderRelayPage(w http.ResponseWriter, r *http.Request) {
|
||||
npub, _ := nip19.EncodePublicKey(n.PubKey)
|
||||
npubShort := npub[:8] + "…" + npub[len(npub)-4:]
|
||||
renderableLastNotes[i] = &Event{
|
||||
Npub: npubShort,
|
||||
Npub: npub,
|
||||
NpubShort: npubShort,
|
||||
Nevent: nevent,
|
||||
Content: n.Content,
|
||||
CreatedAt: time.Unix(int64(n.CreatedAt), 0).Format("2006-01-02 15:04:05"),
|
||||
|
||||
@@ -79,7 +79,7 @@
|
||||
{{if not (eq .ParentNevent "")}}
|
||||
<div class="is_reply">- reply</div>
|
||||
{{end}}
|
||||
<div class="npub">by <span href="#">{{.Npub}}</span></div>
|
||||
<div class="npub">by <span href="/{{.Npub}}">{{.NpubShort}}</span></div>
|
||||
</div>
|
||||
<div class="content">{{.Content | escapeString | previewNotesFormatting}}</div>
|
||||
</a>
|
||||
|
||||
@@ -146,10 +146,26 @@ if (desktop_name) {
|
||||
});
|
||||
}
|
||||
|
||||
// Get all the npubs elements in last notes and link them
|
||||
const headerDivs = document.querySelectorAll('div.header');
|
||||
headerDivs.forEach((headerDiv) => {
|
||||
const spanElements = headerDiv.querySelectorAll('span');
|
||||
spanElements.forEach((span) => {
|
||||
const href = span.getAttribute('href');
|
||||
if (href) {
|
||||
span.addEventListener('click', () => {
|
||||
event.preventDefault();
|
||||
window.location.href = href;
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
// Needed to apply proper print styles
|
||||
if (
|
||||
navigator.userAgent.indexOf('Safari') != -1 &&
|
||||
navigator.userAgent.indexOf('Chrome') == -1
|
||||
) {
|
||||
document.body.classList.add('safari')
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user