Changeset 476d6e7 in Klonkt


Ignore:
Timestamp:
07/16/2026 12:20:51 PM (8 weeks ago)
Author:
Robin <roboburr@…>
Branches:
main
Children:
1cc8c85
Parents:
af21002
git-author:
Robin <roboburr@…> (07/13/2026 05:36:18 AM)
git-committer:
Robin <roboburr@…> (07/16/2026 12:20:51 PM)
Message:

Spoor A step 3a: extract nsfw-veil partial (7 copies → 1)

The NSFW veil contents (🔞 label + reveal button) were copy-pasted in 7 spots
across post-card, post-tile, post.ejs (related) and news.ejs, each with its own
content_warning variable. Extract the identical inner block into
partials/nsfw-veil.ejs; each caller keeps its exact wrapper element, so the
rendered HTML is byte-identical (verified live: the homepage card emits the
same veil markup as before, both include paths resolve).

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

Location:
src/views
Files:
1 added
4 edited

Legend:

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

    raf21002 r476d6e7  
    110110          %>
    111111          <% if (_nsfwText) { %>
    112             <div class="tl-content nsfw-media"><span class="nsfw-veil"><span class="nsfw-veil-label">🔞 <%= p.cw || t('post.nsfw_warning') %></span><span class="nsfw-veil-btn"><%= t('post.nsfw_show') %></span></span><%- p.content %></div>
     112            <div class="tl-content nsfw-media"><span class="nsfw-veil"><%- include('../partials/nsfw-veil', { cw: p.cw }) %></span><%- p.content %></div>
    113113          <% } else { %>
    114114            <div class="tl-content"><%- p.content %></div>
     
    127127                players here. Posts without a Klonkt embed (e.g. a plain remote audio) keep them. */ %>
    128128          <% if (!p.embedHtml && !p.embedUrl) { auds.forEach(function(m){ %><audio class="tl-media-audio" src="<%= m.url %>" controls preload="none"></audio><% }); } %>
    129           <% if (_nsfwVisual) { %><div class="nsfw-veil"><span class="nsfw-veil-label">🔞 <%= p.cw || t('post.nsfw_warning') %></span><span class="nsfw-veil-btn"><%= t('post.nsfw_show') %></span></div></div><% } %>
     129          <% if (_nsfwVisual) { %><div class="nsfw-veil"><%- include('../partials/nsfw-veil', { cw: p.cw }) %></div></div><% } %>
    130130
    131131          <% if (p.embedHtml) { %><div class="tl-embed"><%- p.embedHtml %></div><% } %>
  • src/views/pages/post.ejs

    raf21002 r476d6e7  
    209209               hx-push-url="/<%= rp.slug %>" hx-indicator="#pcms-loading"<% } %>>
    210210              <% if (rp.cover_image_url) { %>
    211                 <span class="post-related-cover<%= rp.nsfw ? ' nsfw-media' : '' %>" aria-hidden="true"><img class="post-related-img" src="<%= rp.cover_image_url %>" alt="" loading="lazy" decoding="async"<% if (rp.cover_video_url) { %> data-ios-mp4="<%= rp.cover_video_url %>"<% } %>><% if (rp.nsfw) { %><span class="nsfw-veil"><span class="nsfw-veil-label">🔞 <%= rp.content_warning || t('post.nsfw_warning') %></span><span class="nsfw-veil-btn"><%= t('post.nsfw_show') %></span></span><% } %></span>
     211                <span class="post-related-cover<%= rp.nsfw ? ' nsfw-media' : '' %>" aria-hidden="true"><img class="post-related-img" src="<%= rp.cover_image_url %>" alt="" loading="lazy" decoding="async"<% if (rp.cover_video_url) { %> data-ios-mp4="<%= rp.cover_video_url %>"<% } %>><% if (rp.nsfw) { %><span class="nsfw-veil"><%- include('../partials/nsfw-veil', { cw: rp.content_warning }) %></span><% } %></span>
    212212              <% } else { %>
    213                 <span class="post-related-cover post-related-cover--empty<%= rp.nsfw ? ' nsfw-media' : '' %>" aria-hidden="true"><% if (rp.nsfw) { %><span class="nsfw-veil"><span class="nsfw-veil-label">🔞 <%= rp.content_warning || t('post.nsfw_warning') %></span><span class="nsfw-veil-btn"><%= t('post.nsfw_show') %></span></span><% } %></span>
     213                <span class="post-related-cover post-related-cover--empty<%= rp.nsfw ? ' nsfw-media' : '' %>" aria-hidden="true"><% if (rp.nsfw) { %><span class="nsfw-veil"><%- include('../partials/nsfw-veil', { cw: rp.content_warning }) %></span><% } %></span>
    214214              <% } %>
    215215              <span class="post-related-meta">
  • src/views/partials/post-card.ejs

    raf21002 r476d6e7  
    5454           alt="" loading="lazy" decoding="async"<% if (post.cover_video_url) { %> data-ios-mp4="<%= post.cover_video_url %>"<% } %>>
    5555      <% } else if (post.cover_video_url) { %><video src="<%= post.cover_video_url %>" poster="<%= thumb(post.cover_video_url, 480) %>" autoplay loop muted playsinline></video><% } %>
    56       <% if (post.nsfw) { %><span class="nsfw-veil"><span class="nsfw-veil-label">🔞 <%= post.content_warning || t('post.nsfw_warning') %></span><span class="nsfw-veil-btn"><%= t('post.nsfw_show') %></span></span><% } %>
     56      <% if (post.nsfw) { %><span class="nsfw-veil"><%- include('nsfw-veil', { cw: post.content_warning }) %></span><% } %>
    5757    </a>
    5858  <% } else if (post.nsfw) { %>
     
    6060       <% if (_ext) { %>target="_blank" rel="noopener"<% } else { %>hx-get="<%= _href %>?partial=1" hx-target="#pcms-main" hx-swap="innerHTML" hx-push-url="<%= _href %>" hx-indicator="#pcms-loading"<% } %>
    6161       aria-label="<%= post.title || '(zonder titel)' %>" tabindex="-1">
    62       <span class="nsfw-veil"><span class="nsfw-veil-label">🔞 <%= post.content_warning || t('post.nsfw_warning') %></span><span class="nsfw-veil-btn"><%= t('post.nsfw_show') %></span></span>
     62      <span class="nsfw-veil"><%- include('nsfw-veil', { cw: post.content_warning }) %></span>
    6363    </a>
    6464  <% } %>
  • src/views/partials/post-tile.ejs

    raf21002 r476d6e7  
    3939    <% if (_src) { %><span class="grid-tile-gradient-src">van <%= _src %></span><% } %>
    4040  <% } %>
    41   <% if (post.nsfw) { %><div class="nsfw-veil"><span class="nsfw-veil-label">🔞 <%= post.content_warning || t('post.nsfw_warning') %></span><span class="nsfw-veil-btn"><%= t('post.nsfw_show') %></span></div><% } %>
     41  <% if (post.nsfw) { %><div class="nsfw-veil"><%- include('nsfw-veil', { cw: post.content_warning }) %></div><% } %>
    4242</a>
Note: See TracChangeset for help on using the changeset viewer.