forked from Stirling-Tools/Stirling-PDF
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Multi-tool advert on pages that share functionality
- Loading branch information
1 parent
ef18b17
commit aac6d4b
Showing
8 changed files
with
299 additions
and
200 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,44 @@ | ||
<!DOCTYPE html> | ||
<html th:lang="${#locale.language}" th:dir="#{language.direction}" th:data-language="${#locale.toString()}" xmlns:th="https://www.thymeleaf.org"> | ||
<head> | ||
<th:block th:insert="~{fragments/common :: head(title=#{pageExtracter.title}, header=#{pageExtracter.header})}"></th:block> | ||
</head> | ||
<html th:lang="${#locale.language}" th:dir="#{language.direction}" th:data-language="${#locale.toString()}" | ||
xmlns:th="https://www.thymeleaf.org"> | ||
|
||
<body> | ||
<div id="page-container"> | ||
<div id="content-wrap"> | ||
<th:block th:insert="~{fragments/navbar.html :: navbar}"></th:block> | ||
<br><br> | ||
<div class="container"> | ||
<div class="row justify-content-center"> | ||
<div class="col-md-6 bg-card"> | ||
<div class="tool-header"> | ||
<span class="material-symbols-rounded tool-header-icon organize">upload</span> | ||
<span class="tool-header-text" th:text="#{pageExtracter.header}"></span> | ||
</div> | ||
<form th:action="@{'/api/v1/general/rearrange-pages'}" method="post" enctype="multipart/form-data"> | ||
<div th:replace="~{fragments/common :: fileSelector(name='fileInput', multipleInputsForSingleRequest=false, accept='application/pdf')}"></div> | ||
<input type="hidden" id="customMode" name="customMode" value=""> | ||
<div class="mb-3"> | ||
<label for="pageOrder" th:text="#{pageOrderPrompt}"></label> | ||
<input type="text" class="form-control" id="pageOrder" name="pageNumbers" th:placeholder="#{pageExtracter.placeholder}" required> | ||
</div> | ||
<head> | ||
<th:block th:insert="~{fragments/common :: head(title=#{pageExtracter.title}, header=#{pageExtracter.header})}"> | ||
</th:block> | ||
</head> | ||
|
||
<button type="submit" id="submitBtn" class="btn btn-primary" th:text="#{pageExtracter.submit}"></button> | ||
</form> | ||
<body> | ||
<div id="page-container"> | ||
<div id="content-wrap"> | ||
<th:block th:insert="~{fragments/navbar.html :: navbar}"></th:block> | ||
<br><br> | ||
<th:block th:insert="~{fragments/multi-toolAdvert.html :: multi-toolAdvert}"></th:block> | ||
<div class="container"> | ||
<div class="row justify-content-center"> | ||
<div class="col-md-6 bg-card"> | ||
<div class="tool-header"> | ||
<span class="material-symbols-rounded tool-header-icon organize">upload</span> | ||
<span class="tool-header-text" th:text="#{pageExtracter.header}"></span> | ||
</div> | ||
<form th:action="@{'/api/v1/general/rearrange-pages'}" method="post" enctype="multipart/form-data"> | ||
<div | ||
th:replace="~{fragments/common :: fileSelector(name='fileInput', multipleInputsForSingleRequest=false, accept='application/pdf')}"> | ||
</div> | ||
<input type="hidden" id="customMode" name="customMode" value=""> | ||
<div class="mb-3"> | ||
<label for="pageOrder" th:text="#{pageOrderPrompt}"></label> | ||
<input type="text" class="form-control" id="pageOrder" name="pageNumbers" | ||
th:placeholder="#{pageExtracter.placeholder}" required> | ||
</div> | ||
|
||
<button type="submit" id="submitBtn" class="btn btn-primary" th:text="#{pageExtracter.submit}"></button> | ||
</form> | ||
</div> | ||
</div> | ||
</div> | ||
<th:block th:insert="~{fragments/footer.html :: footer}"></th:block> | ||
</div> | ||
</body> | ||
<th:block th:insert="~{fragments/footer.html :: footer}"></th:block> | ||
</div> | ||
</body> | ||
|
||
</html> |
57 changes: 57 additions & 0 deletions
57
src/main/resources/templates/fragments/multi-toolAdvert.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<div th:fragment="multi-toolAdvert" class="mx-auto"> | ||
<div id="multi-toolAdvert" class="multi-toolAdvert"> | ||
<div> | ||
<span th:utext="#{multiTool-advert.message(|/multi-tool|)}"></span> | ||
<button id="closeMultiToolAdvert" style="position: absolute; | ||
top: 10px; | ||
right: 12px; | ||
border: none; | ||
background: transparent; | ||
color: white; | ||
cursor: pointer; | ||
font-size: 1.2rem; | ||
line-height: 1;" aria-label="Close">×</button> | ||
</div> | ||
</div> | ||
<style> | ||
.multi-toolAdvert { | ||
margin-bottom: 10px; | ||
margin-left: 50%; | ||
transform: translateX(-50%); | ||
max-width: 52rem; | ||
z-index: 0; | ||
background-color: var(--md-sys-color-surface-5); | ||
border-radius: 2rem; | ||
padding: 10px 27px 10px 20px; | ||
font-size: 0.9rem; | ||
display: none; | ||
justify-content: center; | ||
} | ||
|
||
.multi-toolAdvert a { | ||
color: #007bff; | ||
font-weight: bold; | ||
} | ||
|
||
.multi-toolAdvert a:hover { | ||
text-decoration: underline; | ||
} | ||
</style> | ||
<script> | ||
document.addEventListener('DOMContentLoaded', () => { | ||
const advert = document.getElementById('multi-toolAdvert'); | ||
const closeBtn = document.getElementById('closeMultiToolAdvert'); | ||
|
||
const cacheKey = `closeMultiToolAdvert_${window.location.pathname}`; | ||
|
||
if (localStorage.getItem(cacheKey) !== 'true') { | ||
advert.style.display = 'flex'; | ||
} | ||
|
||
closeBtn.addEventListener('click', () => { | ||
advert.style.display = 'none'; | ||
localStorage.setItem(cacheKey, 'true'); | ||
}); | ||
}); | ||
</script> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,60 +1,69 @@ | ||
<!DOCTYPE html> | ||
<html th:lang="${#locale.language}" th:dir="#{language.direction}" th:data-language="${#locale.toString()}" xmlns:th="https://www.thymeleaf.org"> | ||
<head> | ||
<th:block th:insert="~{fragments/common :: head(title=#{pdfOrganiser.title}, header=#{pdfOrganiser.header})}"></th:block> | ||
</head> | ||
<html th:lang="${#locale.language}" th:dir="#{language.direction}" th:data-language="${#locale.toString()}" | ||
xmlns:th="https://www.thymeleaf.org"> | ||
|
||
<body> | ||
<div id="page-container"> | ||
<div id="content-wrap"> | ||
<th:block th:insert="~{fragments/navbar.html :: navbar}"></th:block> | ||
<br><br> | ||
<div class="container"> | ||
<div class="row justify-content-center"> | ||
<div class="col-md-6 bg-card"> | ||
<div class="tool-header"> | ||
<span class="material-symbols-rounded tool-header-icon organize">format_list_bulleted</span> | ||
<span class="tool-header-text" th:text="#{pdfOrganiser.header}"></span> | ||
</div> | ||
<head> | ||
<th:block th:insert="~{fragments/common :: head(title=#{pdfOrganiser.title}, header=#{pdfOrganiser.header})}"> | ||
</th:block> | ||
</head> | ||
|
||
<form th:action="@{'/api/v1/general/rearrange-pages'}" method="post" enctype="multipart/form-data"> | ||
<div th:replace="~{fragments/common :: fileSelector(name='fileInput', multipleInputsForSingleRequest=false, accept='application/pdf')}"></div> | ||
<div class="mb-3"> | ||
<label for="customMode" th:text="#{pdfOrganiser.mode}">Mode</label> | ||
<select class="form-control" id="customMode" name="customMode"> | ||
<option value="" th:text="#{pdfOrganiser.mode.1}">Custom Page Order</option> | ||
<option value="REVERSE_ORDER" th:text="#{pdfOrganiser.mode.2}">Reverse Order</option> | ||
<option value="DUPLEX_SORT" th:text="#{pdfOrganiser.mode.3}">Duplex Sort</option> | ||
<option value="BOOKLET_SORT" th:text="#{pdfOrganiser.mode.4}">Booklet Sort</option> | ||
<option value="SIDE_STITCH_BOOKLET_SORT" th:text="#{pdfOrganiser.mode.5}">Side Stitch Booklet Sort</option> | ||
<option value="ODD_EVEN_SPLIT" th:text="#{pdfOrganiser.mode.6}">Odd-Even Split</option> | ||
<option value="ODD_EVEN_MERGE" th:text="#{pdfOrganiser.mode.10}">Odd-Even Merge</option> | ||
<option value="REMOVE_FIRST" th:text="#{pdfOrganiser.mode.7}">Remove First</option> | ||
<option value="REMOVE_LAST" th:text="#{pdfOrganiser.mode.8}">Remove Last</option> | ||
<option value="REMOVE_FIRST_AND_LAST" th:text="#{pdfOrganiser.mode.9}">Remove First and Last</option> | ||
</select> | ||
</div> | ||
<div class="mb-3"> | ||
<label for="pageOrder" th:text="#{pageOrderPrompt}"></label> | ||
<input type="text" class="form-control" id="pageOrder" name="pageNumbers" th:placeholder="#{pdfOrganiser.placeholder}" required> | ||
</div> | ||
<button type="submit" id="submitBtn" class="btn btn-primary" th:text="#{pdfOrganiser.submit}"></button> | ||
</form> | ||
<script> | ||
document.getElementById('customMode').addEventListener('change', function () { | ||
var pageOrderInput = document.getElementById('pageOrder'); | ||
if (this.value === "") { | ||
pageOrderInput.disabled = false; | ||
} else { | ||
pageOrderInput.disabled = true; | ||
} | ||
}); | ||
</script> | ||
<body> | ||
<div id="page-container"> | ||
<div id="content-wrap"> | ||
<th:block th:insert="~{fragments/navbar.html :: navbar}"></th:block> | ||
<br><br> | ||
<th:block th:insert="~{fragments/multi-toolAdvert.html :: multi-toolAdvert}"></th:block> | ||
<div class="container"> | ||
<div class="row justify-content-center"> | ||
<div class="col-md-6 bg-card"> | ||
<div class="tool-header"> | ||
<span class="material-symbols-rounded tool-header-icon organize">format_list_bulleted</span> | ||
<span class="tool-header-text" th:text="#{pdfOrganiser.header}"></span> | ||
</div> | ||
|
||
<form th:action="@{'/api/v1/general/rearrange-pages'}" method="post" enctype="multipart/form-data"> | ||
<div | ||
th:replace="~{fragments/common :: fileSelector(name='fileInput', multipleInputsForSingleRequest=false, accept='application/pdf')}"> | ||
</div> | ||
<div class="mb-3"> | ||
<label for="customMode" th:text="#{pdfOrganiser.mode}">Mode</label> | ||
<select class="form-control" id="customMode" name="customMode"> | ||
<option value="" th:text="#{pdfOrganiser.mode.1}">Custom Page Order</option> | ||
<option value="REVERSE_ORDER" th:text="#{pdfOrganiser.mode.2}">Reverse Order</option> | ||
<option value="DUPLEX_SORT" th:text="#{pdfOrganiser.mode.3}">Duplex Sort</option> | ||
<option value="BOOKLET_SORT" th:text="#{pdfOrganiser.mode.4}">Booklet Sort</option> | ||
<option value="SIDE_STITCH_BOOKLET_SORT" th:text="#{pdfOrganiser.mode.5}">Side Stitch Booklet Sort | ||
</option> | ||
<option value="ODD_EVEN_SPLIT" th:text="#{pdfOrganiser.mode.6}">Odd-Even Split</option> | ||
<option value="ODD_EVEN_MERGE" th:text="#{pdfOrganiser.mode.10}">Odd-Even Merge</option> | ||
<option value="REMOVE_FIRST" th:text="#{pdfOrganiser.mode.7}">Remove First</option> | ||
<option value="REMOVE_LAST" th:text="#{pdfOrganiser.mode.8}">Remove Last</option> | ||
<option value="REMOVE_FIRST_AND_LAST" th:text="#{pdfOrganiser.mode.9}">Remove First and Last</option> | ||
</select> | ||
</div> | ||
<div class="mb-3"> | ||
<label for="pageOrder" th:text="#{pageOrderPrompt}"></label> | ||
<input type="text" class="form-control" id="pageOrder" name="pageNumbers" | ||
th:placeholder="#{pdfOrganiser.placeholder}" required> | ||
</div> | ||
<button type="submit" id="submitBtn" class="btn btn-primary" th:text="#{pdfOrganiser.submit}"></button> | ||
</form> | ||
<script> | ||
document.getElementById('customMode').addEventListener('change', function () { | ||
var pageOrderInput = document.getElementById('pageOrder'); | ||
if (this.value === "") { | ||
pageOrderInput.disabled = false; | ||
} else { | ||
pageOrderInput.disabled = true; | ||
} | ||
}); | ||
</script> | ||
</div> | ||
</div> | ||
</div> | ||
<th:block th:insert="~{fragments/footer.html :: footer}"></th:block> | ||
</div> | ||
</body> | ||
<th:block th:insert="~{fragments/footer.html :: footer}"></th:block> | ||
</div> | ||
</body> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,48 @@ | ||
<!DOCTYPE html> | ||
<html th:lang="${#locale.language}" th:dir="#{language.direction}" th:data-language="${#locale.toString()}" xmlns:th="https://www.thymeleaf.org"> | ||
<head> | ||
<th:block th:insert="~{fragments/common :: head(title=#{pageRemover.title}, header=#{pageRemover.header})}"></th:block> | ||
</head> | ||
<html th:lang="${#locale.language}" th:dir="#{language.direction}" th:data-language="${#locale.toString()}" | ||
xmlns:th="https://www.thymeleaf.org"> | ||
|
||
<body> | ||
<div id="page-container"> | ||
<div id="content-wrap"> | ||
<th:block th:insert="~{fragments/navbar.html :: navbar}"></th:block> | ||
<br><br> | ||
<div class="container"> | ||
<div class="row justify-content-center"> | ||
<div class="col-md-6 bg-card"> | ||
<div class="tool-header"> | ||
<span class="material-symbols-rounded tool-header-icon organize">delete</span> | ||
<span class="tool-header-text" th:text="#{pageRemover.header}"></span> | ||
</div> | ||
<head> | ||
<th:block th:insert="~{fragments/common :: head(title=#{pageRemover.title}, header=#{pageRemover.header})}"> | ||
</th:block> | ||
</head> | ||
|
||
<form th:action="@{'/api/v1/general/remove-pages'}" method="post" enctype="multipart/form-data"> | ||
<div th:replace="~{fragments/common :: fileSelector(name='fileInput', multipleInputsForSingleRequest=false, accept='application/pdf')}"></div> | ||
<div class="mb-3"> | ||
<label for="fileInput" th:text="#{pageRemover.pagesToDelete}"></label> | ||
<input type="text" class="form-control" id="fileInput" name="pageNumbers" th:placeholder="#{pageRemover.placeholder}" required> | ||
</div> | ||
<button type="submit" id="submitBtn" class="btn btn-primary" th:text="#{pageRemover.submit}"></button> | ||
</form> | ||
<body> | ||
<div id="page-container"> | ||
<div id="content-wrap"> | ||
<th:block th:insert="~{fragments/navbar.html :: navbar}"></th:block> | ||
<br><br> | ||
<th:block th:insert="~{fragments/multi-toolAdvert.html :: multi-toolAdvert}"></th:block> | ||
<div class="container"> | ||
<div class="row justify-content-center"> | ||
<div class="col-md-6 bg-card"> | ||
<div class="tool-header"> | ||
<span class="material-symbols-rounded tool-header-icon organize">delete</span> | ||
<span class="tool-header-text" th:text="#{pageRemover.header}"></span> | ||
</div> | ||
|
||
<form th:action="@{'/api/v1/general/remove-pages'}" method="post" enctype="multipart/form-data"> | ||
<div | ||
th:replace="~{fragments/common :: fileSelector(name='fileInput', multipleInputsForSingleRequest=false, accept='application/pdf')}"> | ||
</div> | ||
<div class="mb-3"> | ||
<label for="fileInput" th:text="#{pageRemover.pagesToDelete}"></label> | ||
<input type="text" class="form-control" id="fileInput" name="pageNumbers" | ||
th:placeholder="#{pageRemover.placeholder}" required> | ||
</div> | ||
<button type="submit" id="submitBtn" class="btn btn-primary" th:text="#{pageRemover.submit}"></button> | ||
</form> | ||
</div> | ||
</div> | ||
</div> | ||
<th:block th:insert="~{fragments/footer.html :: footer}"></th:block> | ||
</div> | ||
<script> | ||
document.getElementById('fileInput').addEventListener('input', function(){ | ||
this.value =this.value.replace(/\s+/g, '');; | ||
}); | ||
</script> | ||
</body> | ||
</html> | ||
<th:block th:insert="~{fragments/footer.html :: footer}"></th:block> | ||
</div> | ||
<script> | ||
document.getElementById('fileInput').addEventListener('input', function () { | ||
this.value = this.value.replace(/\s+/g, '');; | ||
}); | ||
</script> | ||
</body> | ||
|
||
</html> |
Oops, something went wrong.