Files
f0ckm/views/chan/catalogue.html
T
2026-09-28 19:03:31 +02:00

481 lines
13 KiB
HTML

@include(snippets/header)
<div class="pagewrapper">
<div id="main" class="chan-page chan-catalogue-page">
<div class="chan-header-bar">
<div class="chan-brand-title">
<span class="chan-clover-icon"><i class="fa-solid fa-clover"></i></span>
<h1>/{{ board }}/ <span class="chan-subtitle">Catalogue</span></h1>
<span class="chan-thread-count-badge">{{ threads.length }} threads</span>
</div>
<!-- Quick board selector -->
<div class="chan-board-nav">
@each(common_boards as b)
<a href="/4/{{ b.id }}/catalogue" class="chan-board-pill {{ b.id === board ? 'active' : '' }}" title="{{ b.name }}">
/{{ b.id }}/
</a>
@endeach
<form class="chan-board-custom-form" onsubmit="event.preventDefault(); const b = document.getElementById('custom-board-input').value.trim().toLowerCase(); if(b) window.location.href='/4/' + b + '/catalogue';">
<input type="text" id="custom-board-input" placeholder="board…" maxlength="12" class="chan-custom-board-input" />
<button type="submit" class="chan-custom-board-btn" title="Go to board"><i class="fa-solid fa-arrow-right"></i></button>
</form>
</div>
<!-- Controls: Filter & Sort -->
<div class="chan-controls-bar">
<div class="chan-search-wrap">
<i class="fa-solid fa-magnifying-glass"></i>
<input type="text" id="chan-catalog-search" class="chan-search-input" placeholder="Filter threads by subject, text, or post #…" autocomplete="off" />
<button type="button" id="chan-search-clear" style="display:none;" title="Clear search"><i class="fa-solid fa-xmark"></i></button>
</div>
<div class="chan-sort-wrap">
<label for="chan-sort-select"><i class="fa-solid fa-arrow-down-wide-short"></i> Sort:</label>
<select id="chan-sort-select" class="chan-select">
<option value="bump">Bump Order</option>
<option value="replies">Most Replies</option>
<option value="images">Most Images</option>
<option value="date-new">Newest First</option>
<option value="date-old">Oldest First</option>
</select>
</div>
</div>
</div>
<!-- Catalogue Thread Grid -->
<div class="chan-catalogue-grid" id="chan-catalogue-grid">
@each(threads as t)
<div class="chan-thread-card" data-no="{{ t.no }}" data-replies="{{ t.replies }}" data-images="{{ t.images }}" data-time="{{ t.time }}" data-sticky="{{ t.sticky ? 1 : 0 }}">
<a href="/4/{{ board }}/{{ t.no }}" class="chan-thread-thumb-link">
@if(t.thumb)
<img src="{{ t.thumb }}" alt="Thread #{{ t.no }}" loading="lazy" class="chan-thread-thumb" onerror="this.style.opacity='0.2';" />
@else
<div class="chan-thread-thumb-empty"><i class="fa-solid fa-file"></i></div>
@endif
<div class="chan-card-badges">
@if(t.sticky)
<span class="chan-card-badge chan-badge-sticky" title="Sticky"><i class="fa-solid fa-thumbtack"></i></span>
@endif
@if(t.closed)
<span class="chan-card-badge chan-badge-closed" title="Closed"><i class="fa-solid fa-lock"></i></span>
@endif
@if(t.local_id)
<span class="chan-card-badge chan-badge-rehosted" title="OP rehosted on f0ckm as /{{ t.local_path || t.local_id }}" style="background: rgba(16, 185, 129, 0.9); color: #fff; font-weight: 700;"><i class="fa-solid fa-check"></i> /{{ t.local_path || t.local_id }}</span>
@endif
<span class="chan-card-badge chan-badge-stats">
<span title="Replies"><i class="fa-solid fa-comment"></i> {{ t.replies }}</span>
<span title="Images"><i class="fa-solid fa-image"></i> {{ t.images }}</span>
</span>
</div>
</a>
<div class="chan-thread-info">
<a href="/4/{{ board }}/{{ t.no }}" class="chan-thread-title">
@if(t.sub)
<strong class="chan-subject">{{ t.sub }}</strong>
@else
<span class="chan-no-sub">No. {{ t.no }}</span>
@endif
</a>
@if(t.com)
<p class="chan-teaser">{{ t.com }}</p>
@endif
</div>
</div>
@endeach
</div>
<div id="chan-no-results" class="chan-empty-state" style="display: none;">
<i class="fa-solid fa-search"></i>
<p>No threads match your search filter.</p>
</div>
</div>
</div>
<style>
.chan-catalogue-page {
max-width: 1400px;
margin: 0 auto;
padding: 20px 15px 60px;
}
.chan-header-bar {
display: flex;
flex-direction: column;
gap: 15px;
margin-bottom: 25px;
background: var(--bg-card, rgba(25, 25, 25, 0.85));
border: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
border-radius: 12px;
padding: 18px 20px;
backdrop-filter: blur(8px);
}
.chan-brand-title {
display: flex;
align-items: center;
gap: 12px;
flex-wrap: wrap;
}
.chan-clover-icon {
font-size: 1.8rem;
color: #4ade80;
display: inline-flex;
align-items: center;
}
.chan-brand-title h1 {
font-size: 1.6rem;
font-weight: 800;
margin: 0;
color: var(--text-main, #fff);
letter-spacing: -0.5px;
}
.chan-subtitle {
font-weight: 400;
opacity: 0.6;
font-size: 1.2rem;
margin-left: 4px;
}
.chan-thread-count-badge {
font-size: 0.8rem;
font-weight: 600;
padding: 3px 10px;
border-radius: 20px;
background: rgba(74, 222, 128, 0.15);
color: #4ade80;
border: 1px solid rgba(74, 222, 128, 0.3);
}
/* Board nav */
.chan-board-nav {
display: flex;
align-items: center;
gap: 6px;
flex-wrap: wrap;
}
.chan-board-pill {
padding: 4px 12px;
border-radius: 6px;
font-size: 0.85rem;
font-weight: 600;
background: rgba(255, 255, 255, 0.06);
color: var(--text-muted, #aaa);
border: 1px solid rgba(255, 255, 255, 0.08);
text-decoration: none;
transition: all 0.2s;
}
.chan-board-pill:hover {
background: rgba(255, 255, 255, 0.12);
color: #fff;
border-color: rgba(255, 255, 255, 0.2);
}
.chan-board-pill.active {
background: #4ade80;
color: #111;
border-color: #4ade80;
font-weight: 700;
}
.chan-board-custom-form {
display: inline-flex;
align-items: center;
gap: 4px;
margin-left: 4px;
}
.chan-custom-board-input {
width: 75px;
padding: 4px 8px;
background: rgba(255, 255, 255, 0.05);
border: 1px solid rgba(255, 255, 255, 0.12);
border-radius: 6px;
color: #fff;
font-size: 0.85rem;
outline: none;
}
.chan-custom-board-input:focus {
border-color: #4ade80;
}
.chan-custom-board-btn {
background: rgba(74, 222, 128, 0.15);
color: #4ade80;
border: 1px solid rgba(74, 222, 128, 0.3);
border-radius: 6px;
padding: 4px 8px;
cursor: pointer;
font-size: 0.8rem;
transition: all 0.2s;
}
.chan-custom-board-btn:hover {
background: #4ade80;
color: #111;
}
/* Controls */
.chan-controls-bar {
display: flex;
align-items: center;
gap: 15px;
flex-wrap: wrap;
justify-content: space-between;
border-top: 1px solid rgba(255, 255, 255, 0.06);
padding-top: 12px;
}
.chan-search-wrap {
position: relative;
flex: 1;
min-width: 250px;
display: flex;
align-items: center;
}
.chan-search-wrap i.fa-magnifying-glass {
position: absolute;
left: 12px;
color: #777;
pointer-events: none;
}
.chan-search-input {
width: 100%;
padding: 8px 34px 8px 34px;
background: rgba(255, 255, 255, 0.04);
border: 1px solid rgba(255, 255, 255, 0.1);
border-radius: 8px;
color: #fff;
font-size: 0.9rem;
outline: none;
transition: all 0.2s;
}
.chan-search-input:focus {
border-color: #4ade80;
background: rgba(255, 255, 255, 0.07);
}
#chan-search-clear {
position: absolute;
right: 10px;
background: none;
border: none;
color: #888;
cursor: pointer;
padding: 4px;
}
.chan-sort-wrap {
display: flex;
align-items: center;
gap: 8px;
color: #aaa;
font-size: 0.85rem;
}
.chan-select {
padding: 6px 12px;
background: rgba(255, 255, 255, 0.06);
border: 1px solid rgba(255, 255, 255, 0.12);
border-radius: 8px;
color: #fff;
font-size: 0.85rem;
outline: none;
cursor: pointer;
}
.chan-select option {
background: #1a1a1a;
color: #fff;
}
/* Grid */
.chan-catalogue-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
gap: 16px;
}
.chan-thread-card {
background: var(--bg-card, rgba(25, 25, 25, 0.85));
border: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
border-radius: 10px;
overflow: hidden;
display: flex;
flex-direction: column;
transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.chan-thread-card:hover {
transform: translateY(-3px);
border-color: rgba(74, 222, 128, 0.4);
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}
.chan-thread-thumb-link {
position: relative;
width: 100%;
aspect-ratio: 16 / 10;
background: #0d0d0d;
display: flex;
align-items: center;
justify-content: center;
overflow: hidden;
text-decoration: none;
}
.chan-thread-thumb {
width: 100%;
height: 100%;
object-fit: cover;
transition: transform 0.3s ease;
}
.chan-thread-card:hover .chan-thread-thumb {
transform: scale(1.04);
}
.chan-thread-thumb-empty {
font-size: 2rem;
color: #333;
}
.chan-card-badges {
position: absolute;
bottom: 6px;
left: 6px;
right: 6px;
display: flex;
align-items: center;
justify-content: space-between;
pointer-events: none;
}
.chan-card-badge {
background: rgba(0, 0, 0, 0.75);
backdrop-filter: blur(4px);
padding: 2px 7px;
border-radius: 4px;
font-size: 0.75rem;
font-weight: 600;
color: #eee;
display: inline-flex;
align-items: center;
gap: 6px;
border: 1px solid rgba(255, 255, 255, 0.1);
}
.chan-badge-sticky {
color: #4ade80;
border-color: rgba(74, 222, 128, 0.3);
}
.chan-badge-closed {
color: #ff6b6b;
border-color: rgba(255, 107, 107, 0.3);
}
.chan-badge-stats {
margin-left: auto;
}
.chan-thread-info {
padding: 10px 12px 14px;
display: flex;
flex-direction: column;
gap: 6px;
flex: 1;
}
.chan-thread-title {
text-decoration: none;
color: #fff;
font-size: 0.88rem;
line-height: 1.35;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
}
.chan-subject {
color: #4ade80;
font-weight: 700;
}
.chan-no-sub {
color: #888;
font-size: 0.8rem;
}
.chan-teaser {
margin: 0;
font-size: 0.78rem;
color: #888;
line-height: 1.35;
display: -webkit-box;
-webkit-line-clamp: 3;
-webkit-box-orient: vertical;
overflow: hidden;
word-break: break-word;
}
.chan-empty-state {
text-align: center;
padding: 60px 20px;
color: #777;
font-size: 1.1rem;
}
.chan-empty-state i {
font-size: 2.5rem;
margin-bottom: 12px;
opacity: 0.4;
display: block;
}
</style>
<script>
(() => {
const searchInput = document.getElementById('chan-catalog-search');
const searchClear = document.getElementById('chan-search-clear');
const sortSelect = document.getElementById('chan-sort-select');
const grid = document.getElementById('chan-catalogue-grid');
const noResults = document.getElementById('chan-no-results');
if (!grid) return;
const originalCards = Array.from(grid.querySelectorAll('.chan-thread-card'));
function filterAndSort() {
const q = (searchInput?.value || '').trim().toLowerCase();
const sort = sortSelect?.value || 'bump';
if (searchClear) {
searchClear.style.display = q ? 'block' : 'none';
}
let visibleCards = originalCards.filter(card => {
if (!q) return true;
const no = card.dataset.no || '';
const text = card.textContent.toLowerCase();
return no.includes(q) || text.includes(q);
});
// Sort
visibleCards.sort((a, b) => {
const stickyA = parseInt(a.dataset.sticky || 0, 10);
const stickyB = parseInt(b.dataset.sticky || 0, 10);
if (stickyA !== stickyB) return stickyB - stickyA; // Stickies always first
if (sort === 'replies') {
return parseInt(b.dataset.replies || 0, 10) - parseInt(a.dataset.replies || 0, 10);
} else if (sort === 'images') {
return parseInt(b.dataset.images || 0, 10) - parseInt(a.dataset.images || 0, 10);
} else if (sort === 'date-new') {
return parseInt(b.dataset.time || 0, 10) - parseInt(a.dataset.time || 0, 10);
} else if (sort === 'date-old') {
return parseInt(a.dataset.time || 0, 10) - parseInt(b.dataset.time || 0, 10);
}
// Bump order: preserve original order
return originalCards.indexOf(a) - originalCards.indexOf(b);
});
originalCards.forEach(c => c.style.display = 'none');
visibleCards.forEach(c => {
c.style.display = 'flex';
grid.appendChild(c);
});
if (noResults) {
noResults.style.display = visibleCards.length === 0 ? 'block' : 'none';
}
}
if (searchInput) {
searchInput.addEventListener('input', filterAndSort);
}
if (searchClear) {
searchClear.addEventListener('click', () => {
searchInput.value = '';
filterAndSort();
searchInput.focus();
});
}
if (sortSelect) {
sortSelect.addEventListener('change', filterAndSort);
}
})();
</script>
@include(snippets/footer)