1
0
mirror of https://github.com/Stirling-Tools/Stirling-PDF.git synced 2024-10-01 08:50:11 +02:00

Merge pull request #12 from Frooodle/main

Add order change
This commit is contained in:
Anthony Stirling 2023-01-30 21:00:08 +00:00 committed by GitHub
commit bac4306e78
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 79 additions and 4 deletions

View File

@ -6,11 +6,11 @@ on:
- master
- main
jobs:
build:
push:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK 17

View File

@ -4,6 +4,10 @@ This is a locally hosted web application that allows you to perform various oper
I will support and fix/add things to this if there is a demand [Discord](https://discord.gg/Cn8pWhQRxZ)
![stirling-home](images/stirling-home.png)
## Features
- Split PDFs into multiple files at specified page numbers or extract all pages as individual files.

View File

@ -5,7 +5,7 @@ plugins {
}
group = 'stirling.software'
version = '0.2.0'
version = '0.2.1'
sourceCompatibility = '17'
repositories {

BIN
images/stirling-home.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

View File

@ -11,4 +11,13 @@ body {
.jumbotron {
background-color: #222; /* or any other dark color */
color: #fff; /* or any other light color */
}
.list-group {
background-color: #222 !important;
color: fff !important;
}
.list-group-item {
background-color: #222 !important;
color: fff !important;
}

View File

@ -25,13 +25,75 @@
class="custom-file-label">Choose PDFs</label>
</div>
</div>
<div class="form-group">
<ul id="selectedFiles" class="list-group"></ul>
</div>
<div class="form-group text-center">
<button type="submit" class="btn btn-primary">Merge</button>
</div>
</form>
<th:block th:insert="~{common :: filelist}"></th:block>
<script>
document.getElementById("fileInput").addEventListener("change", function() {
var files = this.files;
var list = document.getElementById("selectedFiles");
list.innerHTML = "";
for (var i = 0; i < files.length; i++) {
var item = document.createElement("li");
item.className = "list-group-item d-flex justify-content-between align-items-center";
item.textContent = files[i].name;
item.innerHTML += '<div><button class="btn btn-secondary move-up">Move Up</button> <button class="btn btn-secondary move-down">Move Down</button></div>';
list.appendChild(item);
}
var moveUpButtons = document.querySelectorAll(".move-up");
for (var i = 0; i < moveUpButtons.length; i++) {
moveUpButtons[i].addEventListener("click", function(event) {
event.preventDefault();
var parent = this.parentNode.parentNode;
var grandParent = parent.parentNode;
if (parent.previousElementSibling) {
grandParent.insertBefore(parent, parent.previousElementSibling);
updateFiles();
}
});
}
var moveDownButtons = document.querySelectorAll(".move-down");
for (var i = 0; i < moveDownButtons.length; i++) {
moveDownButtons[i].addEventListener("click", function(event) {
event.preventDefault();
var parent = this.parentNode.parentNode;
var grandParent = parent.parentNode;
if (parent.nextElementSibling) {
grandParent.insertBefore(parent.nextElementSibling, parent);
updateFiles();
}
});
}
function updateFiles() {
var dataTransfer = new DataTransfer();
var liElements = document.querySelectorAll("#selectedFiles li");
for (var i = 0; i < liElements.length; i++) {
var fileNameFromList = liElements[i].innerText.replace("\nMove Up Move Down","");
var fileFromFiles
for (var j = 0; j < files.length; j++) {
var file = files[j];
if(file.name === fileNameFromList){
dataTransfer.items.add(file);
break;
}
}
}
document.getElementById("fileInput").files = dataTransfer.files;
}
});
</script>