Fix: Thymeleaf syntax (/*[[...]]*/) (#2659)

# Description

Please provide a summary of the changes, including relevant motivation
and context.

Closes #(issue_number)

## Checklist

- [x] I have read the [Contribution
Guidelines](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/CONTRIBUTING.md)
- [x] I have performed a self-review of my own code
- [ ] I have attached images of the change if it is UI based
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] If my code has heavily changed functionality I have updated
relevant docs on [Stirling-PDFs doc
repo](https://github.com/Stirling-Tools/Stirling-Tools.github.io/blob/main/docs/)
- [x] My changes generate no new warnings
- [ ] I have read the section [Add New Translation
Tags](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/HowToAddNewLanguage.md#add-new-translation-tags)
(for new translation tags only)
This commit is contained in:
Ludy
2025-01-12 01:18:35 +01:00
committed by GitHub
parent b2da426cc1
commit 76cbf94fdc
14 changed files with 183 additions and 186 deletions

View File

@@ -1,10 +1,10 @@
document.addEventListener("DOMContentLoaded", function() {
var cacheInputs = localStorage.getItem("cacheInputs") || "disabled";
if (cacheInputs !== "enabled") {
return; // Stop execution if caching is not enabled
}
// Function to generate a key based on the form's action attribute
function generateStorageKey(form) {
const action = form.getAttribute('action');
@@ -24,11 +24,11 @@ document.addEventListener("DOMContentLoaded", function() {
for (let i = 0; i < elements.length; i++) {
const element = elements[i];
// Skip elements without names, passwords, files, hidden fields, and submit/reset buttons
if (!element.name ||
element.type === 'password' ||
element.type === 'file' ||
//element.type === 'hidden' ||
element.type === 'submit' ||
if (!element.name ||
element.type === 'password' ||
element.type === 'file' ||
//element.type === 'hidden' ||
element.type === 'submit' ||
element.type === 'reset') {
continue;
}

View File

@@ -18,7 +18,7 @@ document.addEventListener('DOMContentLoaded', function() {
// Find all forms and add CSRF token
const forms = document.querySelectorAll('form');
const csrfToken = decodeCsrfToken(getCsrfToken());
// Only proceed if we have a cookie-based token
if (csrfToken) {
forms.forEach(form => {
@@ -34,4 +34,4 @@ document.addEventListener('DOMContentLoaded', function() {
form.appendChild(csrfInput);
});
}
});
});

View File

@@ -102,4 +102,4 @@ document.addEventListener("DOMContentLoaded", function () {
toggleDarkMode();
});
}
});
});

View File

@@ -4,7 +4,7 @@ window.fetchWithCsrf = async function(url, options = {}) {
.split('; ')
.find(row => row.startsWith('XSRF-TOKEN='))
?.split('=')[1];
if (cookieValue) {
return cookieValue;
}
@@ -14,10 +14,10 @@ window.fetchWithCsrf = async function(url, options = {}) {
// Create a new options object to avoid modifying the passed object
const fetchOptions = { ...options };
// Ensure headers object exists
fetchOptions.headers = { ...options.headers };
// Add CSRF token if available
const csrfToken = getCsrfToken();
if (csrfToken) {
@@ -25,4 +25,4 @@ window.fetchWithCsrf = async function(url, options = {}) {
}
return fetch(url, fetchOptions);
}
}

View File

@@ -32,8 +32,8 @@ function initializeGame() {
const BASE_SPAWN_INTERVAL_MS = 1250; // milliseconds before a new enemy spawns
const LEVEL_INCREASE_FACTOR_MS = 25; // milliseconds to decrease the spawn interval per level
const MAX_SPAWN_RATE_REDUCTION_MS = 800; // Max milliseconds from the base spawn interval
let keysPressed = {};
const pdfs = [];
const projectiles = [];
@@ -42,7 +42,7 @@ function initializeGame() {
let pdfSpeed = BASE_PDF_SPEED;
let gameOver = false;
function handleKeys() {
if (keysPressed["ArrowLeft"]) {
playerX -= PLAYER_MOVE_SPEED;
@@ -72,7 +72,7 @@ function initializeGame() {
function onKeyUp(event) {
keysPressed[event.key] = false;
}
document.removeEventListener("keydown", onKeydown);
document.removeEventListener("keyup", onKeyUp);
document.addEventListener("keydown", onKeydown);
@@ -243,7 +243,7 @@ function initializeGame() {
let spawnPdfTimeout;
function spawnPdfInterval() {
if (gameOver || paused) {

View File

@@ -39,4 +39,3 @@ document.getElementById("cacheInputs").addEventListener("change", function () {
cacheInputs = this.checked ? "enabled" : "disabled";
localStorage.setItem("cacheInputs", cacheInputs);
});