Compare commits
No commits in common. "38451514c26f236c9d6a502bdb22931c081b5496" and "1026ed09a7aa28938c0becd96c547c6a9d76d121" have entirely different histories.
38451514c2
...
1026ed09a7
2 changed files with 25 additions and 12 deletions
|
|
@ -27,13 +27,11 @@ def book_list(request):
|
|||
b['uploaded_at'] = b['uploaded_at'].isoformat()
|
||||
# Include saved scroll_fraction for each book
|
||||
progress_map = {
|
||||
p.book_id: (p.scroll_fraction, p.updated_at)
|
||||
p.book_id: p.scroll_fraction
|
||||
for p in EBookProgress.objects.filter(user=request.user)
|
||||
}
|
||||
for b in books:
|
||||
prog = progress_map.get(b['id'])
|
||||
b['scroll_fraction'] = prog[0] if prog else 0.0
|
||||
b['last_read'] = prog[1].isoformat() if prog else None
|
||||
b['scroll_fraction'] = progress_map.get(b['id'], 0.0)
|
||||
return JsonResponse(books, safe=False)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -2644,18 +2644,12 @@ async function loadBookList() {
|
|||
const metaBuf = await decryptBytes(key, b.meta_iv, b.meta_ct);
|
||||
const meta = JSON.parse(new TextDecoder().decode(metaBuf));
|
||||
bookMetaCache[b.id] = {title: meta.title || '?', author: meta.author || '', type: meta.type || 'epub'};
|
||||
decrypted.push({id: b.id, title: meta.title || '?', author: meta.author || '', type: meta.type || 'epub', scroll_fraction: b.scroll_fraction, uploaded_at: b.uploaded_at, last_read: b.last_read || null, keyOk: true});
|
||||
decrypted.push({id: b.id, title: meta.title || '?', author: meta.author || '', type: meta.type || 'epub', scroll_fraction: b.scroll_fraction, uploaded_at: b.uploaded_at, keyOk: true});
|
||||
} catch (e) {
|
||||
bookMetaCache[b.id] = {title: `Book #${b.id}`, author: '', type: 'epub'};
|
||||
decrypted.push({id: b.id, title: `Book #${b.id}`, author: '', type: 'epub', scroll_fraction: b.scroll_fraction, uploaded_at: b.uploaded_at, last_read: b.last_read || null, keyOk: false});
|
||||
decrypted.push({id: b.id, title: `Book #${b.id}`, author: '', type: 'epub', scroll_fraction: b.scroll_fraction, uploaded_at: b.uploaded_at, keyOk: false});
|
||||
}
|
||||
}
|
||||
decrypted.sort((a, b) => {
|
||||
if (a.last_read && b.last_read) return b.last_read.localeCompare(a.last_read);
|
||||
if (a.last_read) return -1;
|
||||
if (b.last_read) return 1;
|
||||
return b.uploaded_at.localeCompare(a.uploaded_at);
|
||||
});
|
||||
renderBookList(decrypted);
|
||||
} catch (e) {
|
||||
if (listEl) listEl.innerHTML = `<p class="muted">Error loading books: ${e.message}</p>`;
|
||||
|
|
@ -2965,6 +2959,16 @@ async function openBook(bookId) {
|
|||
// Apply reader settings (theme, font size, etc.)
|
||||
applyReaderSettings(isPdfBook);
|
||||
|
||||
// Enable PDF paginated mode if configured (auto on mobile)
|
||||
if (isPdfBook && readerSettings.pdfPaginated) {
|
||||
enterPdfPaginatedMode();
|
||||
}
|
||||
|
||||
// Wire highlight selection listener for EPUB
|
||||
if (!isPdfBook) {
|
||||
contentEl.addEventListener('mouseup', handleReaderSelection);
|
||||
}
|
||||
|
||||
// Swipe for PDF paginated
|
||||
contentEl.addEventListener('touchstart', e => { _touchStartX = e.touches[0].clientX; }, {passive: true});
|
||||
contentEl.addEventListener('touchend', e => {
|
||||
|
|
@ -3377,6 +3381,7 @@ function toggleSettingsPanel() {
|
|||
panel.innerHTML = `
|
||||
<label>Zoom <input type="range" id="rs-zoom" min="50" max="200" step="10" value="${readerSettings.pdfZoom}"> <span id="rs-zoom-val">${readerSettings.pdfZoom}%</span></label>
|
||||
<button class="btn btn-sm ${readerSettings.pdfInverted ? 'active' : ''}" id="rs-invert">Invert</button>
|
||||
<button class="btn btn-sm ${readerSettings.pdfPaginated ? 'active' : ''}" id="rs-paginated">Paginated</button>
|
||||
`;
|
||||
}
|
||||
|
||||
|
|
@ -3448,6 +3453,16 @@ function toggleSettingsPanel() {
|
|||
saveReaderSettings();
|
||||
});
|
||||
|
||||
panel.querySelector('#rs-paginated').addEventListener('click', function () {
|
||||
readerSettings.pdfPaginated = !readerSettings.pdfPaginated;
|
||||
this.classList.toggle('active', readerSettings.pdfPaginated);
|
||||
saveReaderSettings();
|
||||
if (readerSettings.pdfPaginated) {
|
||||
enterPdfPaginatedMode();
|
||||
} else {
|
||||
exitPdfPaginatedMode();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue