@@ -55,6 +96,8 @@
async function comparePDFs() {
const file1 = document.getElementById("fileInput-input").files[0];
const file2 = document.getElementById("fileInput2-input").files[0];
+ var color1 = document.getElementById('color-box1').value;
+ var color2 = document.getElementById('color-box2').value;
if (!file1 || !file2) {
console.error("Please select two PDF files to compare");
@@ -115,13 +158,15 @@
i--;
j--;
} else if (j > 0 && (i === 0 || matrix[i][j - 1] >= matrix[i - 1][j])) {
- differences.unshift(['green', words2[j - 1]]);
+ differences.unshift([color2, words2[j - 1]]);
j--;
} else if (i > 0 && (j === 0 || matrix[i][j - 1] < matrix[i - 1][j])) {
- differences.unshift(['red', words1[i - 1]]);
+ differences.unshift([color1, words1[i - 1]]);
i--;
}
}
+ console.log(differences);
+
return differences;
};
@@ -138,14 +183,14 @@
const span1 = document.createElement("span");
const span2 = document.createElement("span");
- // If it's an addition, show it in green in the second document and transparent in the first
- if (color === "green") {
+ // If it's an addition, show it in color2 in the second document and transparent in the first
+ if (color === color2) {
span1.style.color = "transparent";
span1.style.userSelect = "none";
span2.style.color = color;
}
- // If it's a deletion, show it in red in the first document and transparent in the second
- else if (color === "red") {
+ // If it's a deletion, show it in color1 in the first document and transparent in the second
+ else if (color === color1) {
span1.style.color = color;
span2.style.color = "transparent";
span2.style.userSelect = "none";
diff --git a/src/test/java/stirling/software/SPDF/utils/SPdfApplicationTest.java b/src/test/java/stirling/software/SPDF/utils/SPdfApplicationTest.java
index e37e74b67..f9229b64d 100644
--- a/src/test/java/stirling/software/SPDF/utils/SPdfApplicationTest.java
+++ b/src/test/java/stirling/software/SPDF/utils/SPdfApplicationTest.java
@@ -5,7 +5,6 @@ import static org.junit.jupiter.api.Assertions.*;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
-import java.nio.file.Paths;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@@ -44,18 +43,6 @@ public class SPdfApplicationTest {
@Test
public void testMainApplicationStartup() throws IOException, InterruptedException {
- // Setup mock environment for the main method
- Path settingsPath = Paths.get("configs/settings.yml");
- Path customSettingsPath = Paths.get("configs/custom_settings.yml");
-
- // Ensure the files do not exist for the test
- if (Files.exists(settingsPath)) {
- Files.delete(settingsPath);
- }
- if (Files.exists(customSettingsPath)) {
- Files.delete(customSettingsPath);
- }
-
// Run the main method
SPdfApplication.main(new String[]{});