| 1 | <div class="tl-wrap">
|
|---|
| 2 | <h1 class="tl-title"><%= t('tl.title') %></h1>
|
|---|
| 3 | <p class="tl-lead"><%= t('tl.lead') %></p>
|
|---|
| 4 | <% if (typeof success !== 'undefined' && success) { %><div class="alert alert-success"><%= success %></div><% } %>
|
|---|
| 5 | <% if (typeof error !== 'undefined' && error) { %><div class="alert alert-error"><%= error %></div><% } %>
|
|---|
| 6 |
|
|---|
| 7 | <form method="post" action="/tijdlijn/follow" class="tl-follow">
|
|---|
| 8 | <input type="text" name="handle" placeholder="@naam@server.social" autocomplete="off" spellcheck="false" required>
|
|---|
| 9 | <button type="submit" class="btn btn-primary"><%= t('tl.follow_btn') %></button>
|
|---|
| 10 | </form>
|
|---|
| 11 |
|
|---|
| 12 | <% if (following && following.length) { %>
|
|---|
| 13 | <h2 class="tl-sub"><%= t('tl.following') %> (<%= following.length %>)</h2>
|
|---|
| 14 | <ul class="tl-foll-list">
|
|---|
| 15 | <% following.forEach(function(f){ %>
|
|---|
| 16 | <li class="tl-foll">
|
|---|
| 17 | <span class="tl-foll-av"><% if (f.icon) { %><img src="<%= f.icon %>" alt=""><% } else { %><%= (f.name || '?').charAt(0).toUpperCase() %><% } %></span>
|
|---|
| 18 | <span class="tl-foll-meta">
|
|---|
| 19 | <a href="<%= f.url || f.actor_uri %>" target="_blank" rel="nofollow noopener"><%= f.name || f.handle %></a>
|
|---|
| 20 | <span class="tl-foll-handle"><%= f.handle %></span>
|
|---|
| 21 | <% if (f.status === 'pending') { %><span class="tl-pending"><%= t('tl.pending') %></span><% } %>
|
|---|
| 22 | </span>
|
|---|
| 23 | <form method="post" action="/tijdlijn/unfollow"><input type="hidden" name="actor_uri" value="<%= f.actor_uri %>"><button type="submit" class="tl-unfollow"><%= t('tl.unfollow') %></button></form>
|
|---|
| 24 | </li>
|
|---|
| 25 | <% }); %>
|
|---|
| 26 | </ul>
|
|---|
| 27 | <% } %>
|
|---|
| 28 |
|
|---|
| 29 | <h2 class="tl-sub"><%= t('tl.feed') %></h2>
|
|---|
| 30 | <% if (!timeline || !timeline.length) { %>
|
|---|
| 31 | <p class="tl-empty"><%= t('tl.empty') %></p>
|
|---|
| 32 | <% } else { %>
|
|---|
| 33 | <ol class="tl-feed">
|
|---|
| 34 | <% timeline.forEach(function(p){ %>
|
|---|
| 35 | <li class="tl-item">
|
|---|
| 36 | <span class="tl-avatar"><% if (p.author_icon) { %><img src="<%= p.author_icon %>" alt="" loading="lazy"><% } else { %><%= (p.author_name || '?').charAt(0).toUpperCase() %><% } %></span>
|
|---|
| 37 | <div class="tl-itembody">
|
|---|
| 38 | <div class="tl-meta">
|
|---|
| 39 | <a class="tl-author" href="<%= p.author_url || p.author_uri %>" target="_blank" rel="nofollow noopener"><%= p.author_name %></a>
|
|---|
| 40 | <span class="tl-handle"><%= p.author_handle %></span>
|
|---|
| 41 | <% if (p.published || p.created_at) { %><span class="tl-time"><%= formatDateTime(p.published || p.created_at) %></span><% } %>
|
|---|
| 42 | </div>
|
|---|
| 43 | <div class="tl-content"><%- p.content %></div>
|
|---|
| 44 | <% var media = []; try { media = JSON.parse(p.media_json || '[]'); } catch (e) { media = []; } %>
|
|---|
| 45 | <% media.filter(function(m){ return !m.type || /^image\//.test(m.type); }).forEach(function(m){ %><img class="tl-media" src="<%= m.url %>" alt="" loading="lazy"><% }); %>
|
|---|
| 46 | <% if (p.url) { %><p class="tl-orig"><a href="<%= p.url %>" target="_blank" rel="nofollow noopener"><%= t('tl.view_original') %></a></p><% } %>
|
|---|
| 47 | <div class="tl-actions">
|
|---|
| 48 | <form method="post" action="/tijdlijn/like" class="tl-act-form"><input type="hidden" name="note" value="<%= p.id %>"><input type="hidden" name="author" value="<%= p.author_uri %>"><button type="submit" class="tl-act" title="<%= t('fedi.likes') %>">⭐</button></form>
|
|---|
| 49 | <form method="post" action="/tijdlijn/boost" class="tl-act-form"><input type="hidden" name="note" value="<%= p.id %>"><input type="hidden" name="author" value="<%= p.author_uri %>"><button type="submit" class="tl-act" title="<%= t('fedi.boosts') %>">🔁</button></form>
|
|---|
| 50 | <button type="button" class="tl-act fedi-remote-reply-btn" data-fedi-uri="<%= p.id %>" data-fedi-ph="<%= t('fedi.remote_ph') %>" title="<%= t('fedi.remote_reply') %>">↩</button>
|
|---|
| 51 | </div>
|
|---|
| 52 | </div>
|
|---|
| 53 | </li>
|
|---|
| 54 | <% }); %>
|
|---|
| 55 | </ol>
|
|---|
| 56 | <% } %>
|
|---|
| 57 | </div>
|
|---|
| 58 |
|
|---|
| 59 | <style>
|
|---|
| 60 | .tl-wrap { max-width: 640px; margin: 2rem auto; padding: 0 1rem; }
|
|---|
| 61 | .tl-title { margin: 0 0 .25rem; }
|
|---|
| 62 | .tl-lead { color: var(--ink-soft, #888); margin: 0 0 1.25rem; }
|
|---|
| 63 | .tl-sub { font-size: 1.1rem; margin: 1.75rem 0 .75rem; }
|
|---|
| 64 | .tl-follow { display: flex; gap: .5rem; margin: 0 0 1rem; flex-wrap: wrap; }
|
|---|
| 65 | .tl-follow input { flex: 1; min-width: 200px; height: 2.4rem; padding: 0 .9rem; border-radius: 999px; font: inherit;
|
|---|
| 66 | border: 1px solid color-mix(in srgb, var(--ink, #000) 18%, transparent); background: color-mix(in srgb, var(--ink, #000) 4%, transparent); color: var(--ink, #000); }
|
|---|
| 67 | .tl-foll-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .4rem; }
|
|---|
| 68 | .tl-foll { display: flex; align-items: center; gap: .6rem; padding: .45rem .6rem; border-radius: 12px; background: color-mix(in srgb, var(--ink, #000) 4%, transparent); }
|
|---|
| 69 | .tl-foll-av, .tl-avatar { flex: 0 0 36px; width: 36px; height: 36px; border-radius: 50%; overflow: hidden; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; background: color-mix(in srgb, var(--accent, #888) 20%, transparent); color: var(--accent, #555); }
|
|---|
| 70 | .tl-foll-av img, .tl-avatar img { width: 100%; height: 100%; object-fit: cover; }
|
|---|
| 71 | .tl-foll-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
|
|---|
| 72 | .tl-foll-handle, .tl-handle { color: var(--ink-soft, #888); font-size: .82rem; }
|
|---|
| 73 | .tl-pending { font-size: .72rem; color: var(--ink-soft, #999); }
|
|---|
| 74 | .tl-unfollow { background: none; border: 1px solid color-mix(in srgb, var(--ink, #000) 18%, transparent); border-radius: 8px; padding: .25rem .6rem; font-size: .8rem; color: var(--ink-soft, #888); cursor: pointer; }
|
|---|
| 75 | .tl-unfollow:hover { color: var(--ink, #000); }
|
|---|
| 76 | .tl-empty { color: var(--ink-soft, #888); }
|
|---|
| 77 | .tl-feed { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .9rem; }
|
|---|
| 78 | .tl-item { display: flex; gap: .75rem; padding: .9rem 1rem; border-radius: 14px; border: 1px solid color-mix(in srgb, var(--ink, #000) 9%, transparent); background: color-mix(in srgb, var(--ink, #000) 3%, transparent); }
|
|---|
| 79 | .tl-itembody { flex: 1; min-width: 0; }
|
|---|
| 80 | .tl-meta { display: flex; align-items: baseline; gap: .4rem; flex-wrap: wrap; }
|
|---|
| 81 | .tl-author { font-weight: 600; color: var(--ink, inherit); text-decoration: none; }
|
|---|
| 82 | .tl-author:hover { text-decoration: underline; }
|
|---|
| 83 | .tl-time { color: var(--ink-soft, #999); font-size: .8rem; margin-left: auto; }
|
|---|
| 84 | .tl-content { margin: .3rem 0 0; line-height: 1.5; overflow-wrap: anywhere; }
|
|---|
| 85 | .tl-content p { margin: .25rem 0; } .tl-content p:first-child { margin-top: 0; }
|
|---|
| 86 | .tl-media { max-width: 100%; height: auto; border-radius: 10px; margin: .5rem 0 0; display: block; }
|
|---|
| 87 | .tl-orig { margin: .5rem 0 0; font-size: .82rem; }
|
|---|
| 88 | .tl-orig a { color: var(--accent, #06c); }
|
|---|
| 89 | .tl-actions { display: flex; gap: .35rem; margin-top: .55rem; }
|
|---|
| 90 | .tl-act-form { margin: 0; }
|
|---|
| 91 | .tl-act { background: none; border: 1px solid color-mix(in srgb, var(--ink, #000) 14%, transparent); border-radius: 999px; padding: .2rem .6rem; cursor: pointer; font-size: .9rem; color: var(--ink-soft, #888); }
|
|---|
| 92 | .tl-act:hover { color: var(--ink, #000); border-color: color-mix(in srgb, var(--accent, #888) 50%, transparent); }
|
|---|
| 93 | </style>
|
|---|
| 94 |
|
|---|
| 95 | <script>
|
|---|
| 96 | (function(){
|
|---|
| 97 | if (window.__fediRemoteWired) return; window.__fediRemoteWired = true;
|
|---|
| 98 | var current = null, currentBtn = null;
|
|---|
| 99 | function close(){ if (current) { current.remove(); current = null; currentBtn = null; } }
|
|---|
| 100 | function go(raw, uri){ var d=(raw||'').trim().replace(/^@?[^@\s]*@/,'').replace(/^https?:\/\//i,'').replace(/\/.*$/,'').trim(); if(d) location.href='https://'+d+'/authorize_interaction?uri='+encodeURIComponent(uri||''); }
|
|---|
| 101 | function place(f, b){ var r=b.getBoundingClientRect(); f.style.top=(r.bottom+window.scrollY+6)+'px'; f.style.left=Math.max(8, Math.min(r.left+window.scrollX, window.scrollX+window.innerWidth-340))+'px'; }
|
|---|
| 102 | document.addEventListener('click', function(e){
|
|---|
| 103 | if (e.target.closest && e.target.closest('.fedi-remote-cancel')) { close(); return; }
|
|---|
| 104 | if (current && e.target.closest && e.target.closest('.fedi-remote-form')) return;
|
|---|
| 105 | var b = e.target.closest && e.target.closest('.fedi-remote-reply-btn');
|
|---|
| 106 | if (b) {
|
|---|
| 107 | e.preventDefault();
|
|---|
| 108 | if (currentBtn === b) { close(); return; }
|
|---|
| 109 | close();
|
|---|
| 110 | var f = document.createElement('form'); f.className='fedi-remote-form'; f.dataset.uri = b.getAttribute('data-fedi-uri')||'';
|
|---|
| 111 | f.innerHTML = '<input type="text" autocomplete="off" spellcheck="false"><button type="submit" class="btn btn-primary fedi-remote-go" aria-label="ok">→</button><button type="button" class="fedi-remote-cancel" aria-label="x">×</button>';
|
|---|
| 112 | f.querySelector('input').placeholder = b.getAttribute('data-fedi-ph') || '@name@server.social';
|
|---|
| 113 | document.body.appendChild(f); place(f, b); current=f; currentBtn=b; f.querySelector('input').focus();
|
|---|
| 114 | return;
|
|---|
| 115 | }
|
|---|
| 116 | if (current) close();
|
|---|
| 117 | });
|
|---|
| 118 | document.addEventListener('submit', function(e){ var f=e.target.closest && e.target.closest('.fedi-remote-form'); if(!f) return; e.preventDefault(); go(f.querySelector('input').value, f.dataset.uri); });
|
|---|
| 119 | document.addEventListener('keydown', function(e){ if (e.key === 'Escape') close(); });
|
|---|
| 120 | window.addEventListener('scroll', close, true);
|
|---|
| 121 | })();
|
|---|
| 122 | </script>
|
|---|