Changeset dcff893 in Klonkt for src/views/pages


Ignore:
Timestamp:
06/27/2026 07:08:17 AM (2 months ago)
Author:
Robin Genis <roboburr@…>
Branches:
main
Children:
74d61e6
Parents:
80c36a1
Message:

feat(fedi): interact bookmarklet on the My-replies page

A drag-to-bookmarks-bar button that opens <yoursite>/authorize_interaction with the
current page URL — so you can like/boost/reply to any fediverse post from your own site.
Origin is baked in client-side (location.origin). New i18n fedi.bm_label/bm_help.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/views/pages/authorize-interaction.ejs

    r80c36a1 rdcff893  
    33    <%- include('../partials/fedi-tabs', { active: 'reacties' }) %>
    44    <h1 class="auth-interact-title"><%= t('fedi.manage_title') %></h1>
     5
     6    <%# Interact bookmarklet — drag to bookmarks bar, then click on any fediverse post. %>
     7    <div class="fedi-bm">
     8      <a class="fedi-bm-btn" id="fedi-bm-btn" href="#" draggable="true" title="<%= t('fedi.bm_help') %>">
     9        <svg viewBox="0 0 24 24" width="15" height="15" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M19 21l-7-5-7 5V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z"/></svg>
     10        <%= t('fedi.bm_label') %>
     11      </a>
     12      <p class="fedi-bm-help"><%= t('fedi.bm_help') %></p>
     13    </div>
     14    <script>
     15    (function () {
     16      if (window.__fediBmWired) return; window.__fediBmWired = true;
     17      var a = document.getElementById('fedi-bm-btn'); if (!a) return;
     18      a.setAttribute('href', "javascript:void(window.open('" + location.origin + "/authorize_interaction?uri='+encodeURIComponent(window.location.href)))");
     19      a.addEventListener('click', function (e) { e.preventDefault(); a.classList.add('nudge'); setTimeout(function(){ a.classList.remove('nudge'); }, 600); });
     20    })();
     21    </script>
    522    <% if (!manage.length) { %>
    623      <p class="auth-interact-note"><%= t('fedi.manage_empty') %></p>
     
    190207  .fedi-del-btn { display: inline-flex; align-items: center; gap: .35rem; border: 1px solid color-mix(in srgb, #d9534f 45%, transparent); background: color-mix(in srgb, #d9534f 12%, transparent); color: #e06b66; border-radius: 999px; padding: .3rem .8rem; font: inherit; font-size: .82rem; cursor: pointer; transition: background .15s ease; }
    191208  .fedi-del-btn:hover { background: color-mix(in srgb, #d9534f 24%, transparent); }
     209  .fedi-bm { margin: 0 0 1.5rem; padding: 1rem; border-radius: 14px;
     210    border: 1px dashed color-mix(in srgb, var(--accent, #888) 45%, transparent);
     211    background: color-mix(in srgb, var(--accent, #888) 7%, transparent); }
     212  .fedi-bm-btn { display: inline-flex; align-items: center; gap: .45rem; padding: .5rem 1rem; border-radius: 999px;
     213    background: var(--accent, #06c); color: #fff; font: inherit; font-weight: 600; font-size: .9rem; text-decoration: none;
     214    cursor: grab; user-select: none; box-shadow: 0 2px 8px color-mix(in srgb, var(--accent, #000) 30%, transparent); }
     215  .fedi-bm-btn:active { cursor: grabbing; }
     216  .fedi-bm-btn.nudge { animation: fedi-bm-nudge .6s ease; }
     217  @keyframes fedi-bm-nudge { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
     218  .fedi-bm-help { color: var(--ink-soft, #888); font-size: .82rem; line-height: 1.5; margin: .6rem 0 0; }
    192219</style>
    193220
Note: See TracChangeset for help on using the changeset viewer.