From 39a187b6da89f05a2cffd3c2e0eeeac5c23e21e2 Mon Sep 17 00:00:00 2001 From: Anthony Stirling <77850077+Frooodle@users.noreply.github.com> Date: Sat, 19 Aug 2023 16:59:34 +0100 Subject: [PATCH] darkmode fix for account and pagenumber support filename --- .../api/other/PageNumbersController.java | 2 +- src/main/resources/application.properties | 1 - src/main/resources/messages_en_GB.properties | 3 + src/main/resources/static/css/dark-mode.css | 53 ++++++++++- src/main/resources/static/js/darkmode.js | 95 ++++++++++--------- src/main/resources/templates/account.html | 10 +- .../templates/other/add-page-numbers.html | 4 +- 7 files changed, 111 insertions(+), 57 deletions(-) diff --git a/src/main/java/stirling/software/SPDF/controller/api/other/PageNumbersController.java b/src/main/java/stirling/software/SPDF/controller/api/other/PageNumbersController.java index 9096e64e..92aa8d91 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/other/PageNumbersController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/other/PageNumbersController.java @@ -116,7 +116,7 @@ public class PageNumbersController { Rectangle pageSize = page.getPageSize(); PdfCanvas pdfCanvas = new PdfCanvas(page.newContentStreamAfter(), page.getResources(), pdfDoc); - String text = customText != null ? customText.replace("{n}", String.valueOf(pageNumber)).replace("{total}", String.valueOf(pdfDoc.getNumberOfPages())) : String.valueOf(pageNumber); + String text = customText != null ? customText.replace("{n}", String.valueOf(pageNumber)).replace("{total}", String.valueOf(pdfDoc.getNumberOfPages())).replace("{filename}", file.getOriginalFilename().replaceFirst("[.][^.]+$", "")) : String.valueOf(pageNumber); PdfFont font = PdfFontFactory.createFont(StandardFonts.HELVETICA); float textWidth = font.getWidth(text, fontSize); diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 20638f7d..da508e20 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -20,7 +20,6 @@ server.error.include-message=always #logging.level.org.springframework=DEBUG #logging.level.org.springframework.security=DEBUG -#login.enabled=true server.servlet.session.tracking-modes=cookie server.servlet.context-path=${APP_ROOT_PATH:/} diff --git a/src/main/resources/messages_en_GB.properties b/src/main/resources/messages_en_GB.properties index 58fc107f..5ca0bd74 100644 --- a/src/main/resources/messages_en_GB.properties +++ b/src/main/resources/messages_en_GB.properties @@ -374,6 +374,9 @@ addPageNumbers.selectText.3=Position addPageNumbers.selectText.4=Starting Number addPageNumbers.selectText.5=Pages to Number addPageNumbers.selectText.6=Custom Text +addPageNumbers.customTextDesc=Custom Text +addPageNumbers.numberPagesDesc=Which pages to number, default 'all', also accepts 1-5 or 2,5,9 etc +addPageNumbers.customNumberDesc=Defaults to {n}, also accepts 'Page {n} of {total}', 'Text-{n}', '{filename}-{n} addPageNumbers.submit=Add Page Numbers diff --git a/src/main/resources/static/css/dark-mode.css b/src/main/resources/static/css/dark-mode.css index 0e78e4ae..cf2e028d 100644 --- a/src/main/resources/static/css/dark-mode.css +++ b/src/main/resources/static/css/dark-mode.css @@ -1,5 +1,5 @@ /* Dark Mode Styles */ -body { +body, select, textarea { --body-background-color: 51, 51, 51; --base-font-color: 255, 255, 255; background-color: rgb(var(--body-background-color)) !important; @@ -41,4 +41,53 @@ body { .favorite-icon img { filter: brightness(0) invert(1) !important; -} \ No newline at end of file +} +table thead { + background-color: #333 !important; + border: 1px solid #444; +} +table th, table td { + border: 1px solid #444 !important; + color: white; +} +.btn { + background-color: #444 !important; + border: none; + color: #fff !important; +} +.btn-primary { + background-color: #007bff !important; + border: none; + color: #fff !important; +} +.btn-secondary { + background-color: #6c757d !important; + border: none; + color: #fff !important; +} +.btn-info { + background-color: #17a2b8 !important; + border: none; + color: #fff !important; +} +.btn-danger { + background-color: #dc3545 !important; + border: none; + color: #fff !important; +} +.btn-outline-secondary { + color: #fff !important; + border-color: #fff; +} +.btn-outline-secondary:hover { + background-color: #444 !important; + color: #007bff !important; + border-color: #007bff; +} +.blackwhite-icon { + filter: brightness(0) invert(1); +} +hr { + border-color: rgba(255, 255, 255, 0.6); /* semi-transparent white */ + background-color: rgba(255, 255, 255, 0.6); /* for some browsers that might use background instead of border for