diff --git a/app/public/app.js b/app/public/app.js index dcfcea0..1f65c4f 100644 --- a/app/public/app.js +++ b/app/public/app.js @@ -119,7 +119,9 @@ const chapLabel = c => (c.num ? `Cap. ${c.num}` : 'Oneshot') + (c.title ? ` — const readUrl = (mangaId, chapterId, page) => `#/read/${mangaId}/${chapterId}${page != null ? `?page=${page + 1}` : ''}` // ---------- Router ---------- +let prevHash = '', curHash = '' // para volver atrás sin pasar por el lector async function router() { + if (location.hash !== curHash) { prevHash = curHash; curHash = location.hash } if (cleanup) { cleanup(); cleanup = null } document.body.classList.remove('reading') const [pathPart, query] = location.hash.slice(1).split('?') @@ -626,7 +628,9 @@ async function viewManga(id, langOverride) { if (!confirm(`¿Dejar de leer «${manga.title}»?\nSe quitará del historial, se borrará el progreso de sus capítulos y dejarás de seguirlo.`)) return await api(`/api/history/${id}`, { method: 'DELETE' }) toast('Quitado del historial') - viewManga(id, langOverride) + // Volver a donde se estaba (salvo el lector o la propia ficha, que lo volverían a marcar) o al inicio. + const back = prevHash && !prevHash.startsWith('#/read/') && !prevHash.startsWith(`#/manga/${id}`) && prevHash !== '#/login' + location.hash = back ? prevHash : '#/' }) // Cerrar el menú ⋯ al pulsar fuera. const menu = $('.menu', app) @@ -1331,15 +1335,20 @@ async function viewHistory() { const hist = await api('/api/history') app.innerHTML = `
Aún no has leído nada.
'} -