Changeset d22b55c in Klonkt for src/views/pages


Ignore:
Timestamp:
06/26/2026 04:10:22 PM (2 months ago)
Author:
Robin Genis <roboburr@…>
Branches:
main
Children:
781d613
Parents:
84903a1
Message:

feat(fedi): Bandcamp+Apple Music embeds in feed, server autofill, NL/DE Newspaper label

  • timelineEmbedHtml now also embeds Bandcamp + Apple Music (all 6 external providers + Klonkt now embed inline in the feed).
  • The 'interact via the fediverse' popover remembers your server (localStorage) and suggests common Mastodon servers (datalist); prefilled + selected on open.
  • Newspaper label localised: NL 'Krant', DE 'Zeitung', EN 'Newspaper'.
Location:
src/views/pages
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/views/pages/newspaper.ejs

    r84903a1 rd22b55c  
    107107  .tl-embed-sc { aspect-ratio: auto; height: 166px; }
    108108  .tl-embed-klonkt { aspect-ratio: auto; height: 180px; background: var(--paper, #fff); }
     109  .tl-embed-bandcamp { aspect-ratio: auto; height: 470px; }
     110  .tl-embed-apple { aspect-ratio: auto; height: 175px; }
    109111
    110112  .tl-orig { display: inline-block; margin: .7rem 0 0; font-size: .82rem; color: var(--accent, #06c); text-decoration: none; }
     
    138140  var current = null, currentBtn = null;
    139141  function close(){ if (current) { current.remove(); current = null; currentBtn = null; } }
    140   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||''); }
     142  function go(raw, uri){ var d=(raw||'').trim().replace(/^@?[^@\s]*@/,'').replace(/^https?:\/\//i,'').replace(/\/.*$/,'').trim(); if(d){ try{ localStorage.setItem('pcmsFediServer', d); }catch(e){} location.href='https://'+d+'/authorize_interaction?uri='+encodeURIComponent(uri||''); } }
    141143  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'; }
    142144  document.addEventListener('click', function(e){
     
    149151      close();
    150152      var f = document.createElement('form'); f.className='fedi-remote-form'; f.dataset.uri = b.getAttribute('data-fedi-uri')||'';
    151       f.innerHTML = '<input type="text" autocomplete="off" spellcheck="false"><button type="submit" class="btn btn-primary fedi-remote-go" aria-label="ok">&rarr;</button><button type="button" class="fedi-remote-cancel" aria-label="x">&times;</button>';
    152       f.querySelector('input').placeholder = b.getAttribute('data-fedi-ph') || 'mastodon.social';
    153       document.body.appendChild(f); place(f, b); current=f; currentBtn=b; f.querySelector('input').focus();
     153      f.innerHTML = '<input type="text" name="fediserver" autocomplete="on" list="pcms-fedi-srv" spellcheck="false"><button type="submit" class="btn btn-primary fedi-remote-go" aria-label="ok">&rarr;</button><button type="button" class="fedi-remote-cancel" aria-label="x">&times;</button><datalist id="pcms-fedi-srv"><option value="mastodon.social"></option><option value="mastodon.online"></option><option value="mas.to"></option><option value="fosstodon.org"></option><option value="hachyderm.io"></option></datalist>';
     154      var _inp = f.querySelector('input'); _inp.placeholder = b.getAttribute('data-fedi-ph') || 'mastodon.social';
     155      try{ var _sv = localStorage.getItem('pcmsFediServer'); if(_sv) _inp.value = _sv; }catch(e){}
     156      document.body.appendChild(f); place(f, b); current=f; currentBtn=b; _inp.focus(); _inp.select();
    154157      return;
    155158    }
  • src/views/pages/post.ejs

    r84903a1 rd22b55c  
    109109    function go(raw, uri){
    110110      var d = (raw||'').trim().replace(/^@?[^@\s]*@/, '').replace(/^https?:\/\//i, '').replace(/\/.*$/, '').trim();
    111       if (d) location.href = 'https://' + d + '/authorize_interaction?uri=' + encodeURIComponent(uri||'');
     111      if (d) { try { localStorage.setItem('pcmsFediServer', d); } catch(e){} location.href = 'https://' + d + '/authorize_interaction?uri=' + encodeURIComponent(uri||''); }
    112112    }
    113113    function place(f, b){
     
    127127        f.className = 'fedi-remote-form';
    128128        f.dataset.uri = b.getAttribute('data-fedi-uri') || '';
    129         f.innerHTML = '<input type="text" autocomplete="off" spellcheck="false">'
     129        f.innerHTML = '<input type="text" name="fediserver" autocomplete="on" list="pcms-fedi-srv" spellcheck="false">'
    130130          + '<button type="submit" class="btn btn-primary fedi-remote-go" aria-label="ok">&rarr;</button>'
    131           + '<button type="button" class="fedi-remote-cancel" aria-label="x">&times;</button>';
    132         f.querySelector('input').placeholder = b.getAttribute('data-fedi-ph') || 'mastodon.social';
     131          + '<button type="button" class="fedi-remote-cancel" aria-label="x">&times;</button>'
     132          + '<datalist id="pcms-fedi-srv"><option value="mastodon.social"></option><option value="mastodon.online"></option><option value="mas.to"></option><option value="fosstodon.org"></option><option value="hachyderm.io"></option></datalist>';
     133        var _inp = f.querySelector('input');
     134        _inp.placeholder = b.getAttribute('data-fedi-ph') || 'mastodon.social';
     135        try { var _sv = localStorage.getItem('pcmsFediServer'); if (_sv) _inp.value = _sv; } catch(e){}
    133136        document.body.appendChild(f);            // floating popover → no layout reflow
    134137        place(f, b); current = f; currentBtn = b;
    135         f.querySelector('input').focus();
     138        _inp.focus(); _inp.select();
    136139        return;
    137140      }
Note: See TracChangeset for help on using the changeset viewer.