241 lines
13 KiB
HTML
Raw Normal View History

<th:block th:fragment="head">
<!-- Title -->
<title th:text="${@appName} + (${title} != null and ${title} != '' ? ' - ' + ${title} : '')"></title>
<!-- Metadata -->
<meta charset="utf-8">
<meta name="description" th:content="${@appName} + (${header} != null and ${header} != '' ? ' - ' + ${header} : '')">
<meta name="msapplication-TileColor" content="#2d89ef">
<meta name="theme-color" content="#ffffff">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Icons -->
<link rel="apple-touch-icon" sizes="180x180" th:href="@{'/apple-touch-icon.png'}">
<link rel="icon" type="image/png" sizes="32x32" th:href="@{'/favicon-32x32.png'}">
<link rel="icon" type="image/png" sizes="16x16" th:href="@{'/favicon-16x16.png'}">
<link rel="manifest" th:href="@{'/site.webmanifest'}" crossorigin="use-credentials">
<link rel="mask-icon" th:href="@{'/safari-pinned-tab.svg'}" color="#ca2b2a">
<link rel="shortcut icon" th:href="@{'/favicon.ico'}">
<meta name="apple-mobile-web-app-title" content="Stirling PDF">
<meta name="application-name" content="Stirling PDF">
<meta name="msapplication-TileColor" content="#00aba9">
<meta name="theme-color" content="#ffffff">
<script>
window.stirlingPDF = window.stirlingPDF || {};
</script>
<!-- jQuery -->
<script th:src="@{'/js/thirdParty/jquery.min.js'}"></script>
<script th:src="@{'/js/thirdParty/jquery.validate.min.js'}"></script>
<script th:src="@{'/js/thirdParty/jszip.min.js'}" th:if="${currentPage != 'home'}"></script>
<!-- Bootstrap -->
<script th:src="@{'/js/thirdParty/popper.min.js'}"></script>
<script th:src="@{'/js/thirdParty/bootstrap.min.js'}"></script>
<link rel="stylesheet" th:href="@{'/css/bootstrap.min.css'}">
<!-- Bootstrap Icons -->
<link rel="stylesheet" th:href="@{'/css/bootstrap-icons.min.css'}">
<!-- Custom -->
<link rel="stylesheet" th:href="@{'/css/general.css'}">
<link rel="stylesheet" th:href="@{'/css/theme/theme.css'}">
<link rel="stylesheet" th:href="@{'/css/theme/componentes.css'}">
<link rel="stylesheet" th:href="@{'/css/theme/theme.light.css'}" id="light-mode-styles">
<link rel="stylesheet" th:href="@{'/css/theme/theme.dark.css'}" id="dark-mode-styles">
<link rel="stylesheet" th:href="@{'/css/rainbow-mode.css'}" id="rainbow-mode-styles" disabled>
<link rel="stylesheet" th:href="@{'/css/tab-container.css'}">
<link rel="stylesheet" th:href="@{'/css/navbar.css'}">
<link rel="stylesheet" th:href="@{'/css/error.css'}" th:if="${error}">
<link rel="stylesheet" th:href="@{'/css/home.css'}" th:if="${currentPage == 'home'}">
<link rel="stylesheet" th:href="@{'/css/account.css'}" th:if="${currentPage == 'account'}">
<link rel="stylesheet" th:href="@{'/css/licenses.css'}" th:if="${currentPage == 'licenses'}">
<link rel="stylesheet" th:href="@{'/css/multi-tool.css'}" th:if="${currentPage == 'multi-tool'}">
<link rel="stylesheet" th:href="@{'/css/rotate-pdf.css'}" th:if="${currentPage == 'rotate-pdf'}">
<link rel="stylesheet" th:href="@{'/css/stamp.css'}" th:if="${currentPage == 'stamp'}">
<link rel="stylesheet" th:href="@{'/css/fileSelect.css'}" th:if="${currentPage != 'home'}">
<link rel="stylesheet" th:href="@{'/css/footer.css'}">
<link rel="preload" th:href="@{'/fonts/google-symbol.woff2'}" as="font" type="font/woff2" crossorigin="anonymous">
<script th:src="@{'/js/thirdParty/fontfaceobserver.standalone.js'}"></script>
<!-- Google MD Icons -->
<link rel="stylesheet" th:href="@{'/css/theme/font.css'}">
<!-- Help Modal -->
<link rel="stylesheet" th:href="@{'/css/errorBanner.css'}" th:if="${currentPage != 'home'}">
<script th:src="@{'/js/cacheFormInputs.js'}" th:if="${currentPage != 'home'}"></script>
<script th:src="@{'/js/tab-container.js'}"></script>
<script th:src="@{'/js/darkmode.js'}"></script>
2024-10-14 22:34:41 +01:00
<script th:inline="javascript">
const stirlingPDFLabel = /*[[${@StirlingPDFLabel}]]*/ '';
const analyticsEnabled = /*[[${@analyticsEnabled}]]*/ false;
if (analyticsEnabled) {
!function (t, e) {
var o, n, p, r;
e.__SV || (window.posthog = e, e._i = [], e.init = function (i, s, a) {
function g(t, e) {
var o = e.split(".");
2 == o.length && (t = t[o[0]], e = o[1]), t[e] = function () {
t.push([e].concat(Array.prototype.slice.call(arguments, 0)))
}
}
(p = t.createElement("script")).type = "text/javascript", p.async = !0, p.src = s.api_host + "/static/array.js", (r = t.getElementsByTagName("script")[0]).parentNode.insertBefore(p, r);
var u = e;
for (void 0 !== a ? u = e[a] = [] : a = "posthog", u.people = u.people || [], u.toString = function (t) {
var e = "posthog";
return "posthog" !== a && (e += "." + a), t || (e += " (stub)"), e
}, u.people.toString = function () {
return u.toString(1) + ".people (stub)"
}, o = "capture identify alias people.set people.set_once set_config register register_once unregister opt_out_capturing has_opted_out_capturing opt_in_capturing reset isFeatureEnabled onFeatureFlags getFeatureFlag getFeatureFlagPayload reloadFeatureFlags group updateEarlyAccessFeatureEnrollment getEarlyAccessFeatures getActiveMatchingSurveys getSurveys getNextSurveyStep onSessionId".split(" "), n = 0; n < o.length; n++) g(u, o[n]);
e._i.push([i, s, a])
}, e.__SV = 1)
}(document, window.posthog || []);
posthog.init('phc_fiR65u5j6qmXTYL56MNrLZSWqLaDW74OrZH0Insd2xq', {
api_host: 'https://eu.i.posthog.com',
persistence: 'localStorage',
person_profiles: 'always',
mask_all_text: true,
mask_all_element_attributes: true
})
const baseUrl = window.location.hostname;
posthog.register_once({
'hostname': baseUrl,
'UUID': /*[[${@UUID}]]*/ ''
})
}
</script>
</th:block>
<th:block th:fragment="game">
<dialog id="game-container-wrapper" class="game-container-wrapper" data-bs-modal>
<script th:inline="javascript">
console.log("loaded game");
$(document).ready(function() {
// Find the file input within the form
var fileInput = $('input[type="file"]');
// Find the closest enclosing form of the file input
var form = fileInput.closest('form');
// Find the submit button within the form
var submitButton = form.find('button[type="submit"], input[type="submit"]');
const boredWaitingText = /*[[#{bored}]]*/ 'Bored Waiting?';
const downloadCompleteText = /*[[#{downloadComplete}]]*/ 'Download Complete';
window.downloadCompleteText = downloadCompleteText;
// Create the 'show-game-btn' button
var gameButton = $('<button type="button" class="btn btn-primary" id="show-game-btn" style="display:none;">' + boredWaitingText + '</button>');
// Insert the 'show-game-btn' just above the submit button
submitButton.before(gameButton);
function loadGameScript(callback) {
console.log('loadGameScript called');
const script = document.createElement('script');
script.src = 'js/game.js';
script.onload = callback;
document.body.appendChild(script);
}
let gameScriptLoaded = false;
const gameDialog = document.getElementById('game-container-wrapper');
$('#show-game-btn').on('click', function() {
console.log('Show game button clicked');
if (!gameScriptLoaded) {
console.log('Show game button load');
loadGameScript(function() {
console.log('Game script loaded');
window.initializeGame();
gameScriptLoaded = true;
});
} else {
window.resetGame();
}
gameDialog.showModal();
});
gameDialog.addEventListener("click", e => {
const dialogDimensions = gameDialog.getBoundingClientRect()
if (
e.clientX < dialogDimensions.left ||
e.clientX > dialogDimensions.right ||
e.clientY < dialogDimensions.top ||
e.clientY > dialogDimensions.bottom
) {
gameDialog.close();
}
})
})
</script>
<div id="game-container">
<div id="lives">Lives: 3</div>
<div id="score">Score: 0</div>
<div id="high-score">High Score: 0</div>
<div id="level">Level: 1</div>
<img th:src="@{'/favicon.svg'}" class="player" id="player" alt="favicon">
</div>
<link rel="stylesheet" th:href="@{'/css/game.css'}">
</dialog>
</th:block>
<th:block th:fragment="fileSelector(name, multipleInputsForSingleRequest)" th:with="accept=${accept} ?: '*/*', inputText=${inputText} ?: #{pdfPrompt}, remoteCall=${remoteCall} ?: true, disableMultipleFiles=${disableMultipleFiles} ?: false, notRequired=${notRequired} ?: false">
<script th:inline="javascript">
(function() {
window.stirlingPDF.pdfPasswordPrompt = /*[[#{error.pdfPassword}]]*/ '';
window.stirlingPDF.multipleInputsForSingleRequest = /*[[${multipleInputsForSingleRequest}]]*/ false;
window.stirlingPDF.disableMultipleFiles = /*[[${disableMultipleFiles}]]*/ false;
window.stirlingPDF.remoteCall = /*[[${remoteCall}]]*/ true;
window.stirlingPDF.sessionExpired = /*[[#{session.expired}]]*/ '';
window.stirlingPDF.refreshPage = /*[[#{session.refreshPage}]]*/ 'Refresh Page';
window.stirlingPDF.error = /*[[#{error}]]*/ "Error";
})();
</script>
<script type="module" th:src="@{'/pdfjs-legacy/pdf.mjs'}"></script>
<script th:src="@{'/js/downloader.js'}"></script>
2024-12-06 21:26:28 +00:00
<script>
window.translations = {
decrypt: {
passwordPrompt: '[[#{decrypt.passwordPrompt}]]',
cancelled: '[[#{decrypt.cancelled}]]',
noPassword: '[[#{decrypt.noPassword}]]',
invalidPassword: '[[#{decrypt.invalidPassword}]]',
invalidPasswordHeader: '[[#{decrypt.invalidPasswordHeader}]]',
unexpectedError: '[[#{decrypt.unexpectedError}]]',
serverError: '[[#{decrypt.serverError}]]',
success: '[[#{decrypt.success}]]',
}
};</script>
Fix drag and drop area for file choosers by adding separate ones (#2368) * Add separate drag and drop area for file choosers - Add separate drag and drop area for file choosers ### Why? Previously, when there were multiple file choosers in the same page, if you attempted to drag and drop any files, they would be added to both file choosers as it was designed at first to handle 1 file chooser present, now that we have multiple ones, it is necessary to adapt our design to match the changing functionality. ### Can you not preserve the old overlay when there's only one file chooser present? Yes, we can, but imagine as a user, you try to drag and drop a file in one page and the fields turn into drag and drop areas then you go to another page and try to drag and drop again but you encounter the old overlay instead, as a user you might get confused and ask yourself "What changed?" or if a user is telling another user the steps to drag and drop files and he didn't know about this case, then it would still be confusing, thus consistency is preferred in this case. * Update file chooser UI * Add support for listing and removing selected files and their file icons - Selected files are listed below the file chooser in a selected files container. - Users can now remove uploaded/selected files. - Hide selected files container/box unless there are files selected/uploaded. - Add separate overlay for each drag & drop area. ## FAQ: - Why did you assign a unique id to each file? isn't the filename enough? = Because a user might upload multiple files with the same name, if the user wanted to remove one of them, how would we differentiate between them? we won't be able to unless we assign an identifier, you might argue "we remove based on the filename and size", then what if the user uploaded the same file more than once (intentionally), then we would accidentally remove all the files even though that is not what the user wanted, so going with unique ID approach would prevent this issue/problem from occurring in the first place. * Rename remove-file css class to remove-selected-file - Rename remove-file css class to remove-selected-file to avoid css conflict with remove-file in merge.css * Use input element to dispatch event on file removal Use the correct element to dispatch "file-input-change" (input element is the correct one). * Adapt file chooser UI to themes - Adapt file chooser UI to themes by adjusting their font colors and background colors. - Make text more visible in overlay by increasing the font size by 0.1rem and setting font weight to 550. * Remove extra overlay border - Removing overlay's border as it is unnecessary and only causing a double border issue on the file input container. * Remove Browse button, highlight file chooser and make it clickable - Remove browse button. - Make the entire file chooser container clickable. - Add glowing effect on hover for file chooser. - Change color of file chooser on hover. * Replace crypto.randomUUID() with UUID.uuidv4() - Replace crypto.randomUUID() with UUID.uuidv4() as crypto.randomUUID() is only supported in secured contexts such as localhost 127.0.0.1 and over HTTPS * Fix merge file removal not being reflected in file chooser - Files removed from the list in merge page would now be reflected in the file chooser's container. * Make inputElement optional in removeFileById - Make inputElement optional in removeFileById, this way we could control changing inputElements files. * Add translation support to file chooser --------- Co-authored-by: Anthony Stirling <77850077+Frooodle@users.noreply.github.com>
2024-12-02 20:10:12 +02:00
<div class="custom-file-chooser mb-3" th:attr="data-bs-unique-id=${name}, data-bs-element-id=${name+'-input'}, data-bs-element-container-id=${name+'-input-container'}, data-bs-files-selected=#{filesSelected}, data-bs-pdf-prompt=#{pdfPrompt}">
<div class="mb-3 d-flex flex-row justify-content-center align-items-center flex-wrap input-container" th:name="${name}+'-input'" th:id="${name}+'-input-container'" th:data-text="#{fileChooser.hoveredDragAndDrop}">
<label class="file-input-btn d-none">
<input type="file" class="form-control" th:name="${name}" th:id="${name}+'-input'" th:accept="${accept}" th:attr="multiple=${!disableMultipleFiles}" th:required="${notRequired} ? null : 'required'">
Browse
</label>
<div th:text="#{fileChooser.click}"></div>
<div th:text="#{fileChooser.or}"></div>
<div th:text="#{fileChooser.dragAndDrop}"></div>
</div>
Fix drag and drop area for file choosers by adding separate ones (#2368) * Add separate drag and drop area for file choosers - Add separate drag and drop area for file choosers ### Why? Previously, when there were multiple file choosers in the same page, if you attempted to drag and drop any files, they would be added to both file choosers as it was designed at first to handle 1 file chooser present, now that we have multiple ones, it is necessary to adapt our design to match the changing functionality. ### Can you not preserve the old overlay when there's only one file chooser present? Yes, we can, but imagine as a user, you try to drag and drop a file in one page and the fields turn into drag and drop areas then you go to another page and try to drag and drop again but you encounter the old overlay instead, as a user you might get confused and ask yourself "What changed?" or if a user is telling another user the steps to drag and drop files and he didn't know about this case, then it would still be confusing, thus consistency is preferred in this case. * Update file chooser UI * Add support for listing and removing selected files and their file icons - Selected files are listed below the file chooser in a selected files container. - Users can now remove uploaded/selected files. - Hide selected files container/box unless there are files selected/uploaded. - Add separate overlay for each drag & drop area. ## FAQ: - Why did you assign a unique id to each file? isn't the filename enough? = Because a user might upload multiple files with the same name, if the user wanted to remove one of them, how would we differentiate between them? we won't be able to unless we assign an identifier, you might argue "we remove based on the filename and size", then what if the user uploaded the same file more than once (intentionally), then we would accidentally remove all the files even though that is not what the user wanted, so going with unique ID approach would prevent this issue/problem from occurring in the first place. * Rename remove-file css class to remove-selected-file - Rename remove-file css class to remove-selected-file to avoid css conflict with remove-file in merge.css * Use input element to dispatch event on file removal Use the correct element to dispatch "file-input-change" (input element is the correct one). * Adapt file chooser UI to themes - Adapt file chooser UI to themes by adjusting their font colors and background colors. - Make text more visible in overlay by increasing the font size by 0.1rem and setting font weight to 550. * Remove extra overlay border - Removing overlay's border as it is unnecessary and only causing a double border issue on the file input container. * Remove Browse button, highlight file chooser and make it clickable - Remove browse button. - Make the entire file chooser container clickable. - Add glowing effect on hover for file chooser. - Change color of file chooser on hover. * Replace crypto.randomUUID() with UUID.uuidv4() - Replace crypto.randomUUID() with UUID.uuidv4() as crypto.randomUUID() is only supported in secured contexts such as localhost 127.0.0.1 and over HTTPS * Fix merge file removal not being reflected in file chooser - Files removed from the list in merge page would now be reflected in the file chooser's container. * Make inputElement optional in removeFileById - Make inputElement optional in removeFileById, this way we could control changing inputElements files. * Add translation support to file chooser --------- Co-authored-by: Anthony Stirling <77850077+Frooodle@users.noreply.github.com>
2024-12-02 20:10:12 +02:00
<div class="selected-files flex-wrap"></div>
</div>
<div class="progressBarContainer" style="display: none; position: relative;">
<div class="progress" style="height: 1rem;">
<div class="progressBar progress-bar progress-bar-striped progress-bar-animated bg-success" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 0%;">
<span class="visually-hidden">Loading...</span>
</div>
</div>
</div>
Fix drag and drop area for file choosers by adding separate ones (#2368) * Add separate drag and drop area for file choosers - Add separate drag and drop area for file choosers ### Why? Previously, when there were multiple file choosers in the same page, if you attempted to drag and drop any files, they would be added to both file choosers as it was designed at first to handle 1 file chooser present, now that we have multiple ones, it is necessary to adapt our design to match the changing functionality. ### Can you not preserve the old overlay when there's only one file chooser present? Yes, we can, but imagine as a user, you try to drag and drop a file in one page and the fields turn into drag and drop areas then you go to another page and try to drag and drop again but you encounter the old overlay instead, as a user you might get confused and ask yourself "What changed?" or if a user is telling another user the steps to drag and drop files and he didn't know about this case, then it would still be confusing, thus consistency is preferred in this case. * Update file chooser UI * Add support for listing and removing selected files and their file icons - Selected files are listed below the file chooser in a selected files container. - Users can now remove uploaded/selected files. - Hide selected files container/box unless there are files selected/uploaded. - Add separate overlay for each drag & drop area. ## FAQ: - Why did you assign a unique id to each file? isn't the filename enough? = Because a user might upload multiple files with the same name, if the user wanted to remove one of them, how would we differentiate between them? we won't be able to unless we assign an identifier, you might argue "we remove based on the filename and size", then what if the user uploaded the same file more than once (intentionally), then we would accidentally remove all the files even though that is not what the user wanted, so going with unique ID approach would prevent this issue/problem from occurring in the first place. * Rename remove-file css class to remove-selected-file - Rename remove-file css class to remove-selected-file to avoid css conflict with remove-file in merge.css * Use input element to dispatch event on file removal Use the correct element to dispatch "file-input-change" (input element is the correct one). * Adapt file chooser UI to themes - Adapt file chooser UI to themes by adjusting their font colors and background colors. - Make text more visible in overlay by increasing the font size by 0.1rem and setting font weight to 550. * Remove extra overlay border - Removing overlay's border as it is unnecessary and only causing a double border issue on the file input container. * Remove Browse button, highlight file chooser and make it clickable - Remove browse button. - Make the entire file chooser container clickable. - Add glowing effect on hover for file chooser. - Change color of file chooser on hover. * Replace crypto.randomUUID() with UUID.uuidv4() - Replace crypto.randomUUID() with UUID.uuidv4() as crypto.randomUUID() is only supported in secured contexts such as localhost 127.0.0.1 and over HTTPS * Fix merge file removal not being reflected in file chooser - Files removed from the list in merge page would now be reflected in the file chooser's container. * Make inputElement optional in removeFileById - Make inputElement optional in removeFileById, this way we could control changing inputElements files. * Add translation support to file chooser --------- Co-authored-by: Anthony Stirling <77850077+Frooodle@users.noreply.github.com>
2024-12-02 20:10:12 +02:00
<script th:src="@{'/js/fileInput.js'}" type="module"></script>
</th:block>