acadmic texts

This commit is contained in:
Manuel
2025-09-23 20:01:52 +02:00
parent 2658a71651
commit 918889e6df
24 changed files with 1040 additions and 867 deletions

62
static/css/settings.css Normal file → Executable file
View File

@@ -9,13 +9,8 @@
border-bottom: 1px solid var(--divider-color);
}
.settings-header h1 {e
margin: 0 0 0.25rem 0;
}
.settings-header p {
.settings-header h1 {
margin: 0;
color: var(--muted-text);
}
.back-button {
@@ -32,11 +27,18 @@
background-color: var(--primary-hover);
}
/* Main layout grid for settings */
.settings-main-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
gap: 2rem;
}
.settings-group {
border: 1px solid var(--border-color);
border-radius: 8px;
padding: 1.5rem;
margin-bottom: 2rem;
margin-bottom: 2rem; /* Kept for spacing when grid stacks */
}
.settings-group legend {
@@ -70,36 +72,39 @@
.form-textarea {
resize: vertical;
min-height: 60px;
font-family: 'Courier New', Courier, monospace;
/* Use a more standard monospace font stack */
font-family: Consolas, 'Courier New', Courier, monospace;
}
.field-description {
font-size: 0.85rem;
font-size: 0.9rem;
color: var(--muted-text);
margin-top: -0.5rem;
margin-bottom: 1rem;
margin-top: 0.25rem;
margin-bottom: 0.75rem;
line-height: 1.4;
}
.field-description code {
background-color: rgba(255,255,255,0.1);
padding: 0.1rem 0.3rem;
border-radius: 3px;
font-size: 0.8rem;
font-size: 0.85rem;
}
.checkbox-group {
display: flex;
align-items: center;
gap: 0.75rem;
margin-bottom: 0.5rem;
margin-bottom: 0.75rem;
}
.checkbox-group input[type="checkbox"] {
width: 1rem;
height: 1rem;
width: 1.1rem;
height: 1.1rem;
accent-color: var(--primary-color);
}
.tool-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
grid-template-columns: 1fr; /* Simplified to single column within a settings group */
gap: 1rem;
}
@@ -121,22 +126,23 @@
gap: 1rem;
margin-top: 1.5rem;
}
.button-primary {
display: inline-block;
background: var(--primary-color);
background-color: transparent;
border-color: var(--border-color);
border-width: 1px;
color: #ffffff;
color: var(--bg-color);
border: 1px solid var(--primary-color);
padding: 0.65rem 1.5rem;
font-size: 1rem;
font-weight: 600;
border-radius: 5px;
cursor: pointer;
transition: background-color 0.15s ease;
transition: all 0.15s ease;
}
.button-primary:hover {
background: var(--primary-hover);
color: var(--text-color);
border-color: var(--primary-hover);
}
.save-status {
@@ -191,4 +197,16 @@
}
.button-danger:hover {
background-color: #ff8f8f;
}
}
/* Responsive adjustments */
@media (max-width: 768px) {
.danger-action {
flex-direction: column;
align-items: flex-start;
}
.button-danger {
width: 100%;
text-align: center;
}
}

2
static/css/style.css Normal file → Executable file
View File

@@ -18,7 +18,7 @@
--border-color: rgba(255, 255, 255, 0.1);
--divider-color: rgba(255, 255, 255, 0.06);
--font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
--font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
/* Page */

0
static/css/style.old Normal file → Executable file
View File

0
static/favicon.ico Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

0
static/favicon.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 702 B

After

Width:  |  Height:  |  Size: 702 B

794
static/js/script.js Normal file → Executable file

File diff suppressed because it is too large Load Diff

0
static/js/script.old Normal file → Executable file
View File

58
static/js/settings.js Normal file → Executable file
View File

@@ -5,47 +5,51 @@ document.addEventListener('DOMContentLoaded', () => {
const clearHistoryBtn = document.getElementById('clear-history-btn');
const deleteFilesBtn = document.getElementById('delete-files-btn');
// --- Save Settings ---
// --- Save Settings ---
settingsForm.addEventListener('submit', async (event) => {
event.preventDefault();
saveStatus.textContent = 'Saving...';
saveStatus.classList.remove('success', 'error');
const formData = new FormData(settingsForm);
const settingsObject = {};
const elements = Array.from(settingsForm.elements);
// Convert FormData to a nested object
formData.forEach((value, key) => {
// Handle checkboxes that might not be submitted if unchecked
if (key.includes('ocr_settings')) {
const checkbox = document.querySelector(`[name="${key}"]`);
if (checkbox && checkbox.type === 'checkbox') {
value = checkbox.checked;
}
for (const el of elements) {
if (!el.name || el.type === 'submit') continue; // Skip elements without a name and submit buttons
let value;
const keys = el.name.split('.');
// Determine value based on element type
if (el.type === 'checkbox') {
value = el.checked;
} else if (el.tagName === 'TEXTAREA') {
// Convert comma-separated text into an array of strings
value = el.value.split(',')
.map(item => item.trim())
.filter(item => item); // Remove empty strings from the list
} else if (el.type === 'number') {
value = parseFloat(el.value);
if (isNaN(value)) {
value = null; // Represent empty number fields as null
}
} else {
value = el.value;
}
const keys = key.split('.');
// Build nested object from dot-notation name
let current = settingsObject;
keys.forEach((k, index) => {
if (index === keys.length - 1) {
current[k] = value;
} else {
current[k] = current[k] || {};
if (!current[k]) {
current[k] = {};
}
current = current[k];
}
});
});
// Ensure unchecked OCR boxes are sent as false
const ocrCheckboxes = settingsForm.querySelectorAll('input[type="checkbox"][name^="ocr_settings"]');
ocrCheckboxes.forEach(cb => {
const keys = cb.name.split('.');
if (!formData.has(cb.name)) {
// this is a bit of a hack but gets the job done for this specific form
settingsObject[keys[0]][keys[1]][keys[2]] = false;
}
});
}
try {
const response = await fetch('/settings/save', {
@@ -74,7 +78,7 @@ document.addEventListener('DOMContentLoaded', () => {
}
});
// --- Clear History ---
// --- Clear History ---
clearHistoryBtn.addEventListener('click', async () => {
if (!confirm('ARE YOU SURE?\n\nThis will permanently delete all job history records from the database.')) {
return;
@@ -90,7 +94,7 @@ document.addEventListener('DOMContentLoaded', () => {
}
});
// --- Delete Files ---
// --- Delete Files ---
deleteFilesBtn.addEventListener('click', async () => {
if (!confirm('ARE YOU SURE?\n\nThis will permanently delete all files in the "processed" folder.')) {
return;
@@ -105,4 +109,4 @@ document.addEventListener('DOMContentLoaded', () => {
console.error(error);
}
});
});
});