From ea1ec7ffab891f3d79cd5aec3e544f51a4c84cb7 Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Sat, 4 Feb 2023 22:17:53 +0100 Subject: [PATCH] Remove a couple of unnecessary `pdfDocument` checks in `web/app.js` These functions invoke the `PDFViewer.currentPageNumber` setter, which already checks that a `pdfDocument` is currently active. Also, given that they're event handlers for the First/Last-page buttons (in the SecondaryToolbar) they can't be invoked before the viewer has been fully initalized. --- web/app.js | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/web/app.js b/web/app.js index 58a3ea613..c4b04559d 100644 --- a/web/app.js +++ b/web/app.js @@ -2487,14 +2487,10 @@ function webViewerDownload() { PDFViewerApplication.downloadOrSave(); } function webViewerFirstPage() { - if (PDFViewerApplication.pdfDocument) { - PDFViewerApplication.page = 1; - } + PDFViewerApplication.page = 1; } function webViewerLastPage() { - if (PDFViewerApplication.pdfDocument) { - PDFViewerApplication.page = PDFViewerApplication.pagesCount; - } + PDFViewerApplication.page = PDFViewerApplication.pagesCount; } function webViewerNextPage() { PDFViewerApplication.pdfViewer.nextPage();