From b03603b5a7a95de2c36ca55da07d70f80b1ccb47 Mon Sep 17 00:00:00 2001 From: linxuhe Date: Sat, 9 Nov 2024 15:28:31 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E6=AC=A2=E8=BF=8E=E7=95=8C=E9=9D=A2?= =?UTF-8?q?=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resources/static/css/welcome-message.css | 22 +++++++++++++++++++ src/main/resources/templates/home.html | 6 +++++ 2 files changed, 28 insertions(+) create mode 100644 src/main/resources/static/css/welcome-message.css diff --git a/src/main/resources/static/css/welcome-message.css b/src/main/resources/static/css/welcome-message.css new file mode 100644 index 00000000000..a0348d9fe6e --- /dev/null +++ b/src/main/resources/static/css/welcome-message.css @@ -0,0 +1,22 @@ +.welcome-message { + text-align: center; + margin-top: 50px; + margin-bottom: 20px; + padding: 20px; + background-color: #f8f9fa; /* Light gray background */ + border-radius: 8px; /* Rounded corners */ + box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); /* Subtle shadow for depth */ +} + +.welcome-message h1 { + color: #333; /* Dark text color */ + font-size: 2.5rem; /* Large font size for the title */ + margin-bottom: 0.5rem; +} + +.welcome-message p { + color: #666; /* Slightly darker than the background */ + font-size: 1.1rem; /* Medium font size for the paragraphs */ + margin-bottom: 1rem; /* Spacing between paragraphs */ + line-height: 1.5; /* Line height for better readability */ +} \ No newline at end of file diff --git a/src/main/resources/templates/home.html b/src/main/resources/templates/home.html index 43aebc99b53..1519960c032 100644 --- a/src/main/resources/templates/home.html +++ b/src/main/resources/templates/home.html @@ -4,9 +4,15 @@ + +
+

Welcome to Stirling PDF!

+

This is your local hosting environment. Local hosting allows you to run web applications directly from your computer without the need for an internet connection. It's a great way to develop, test, and use web applications privately and securely.

+

Get started by exploring the tools available on this platform.

+
From 2259db2c1f0952e51ada8afca4ca754d0e358644 Mon Sep 17 00:00:00 2001 From: linxuhe Date: Thu, 14 Nov 2024 13:10:22 +0800 Subject: [PATCH 2/5] add blankPage --- src/main/resources/static/css/multi-tool.css | 19 ++ src/main/resources/templates/multi-tool.html | 231 +++++++++++++------ 2 files changed, 175 insertions(+), 75 deletions(-) diff --git a/src/main/resources/static/css/multi-tool.css b/src/main/resources/static/css/multi-tool.css index 9687470a899..f84491855eb 100644 --- a/src/main/resources/static/css/multi-tool.css +++ b/src/main/resources/static/css/multi-tool.css @@ -224,3 +224,22 @@ label { .tool-header { margin: 0.5rem 1rem 2rem; } +.page-container { + position: relative; + margin-bottom: 20px; + border: 1px solid #ccc; + border-radius: 8px; + overflow: hidden; + box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); +} + +.page-container img { + width: 100%; + height: auto; + display: block; +} + +.blank-page-image { + width: 100%; + height: auto; + border: 1px solid diff --git a/src/main/resources/templates/multi-tool.html b/src/main/resources/templates/multi-tool.html index 261a4ca88df..ccf802f840e 100644 --- a/src/main/resources/templates/multi-tool.html +++ b/src/main/resources/templates/multi-tool.html @@ -1,75 +1,74 @@ + xmlns:th="https://www.thymeleaf.org"> - + + Multi-Tool PDF Editor + + + -
-
-
- -

-
-
-
-
-
- construction - +
+
+ +

+
+
+
+
+
+ construction + Multi-Tool PDF Editor +
+
+
+ +
-
-
- - -
-
- - + - + - + - + - + + -
+
-
-
-
-
-
- -
- File Page -
-
+
+
+
+
+
@@ -77,40 +76,122 @@
-
-
- - - + + From 8f786b9eefcc83f0c414231ee5e51df726c3a034 Mon Sep 17 00:00:00 2001 From: linxuhe Date: Thu, 14 Nov 2024 13:39:24 +0800 Subject: [PATCH 3/5] add blankPage --- axa | 259 +++++++++++++++++++ src/main/resources/static/css/multi-tool.css | 1 + 2 files changed, 260 insertions(+) create mode 100644 axa diff --git a/axa b/axa new file mode 100644 index 00000000000..7d6be9fc92e --- /dev/null +++ b/axa @@ -0,0 +1,259 @@ +8dcf7725 (HEAD -> main) Merge branch 'main' of github.com:linhexu/Stirling-PDF +2259db2c add blankPage +3edd498f (origin/main, origin/HEAD) Merge branch 'main' into main +2f92aa90 :floppy_disk: Update Version (#2205) +ba8dd040 Update build.gradle +c13509cf :floppy_disk: Update Version (#2204) +0ab02e6c Update build.gradle +af52652a Rename release-helm-charts.yml to release-helm-charts.yml-disabled +e534f022 Rename lint-helm-charts.yml to lint-helm-charts.yml-disabled +84867a7a Fix: Card has no favorite icon (#2203) +b03603b5 欢迎界面提示 +e97cb9d4 (feature/front/main) Add option to insert blank page between pages in Multi-tool (#2194) (#2201) +1b0c1b6c Searchbar in nav auto select, and exe nolonger disable CLI (#2197) +7eea7fb3 [Feature] Set Executor Instances limits dynamically from properties (#2193) +c921b5d7 :memo: Update README: Translation Progress Table (#2190) +26ec0c5d Update and improve zh_TW Traditional Chinese locale (#2188) +404e3146 Added input sanitization to fix self-xss issue (#2189) +0c0f61aa fix remmeber me (#2184) +40ffb655 feat: add helm chart github action (#2113) +645c5ff3 :memo: Update README: Translation Progress Table (#2165) +83db7a22 Fix: Navbar layout overflow (#2162) +ebfccfa8 Corrects AI generated translation (#2166) +aa810163 Completed translations for 19 languages using AI (#2164) +dcb69ad6 :memo: Update README: Translation Progress Table (#2160) +1a190249 Fix: Auto language detection #2122 (#2148) +68c96012 Update messages_it_IT.properties (#2161) +7ec343d9 Fix: Add missing .map file for minified files (#2156) +6f42d976 Fix: Path correction to draggable.js #2154 + little makeup (#2159) +cf13803f Fix: redeclaration of const and add: tranlation placeholder for Session Expiry Messages (#2158) +a8d0d1a8 re-config labeler & add new labels (#2153) +a5aac01b fixed minor bugs in Markdown (#2152) +2be14788 Update messages_it_IT.properties (#2146) +217404be :memo: Update README: Translation Progress Table (#2136) +d3dc3e07 Update translation files (#2145) +94702dba fix signature logo not loading and add option to disable it (#2143) +febc3cf4 Update pull_request_template.md +c5abb474 navbar.css: prevent overlapping of elements (#2140) +0e3c9bcc Update README.md +384c3ee8 :floppy_disk: Update Version (#2139) +5f7a0537 Update build.gradle +5aa56284 [bug fix] Update compress-pdf.html (#2138) +0d91bca9 Update messages_it_IT.properties (#2135) +8e885914 chore(helm): bump chart version according to semver (#2109) +3e051d01 Update 3rd Party Licenses (#2134) +4a9b16ff Bump org.springframework.security:spring-security-saml2-service-provider from 6.3.3 to 6.3.4 (#2052) +a7082ecd :floppy_disk: Update Version (#2132) +966e6a49 :memo: Update README: Translation Progress Table (#2133) +27d2681a Feature/save signs (#2127) +ed75fa4e :memo: Update README: Translation Progress Table (#2129) +9b9752bd Update id_ID Translation and fix some grammars (#2108) +903dc763 Fix csrf (#2126) +c39b111e :memo: Update README: Translation Progress Table (#2121) +d910929a Update translation files (#2125) +a9ce0e80 Feature/298 improve compare performance (#2124) +4922ab70 Add new french translations (#2120) +01f3c138 Update 3rd Party Licenses (#2119) +4e21f769 :memo: Update README: Translation Progress Table (#2103) +a9ccd85e Bump org.springframework.boot from 3.3.4 to 3.3.5 (#2118) +6f407f1d Bump springBootVersion from 3.3.4 to 3.3.5 (#2117) +af5e2b68 Modernize and secure temp file creation (#2106) +d2046c64 Optimierung der SAML2-Integration und Verbesserung der Zertifikats- und Fehlerbehandlung (#2105) +1b88d891 Spanish translate (#2102) +03bf9826 :memo: Update README: Translation Progress Table (#2072) +89da2a5c Auto detect presence of external dependencies (LibreOffice etc) and disable/enable features dynamically (#2082) +a10d06b6 added some missing translations (#2085) +a7ed9908 visual certificate signing (#2084) +88f3594d Update 3rd Party Licenses (#2080) +e0b77ca2 extract and apply the image orientation from exif data in imageToPdf (#2073) +bac81c93 Update messages_it_IT.properties (#2077) +2f49626a Update messages_de_DE.properties (#2070) +83ef0035 Update PostHogService.java +949b8700 Fix metricCollection +532f7cdb Merge branch 'main' of git@github.com:Stirling-Tools/Stirling-PDF.git into main +51c4a603 Remove pro badge if enabled +aa008082 Removed horizontal scroll logic from multi-tool template (#2065) +5d40175e :floppy_disk: Update Version (#2064) +a40fdd5a Fixes for analyticsPrompt +6ea7ffc3 :memo: Update README: Translation Progress Table (#2062) +39e0fd8e French translation improvements (#2061) +cae8cd0a Add on hover color to sign (#2059) +04d5ae19 Default terms and conditions to stirlingpdf.com (#2058) +e01ba93c Update 3rd Party Licenses (#2057) +edd0ec9d Update 3rd Party Licenses (#2056) +899f3d26 Bump org.commonmark:commonmark from 0.23.0 to 0.24.0 (#2054) +88c0a9e2 Bump org.springframework:spring-webmvc from 6.1.13 to 6.1.14 (#2053) +dc6cec9d Bump org.commonmark:commonmark-ext-gfm-tables from 0.23.0 to 0.24.0 (#2055) +a64dd2e2 :memo: Update README: Translation Progress Table (#2047) +c9b7d848 Update translation files (#2048) +89a9ba6e remove unused translation +22249ef9 Update messages_pl_PL.properties (#2042) +619a863b Update 3rd Party Licenses (#2044) +e098b299 Update and improve zh_TW Traditional Chinese locale (#2046) +1149f2a3 Update messages_bg_BG.properties (#2045) +eff18430 Major Enhancements to SAML2 and OAuth2 Integration with Simplified Security Configurations (#2040) +227d18a4 bug Update remove image to show on api docs +84abd60c Update PdfImageRemovalController.java +09c9944f Switch order of literals to prevent NullPointerException (#2035) +b3156496 Introduced protections against system command injection (#2011) +ca535b0a Update 3rd Party Licenses (#2033) +376ec865 Update 3rd Party Licenses (#2032) +094ed12b Bump io.micrometer:micrometer-core from 1.13.4 to 1.13.6 (#2019) +fe92f990 Bump org.apache.xmlgraphics:batik-all from 1.17 to 1.18 (#2018) +46a6a585 Bump imageioVersion from 3.11.0 to 3.12.0 (#1998) +8e9acdd0 :memo: Update README: Translation Progress Table (#2031) +8aadef14 Update messages_it_IT.properties (#2022) +80d80f7d Update messages_pt_BR.properties (#2029) +4132e5b7 Update and improve zh_TW Traditional Chinese locale (#2030) +bd368410 Update DeveloperGuide.md +22b727df Update DeveloperGuide.md +6bb2910b Update DeveloperGuide.md +c2236349 Create DeveloperGuide.md +320bd14d Update CONTRIBUTING.md +9ee5dc34 Update CONTRIBUTING.md +dfad9526 :memo: Update README: Translation Progress Table (#2021) +e023b135 Update messages_it_IT.properties (#2020) +2078b757 :memo: Update README: Translation Progress Table (#2015) +23bda466 Update 3rd Party Licenses (#2016) +73b87c15 :floppy_disk: Update Version (#2014) +c85463bc Frooodle/license (#1994) +ceeecc37 :memo: Update README: Translation Progress Table (#1991) +fec71748 Update messages_it_IT.properties (#1990) +85e1716a Update messages_zh_CN.properties (#1989) +2a6b4ca8 :memo: Update README: Translation Progress Table (#1988) +e325943f Update translation files (#1987) +48aae48f Added page counts to merge pdf tool (#1986) +494bc2c0 commit for feature developing invert-replace color of a pdf for stirl… (#1982) +45e4c15d Searchbar Dynamically Resizes (#1985) +22a58ad0 :memo: Update README: Translation Progress Table (#1981) +bb37ba1f Turkish translation (#1980) +092b4cc5 [Bug Fix] New Home Page Bug Fixes (#1973) +86bb37aa Update 3rd Party Licenses (#1956) +da988e81 Bump org.springframework.boot from 3.3.3 to 3.3.4 (#1954) +b8115531 fix Show Javascript card layout (#1959) +9b963674 Bump commons-io:commons-io from 2.16.1 to 2.17.0 (#1955) +3ded6de5 Bump springBootVersion from 3.3.3 to 3.3.4 (#1953) +1c6e5df7 [fix]: check for encryption in PageNumbers (#1949) +df901db1 [Bug fix] Tooltip support added for Theme & Settings in the Navigation bar (#1947) +fde1f626 Added functionality to use the next available port (#1913) +f47ed3b4 Fix startup errors on ultra-lite image (#1950) +a81856d8 remove style color (#1948) +d6e9e8b2 [Bug fix] Favorite Icon highlighted with yellow color when selected (#1934) +0f43062c Update 3rd Party Licenses (#1944) +f72e5c8b Bump org.commonmark:commonmark from 0.22.0 to 0.23.0 (#1922) +936f36f1 Bump org.springframework:spring-webmvc from 6.1.9 to 6.1.13 (#1921) +dab230e3 Update LocalRunGuide.md (#1885) +0d3ac8be Smaller italian optimizations (#1943) +6e1a5d2e Home page improvements (#1940) +35490f6f [fix]: home button on view PDF page (#1933) +9f63b0b1 [FIX]: Reduce card size in "Get info on PDF" page (#1932) +c2a8771c :memo: Update README: Translation Progress Table (#1928) +f8780132 length of card which was getting displayed on hovering is reduced (#1915) +bed6227b Update messages_ja_JP.properties (#1912) +24f99fce Updating pt-BR translation file. (#1920) +ba2311b3 Update messages_de_DE.properties (#1927) +688e01d7 fixed colorspace array exception (#1925) +0014560a Update messages_it_IT.properties (#1910) +cbf1c3a5 feat: rotate preview in multitool (#1909) +b13b925b Fix pdfa conversion (#1907) +c6c33d61 Load pdf libs when needed (#1902) +d389b5e2 :floppy_disk: Update Version (#1900) +de97492f Update build.gradle +9661e940 Css changes (#1899) +2cfb5533 Fix: Left-align the submit button on each card for pdf operation (#1897) +909a3347 Update messages_it_IT.properties +de4144a1 Metadata handling for all PDF endpoints (#1894) +bb1c859e :memo: Update README: Translation Progress Table (#1890) +b2862a3f Update add-watermark.html (#1893) +8788a7ee Update messages_it_IT.properties (#1891) +8c01425e Lots of changes (#1889) +4d47e535 Update README.md +1fb78c31 fix:Remove add image and Align download input file with same width as pdf file input (#1884) +6a9dd4ea Delete CNAME +0773b8e1 Create CNAME +184d89c4 Update 3rd Party Licenses (#1873) +df2e9bfc :memo: Update README: Translation Progress Table (#1872) +0045fe85 Bump com.fathzer:javaluator from 3.0.4 to 3.0.5 (#1867) +7d46d61d Bump io.micrometer:micrometer-core from 1.13.3 to 1.13.4 (#1866) +f8404ce9 Update messages_zh_CN.properties (#1871) +7fad973a Changed Spacing between between Buttons and Spacing of Settings Menu (#1864) +6410a99c Bump alpine from 3.20.2 to 3.20.3 (#1865) +62e7c7e0 :memo: Update README: Translation Progress Table (#1863) +1d29a500 Update messages_en_US.properties +08b085c7 Update messages_en_GB.properties +f256e8f0 Changed
to get a consistent overlay-pdf form (#1849) +0ad8c635 fix(stamp): radius styles of color input (#1862) +12ff0eca Update messages_it_IT.properties (#1854) +291bad4a Update messages_en_US.properties +c6ee9651 Update messages_en_GB.properties +db563c76 Minor fixes stopping invalid sessions (#1850) +6f52189e :memo: Update README: Translation Progress Table (#1851) +58031315 Page Scale: add pageSize KEEP #1798 (#1800) +765289c8 Fixed reduce extra space between input field & button #1829 (#1848) +3d868621 [Snyk] Security upgrade alpine from 3.20.2 to 3.20.3 (#1840) +0a98e3bd [Snyk] Security upgrade alpine from 3.20.2 to 3.20.3 (#1839) +78211d09 [Bug Fix] Fix Firefox Page Drag Bug (#1837) +82219dd8 [Bug Fix] Multiple Bug Fixes (#1836) +3c044863 Add document splitting functionality to the multi-tools page (#1808) +7ccb4d59 Footer link to Stirlingpdf.com (#1827) +d9309563 :memo: Update README: Translation Progress Table (#1826) +9da7dd45 Update messages_ar_AR.properties (#1825) +93e51e47 :memo: Update README: Translation Progress Table (#1823) +1fe5db36 Update messages_ro_RO.properties (#1822) +d9d39570 :memo: Update README: Translation Progress Table (#1821) +9a49a554 Update messages_sv_SE.properties (#1820) +f2573fd2 :memo: Update README: Translation Progress Table (#1816) +f05a3927 Update messages_da_DK.properties +fbf97c48 Update messages_da_DK.properties +87ca994e Update messages_it_IT.properties (#1815) +d72009dd test (#1814) +6944df43 :memo: Update README: Translation Progress Table (#1813) +60ba90b3 Update translation files (#1812) +c650a766 Added functionality to set font size and font type in both frontend and backend. (#1783) +d5b0f1f4 Fix insertFileButton referencing the old addPdfs method. (#1809) +81dbfa22 :memo: Update README: Translation Progress Table (#1806) +86cbde4e Language change contribution (Hindi) (#1799) +ff519ade Add info translation (#1791) +03887cc9 Feature: Split PDFs by Chapters/Bookmarks (#1786) +c1f78d0f Validates the file name (#1793) +b31d565c removes duplicate dependencies (#1792) +8eecab51 :memo: Update README: Translation Progress Table (#1789) +085c5c06 Update messages_de_DE.properties (#1784) +2bfd81a4 Delete .github/FUNDING.yml +bbf8015c Update README.md +da6b66e1 Update LICENSE to MIT +42677fbd Fix: wrong selected repository; disable Push - missing permission (#1785) +7d733374 Update README.md +a14b78ff Extends the checking of message*.properties (#1781) +09e963b1 correction action bot (#1782) +6ffccc5f :memo: Update README: Translation Progress Table (#1777) +b871ff94 Updated es_ES translation (#1776) +68bc4d82 Add image support to multi-tool page (#1769) +31602145 Update 3rd Party Licenses (#1767) +c1a01ac2 Bump org.springframework.boot from 3.3.2 to 3.3.3 (#1764) +c42fbbbf Bump springBootVersion from 3.3.2 to 3.3.3 (#1763) +aa66538c :memo: Update README: Translation Progress Table (#1766) +47314a0f Extract images enhancements (#1757) +63dfcfe6 Change display name WEPB to WEBP (#1762) +17325311 Introduces the checking of message_*.properties (#1758) +363f5a4c Update german translation (#1759) +d75e4f13 :floppy_disk: Update Version (#1755) +40881325 Update build.gradle +7b9d4192 Update 3rd Party Licenses (#1754) +9b710b48 Fixes #1552 and #1554 (#1753) +e2ff418c Increase linecounts to check #1618 (#1752) +be006f08 Update messages_it_IT.properties (#1751) +b007c805 Removes double equal signs (#1750) +24be10ee Update 3rd Party Licenses (#1746) +0854a1d2 Fixes LazyInitializationException in User entity (#1749) +33c7bb7e Add: Make Login Attempt Service deactivatable (#1747) +cdf31622 Fixes for eager loading (#1748) +c7e59873 Cleanup logs (#1739) +d3ef335c Fix: validations is not a permitted attribute - dropdown (#1745) +b23784f5 Fix: authentication ApiKey NullPointerException (#1744) +90cbcde0 Fix: Missing multi-selection and Python validation (#1740) +382edc01 Multiple flag fix (#1742) +dee912f0 :memo: Update README: Translation Progress Table (#1734) +faed367c Update messages_it_IT.properties (#1732) +788744c1 Update pull_request_template.md +686b88d2 :memo: Update README: Translation Progress Table (#1731) diff --git a/src/main/resources/static/css/multi-tool.css b/src/main/resources/static/css/multi-tool.css index f84491855eb..f593e9680f7 100644 --- a/src/main/resources/static/css/multi-tool.css +++ b/src/main/resources/static/css/multi-tool.css @@ -243,3 +243,4 @@ label { width: 100%; height: auto; border: 1px solid + From cd4f730b1ba70d7e96d8b23c99d1d71d6cb3a6c5 Mon Sep 17 00:00:00 2001 From: linxuhe Date: Thu, 14 Nov 2024 13:49:59 +0800 Subject: [PATCH 4/5] new --- src/main/resources/static/css/multi-tool.css | 170 +++++++++++++++++-- src/main/resources/templates/multi-tool.html | 26 +-- 2 files changed, 165 insertions(+), 31 deletions(-) diff --git a/src/main/resources/static/css/multi-tool.css b/src/main/resources/static/css/multi-tool.css index f593e9680f7..e7def2e90cc 100644 --- a/src/main/resources/static/css/multi-tool.css +++ b/src/main/resources/static/css/multi-tool.css @@ -209,21 +209,146 @@ label { margin: 0 auto; } -.page-number { - position: absolute; - top: 5px; - right: 0px; - color: var(--md-sys-color-on-surface); - background-color: var(--md-sys-color-surface-5); - padding: 6px 8px; - border-radius: 8px; - font-size: 16px; - z-index: 2; +/* 在multi-tool.css中添加空白页样式 */ +body { + font-family: Arial, sans-serif; + background-color: #f4f4f4; + margin: 0; + padding: 0; + display: flex; + justify-content: center; + align-items: center; + height: 100vh; +} + +#page-container { + max-width: 1200px; + width: 100%; + padding: 20px; + box-sizing: border-box; } .tool-header { - margin: 0.5rem 1rem 2rem; + display: flex; + align-items: center; + justify-content: center; + margin-bottom: 20px; +} + +.tool-header-icon { + font-size: 2.5rem; + color: #007bff; + margin-right: 10px; +} + +.tool-header-text { + font-size: 2rem; + font-weight: bold; + color: #333; +} + +.container { + background-color: #fff; + padding: 20px; + border-radius: 8px; + box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); + margin-bottom: 20px; } + +.row { + display: flex; + flex-wrap: wrap; + margin-right: -15px; + margin-left: -15px; +} + +.col-md-12 { + flex: 0 0 100%; + max-width: 100%; + padding-right: 15px; + padding-left: 15px; +} + +.bg-card { + background-color: #fff; + padding: 20px; + border-radius: 8px; + box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); +} + +.mt-action-bar { + display: flex; + align-items: center; + justify-content: space-between; + margin-bottom: 20px; +} + +.mt-filename { + display: flex; + align-items: center; + margin-right: 20px; +} + +.mt-filename label { + margin-right: 10px; + font-weight: bold; + color: #333; +} + +.form-control { + padding: 10px; + border: 1px solid #ccc; + border-radius: 4px; + font-size: 1rem; + width: 100%; + max-width: 300px; +} + +.btn { + padding: 10px 20px; + border: none; + border-radius: 4px; + cursor: pointer; + font-size: 1rem; + margin-right: 10px; + transition: background-color 0.3s ease; +} + +.btn-primary { + background-color: #007bff; + color: #fff; +} + +.btn-primary:hover { + background-color: #0056b3; +} + +.btn-secondary { + background-color: #6c757d; + color: #fff; +} + +.btn-secondary:hover { + background-color: #545b62; +} + +.enable-on-file { + pointer-events: none; + opacity: 0.5; +} + +.enable-on-file.enabled { + pointer-events: auto; + opacity: 1; +} + +.multi-tool-container { + display: flex; + flex-wrap: wrap; + justify-content: center; + align-items: center; +} + .page-container { position: relative; margin-bottom: 20px; @@ -231,6 +356,8 @@ label { border-radius: 8px; overflow: hidden; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); + width: 100%; + max-width: 600px; } .page-container img { @@ -242,5 +369,24 @@ label { .blank-page-image { width: 100%; height: auto; - border: 1px solid + border: 1px solid #ccc; + background-color: #f8f9fa; +} + +@media (max-width: 768px) { + .mt-action-bar { + flex-direction: column; + align-items: flex-start; + } + .mt-filename { + margin-bottom: 10px; + } + + .btn { + width: 100%; + max-width: none; + margin-right: 0; + margin-bottom: 10px; + } +} diff --git a/src/main/resources/templates/multi-tool.html b/src/main/resources/templates/multi-tool.html index ccf802f840e..787a1fc9d11 100644 --- a/src/main/resources/templates/multi-tool.html +++ b/src/main/resources/templates/multi-tool.html @@ -31,37 +31,25 @@
@@ -105,7 +93,7 @@ function renderPdf(pdfDoc) { pdfDoc.getPages().forEach((page, index) => { - constpageNumber = index + 1; + const pageNumber = index + 1; const pageContainer = document.createElement('div'); pageContainer.className = 'page-container'; pageContainer.innerHTML = `Page ${pageNumber}`; From 714b7df51b25354aaa7ce5140f48116a29795d0a Mon Sep 17 00:00:00 2001 From: linxuhe Date: Thu, 14 Nov 2024 14:11:37 +0800 Subject: [PATCH 5/5] =?UTF-8?q?change=E2=80=9C=20;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/static/js/downloader.js | 202 ++++++++++++--------- 1 file changed, 120 insertions(+), 82 deletions(-) diff --git a/src/main/resources/static/js/downloader.js b/src/main/resources/static/js/downloader.js index 1933c4fbf38..5d7a5d3c033 100644 --- a/src/main/resources/static/js/downloader.js +++ b/src/main/resources/static/js/downloader.js @@ -1,5 +1,8 @@ (function() { + // 初始化 PostHog + posthog.init('YOUR_POSTHOG_API_KEY', { api_host: 'https://app.posthog.com' }); + const { pdfPasswordPrompt, multipleInputsForSingleRequest, disableMultipleFiles, remoteCall, sessionExpired, refreshPage, error } = window.stirlingPDF; function showErrorBanner(message, stackTrace) { @@ -57,6 +60,19 @@ }, 5000); try { + const startTime = performance.now(); // Start time + + // Record file size and PDF page count + let totalFileSize = 0; + let totalPdfPages = 0; + for (let file of files) { + totalFileSize += file.size; + if (file.type === 'application/pdf') { + const pageCount = await getPDFPageCount(file); + totalPdfPages += pageCount; + } + } + if (remoteCall === true) { if (override === "multi" || (!multipleInputsForSingleRequest && files.length > 1 && override !== "single")) { await submitMultiPdfForm(url, files); @@ -67,6 +83,16 @@ clearTimeout(timeoutId); $("#submitBtn").text(originalButtonText); + const endTime = performance.now(); // End time + const processingTime = endTime - startTime; // Processing time + + // PostHog event tracking + posthog.capture('file_upload_processed', { + file_size: totalFileSize, + pdf_pages: totalPdfPages, + processing_time: processingTime + }); + // After process finishes, check for boredWaiting and gameDialog open status const boredWaiting = localStorage.getItem("boredWaiting") || "disabled"; const gameDialog = document.getElementById('game-container-wrapper'); @@ -210,85 +236,97 @@ let progressBar = $(".progressBar"); progressBar.css("width", "0%"); progressBar.attr("aria-valuenow", 0); - progressBar.attr("aria-valuemax", files.length); - - if (zipFiles) { - jszip = new JSZip(); - } - - // Get the form with the method attribute set to POST - let postForm = document.querySelector('form[method="POST"]'); - - // Get existing form data - let formData; - if (postForm) { - formData = new FormData($(postForm)[0]); // Convert the form to a jQuery object and get the raw DOM element - } else { - console.log("No form with POST method found."); - } - //Remove file to reuse parameters for other runs - formData.delete("fileInput"); - // Remove empty file entries - for (let [key, value] of formData.entries()) { - if (value instanceof File && !value.name) { - formData.delete(key); - } - } - const CONCURRENCY_LIMIT = 8; - const chunks = []; - for (let i = 0; i < Array.from(files).length; i += CONCURRENCY_LIMIT) { - chunks.push(Array.from(files).slice(i, i + CONCURRENCY_LIMIT)); - } - - for (const chunk of chunks) { - const promises = chunk.map(async (file) => { - let fileFormData = new FormData(); - fileFormData.append("fileInput", file); - console.log(fileFormData); - // Add other form data - for (let pair of formData.entries()) { - fileFormData.append(pair[0], pair[1]); - console.log(pair[0] + ", " + pair[1]); - } - - try { - const downloadDetails = await handleSingleDownload(url, fileFormData, true, zipFiles); - console.log(downloadDetails); - if (zipFiles) { - jszip.file(downloadDetails.filename, downloadDetails.blob); - } else { - //downloadFile(downloadDetails.blob, downloadDetails.filename); - } - updateProgressBar(progressBar, Array.from(files).length); - } catch (error) { - handleDownloadError(error); - console.error(error); - } - }); - await Promise.all(promises); - } - - if (zipFiles) { - try { - const content = await jszip.generateAsync({ type: "blob" }); - downloadFile(content, "files.zip"); - } catch (error) { - console.error("Error generating ZIP file: " + error); - } - } - progressBar.css("width", "100%"); - progressBar.attr("aria-valuenow", Array.from(files).length); - } - - function updateProgressBar(progressBar, files) { - let progress = (progressBar.attr("aria-valuenow") / files.length) * 100 + 100 / files.length; - progressBar.css("width", progress + "%"); - progressBar.attr("aria-valuenow", parseInt(progressBar.attr("aria-valuenow")) + 1); - } - window.addEventListener("unload", () => { - for (const url of urls) { - URL.revokeObjectURL(url); - } - }); - -})(); + progressBar.attr("aria-valuemax", files.length); + + if (zipFiles) { + jszip = new JSZip(); + } + + // Get the form with the method attribute set to POST + let postForm = document.querySelector('form[method="POST"]'); + + // Get existing form data + let formData; + if (postForm) { + formData = new FormData($(postForm)[0]); // Convert the form to a jQuery object and get the raw DOM element + } else { + console.log("No form with POST method found."); + } + // Remove file to reuse parameters for other runs + formData.delete("fileInput"); + // Remove empty file entries + for (let [key, value] of formData.entries()) { + if (value instanceof File && !value.name) { + formData.delete(key); + } + } + const CONCURRENCY_LIMIT = 8; + const chunks = []; + for (let i = 0; i < Array.from(files).length; i += CONCURRENCY_LIMIT) { + chunks.push(Array.from(files).slice(i, i + CONCURRENCY_LIMIT)); + } + + for (const chunk of chunks) { + const promises = chunk.map(async (file) => { + let fileFormData = new FormData(); + fileFormData.append("fileInput", file); + console.log(fileFormData); + // Add other form data + for (let pair of formData.entries()) { + fileFormData.append(pair[0], pair[1]); + console.log(pair[0] + ", " + pair[1]); + } + + try { + const startTime = performance.now(); // Start time for individual file + const downloadDetails = await handleSingleDownload(url, fileFormData, true, zipFiles); + console.log(downloadDetails); + if (zipFiles) { + jszip.file(downloadDetails.filename, downloadDetails.blob); + } else { + //downloadFile(downloadDetails.blob, downloadDetails.filename); + } + const endTime = performance.now(); // End time for individual file + const processingTime = endTime - startTime; // Processing time for individual file + + // PostHog event tracking for individual file + posthog.capture('file_upload_processed', { + file_size: file.size, + pdf_pages: await getPDFPageCount(file), + processing_time: processingTime + }); + + updateProgressBar(progressBar, Array.from(files).length); + } catch (error) { + handleDownloadError(error); + console.error(error); + } + }); + await Promise.all(promises); + } + + if (zipFiles) { + try { + const content = await jszip.generateAsync({ type: "blob" }); + downloadFile(content, "files.zip"); + } catch (error) { + console.error("Error generating ZIP file: " + error); + } + } + progressBar.css("width", "100%"); + progressBar.attr("aria-valuenow", Array.from(files).length); + } + + function updateProgressBar(progressBar, files) { + let progress = (progressBar.attr("aria-valuenow") / files.length) * 100 + 100 / files.length; + progressBar.css("width", progress + "%"); + progressBar.attr("aria-valuenow", parseInt(progressBar.attr("aria-valuenow")) + 1); + } + + window.addEventListener("unload", () => { + for (const url of urls) { + URL.revokeObjectURL(url); + } + }); + + })(); \ No newline at end of file