Changeset f2fff7e in Klonkt


Ignore:
Timestamp:
06/24/2026 03:03:51 PM (3 months ago)
Author:
Robin Genis <roboburr@…>
Branches:
main
Children:
749c183
Parents:
77ccd5d
Message:

style(activitypub): reply field replaces the button in place (no layout jump)

The address form now hides the button and takes its spot (restored on cancel),
instead of appearing as an extra element that reflows the page.

Co-Authored-By: Claude <noreply@…>

File:
1 edited

Legend:

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

    r77ccd5d rf2fff7e  
    106106      if (d) location.href = 'https://' + d + '/authorize_interaction?uri=' + encodeURIComponent(uri||'');
    107107    }
     108    function closeForm(f){ if (!f) return; if (f._btn) f._btn.style.display = ''; f.remove(); }
    108109    document.addEventListener('click', function(e){
    109110      var cancel = e.target.closest && e.target.closest('.fedi-remote-cancel');
    110       if (cancel) { var f0 = cancel.closest('.fedi-remote-form'); if (f0) f0.remove(); return; }
     111      if (cancel) { closeForm(cancel.closest('.fedi-remote-form')); return; }
    111112      var b = e.target.closest && e.target.closest('.fedi-remote-reply-btn');
    112113      if (!b) return;
    113114      e.preventDefault();
    114       var mine = (b.nextElementSibling && b.nextElementSibling.classList && b.nextElementSibling.classList.contains('fedi-remote-form')) ? b.nextElementSibling : null;
    115       var any = document.querySelector('.fedi-remote-form'); if (any) any.remove();
    116       if (mine) return; // clicking again closes it
     115      closeForm(document.querySelector('.fedi-remote-form')); // close any open one (restores its button)
    117116      var f = document.createElement('form');
    118117      f.className = 'fedi-remote-form';
    119118      f.dataset.uri = b.getAttribute('data-fedi-uri') || '';
     119      f._btn = b;
    120120      f.innerHTML = '<input type="text" autocomplete="off" spellcheck="false">'
    121121        + '<button type="submit" class="btn btn-primary fedi-remote-go" aria-label="ok">&rarr;</button>'
    122122        + '<button type="button" class="fedi-remote-cancel" aria-label="x">&times;</button>';
    123123      var inp = f.querySelector('input');
    124       inp.placeholder = b.getAttribute('data-fedi-ph') || '@name@mastodon.social';
     124      inp.placeholder = b.getAttribute('data-fedi-ph') || '@name@server.social';
     125      b.style.display = 'none';                  // replace the button in place → no layout jump
    125126      b.parentNode.insertBefore(f, b.nextSibling);
    126127      inp.focus();
Note: See TracChangeset for help on using the changeset viewer.