diff --git a/crates/pdftract-cli/src/inspect/frontend/app.js b/crates/pdftract-cli/src/inspect/frontend/app.js index 3fd70fe..32130fa 100644 --- a/crates/pdftract-cli/src/inspect/frontend/app.js +++ b/crates/pdftract-cli/src/inspect/frontend/app.js @@ -641,7 +641,15 @@ function nextPage(){ function updateNavState(){ document.getElementById('btn-prev').disabled=currentPage<=0; - document.getElementById('btn-next').disabled=currentPage>=totalPages-1 + document.getElementById('btn-next').disabled=currentPage>=totalPages-1; + updatePageIndicator() +} + +function updatePageIndicator(){ + const indicator=document.getElementById('page-indicator'); + if(indicator){ + indicator.textContent=`Page ${currentPage+1} of ${totalPages}`; + } } function renderThumbnails(){ @@ -699,6 +707,25 @@ function updateActiveThumbnail(){ t.classList.toggle('active',parseInt(t.dataset.index)===currentPage); t.disabled=false; }); + prefetchAdjacentPages() +} + +function prefetchAdjacentPages(){ + // Prefetch previous page + if(currentPage>0){ + prefetchPage(currentPage-1); + } + // Prefetch next page + if(currentPage{}); + // Prefetch the SVG + fetch(`/api/page/${index}/svg`).catch(()=>{}); } function scrollPage(delta){ diff --git a/crates/pdftract-cli/src/inspect/frontend/index.html b/crates/pdftract-cli/src/inspect/frontend/index.html index 46e2d8a..b25821f 100644 --- a/crates/pdftract-cli/src/inspect/frontend/index.html +++ b/crates/pdftract-cli/src/inspect/frontend/index.html @@ -15,6 +15,7 @@
+Page 1 of 1 diff --git a/crates/pdftract-cli/src/inspect/frontend/style.css b/crates/pdftract-cli/src/inspect/frontend/style.css index bbb11ba..23fea77 100644 --- a/crates/pdftract-cli/src/inspect/frontend/style.css +++ b/crates/pdftract-cli/src/inspect/frontend/style.css @@ -15,6 +15,7 @@ body{font-family:system-ui,-apple-system,sans-serif;font-size:14px;line-height:1 .btn:hover{background:#f0f0f0} .btn:active{background:#e0e0e0} .btn:disabled{opacity:.5;cursor:not-allowed} +.page-indicator{font-size:13px;font-weight:500;color:#666;white-space:nowrap;padding:0 8px;min-width:100px;text-align:center} .search-input{flex:1;max-width:300px;padding:6px 10px;border:1px solid #ddd;border-radius:4px;font-size:13px;font-family:inherit} .search-input:focus{outline:none;border-color:#0078d4;box-shadow:0 0 0 2px rgba(0,120,212,.2)} .match-count{font-size:12px;color:#666;white-space:nowrap;padding:0 8px}