Fix metadata display not wrapping long lines. Add LaTeX support

This commit is contained in:
Kylian Schmidt
2025-07-29 14:05:22 +02:00
parent fc4928fef1
commit c6882b2a48
7 changed files with 137 additions and 36 deletions
+18 -1
View File
@@ -9,7 +9,7 @@ body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
margin: 0;
padding: 1rem;
padding-bottom: 2rem;
padding-bottom: 400px; /* Further increased bottom padding to prevent overlap with stats box */
background-color: var(--bg-color);
color: var(--text-color);
transition: background-color 0.3s, color 0.3s;
@@ -52,3 +52,20 @@ ul li a:hover {
color: var(--link-hover);
text-decoration: underline;
}
/* Responsive design adjustments */
@media (max-width: 768px) {
body {
padding: 0.5rem;
padding-bottom: 300px; /* Further increased mobile bottom padding to match desktop */
}
h1 {
font-size: 1.5rem;
}
h2 {
font-size: 1.2rem;
margin: 1rem 0 0.5rem 0;
}
}
+37 -5
View File
@@ -3,12 +3,14 @@
======================================== */
.floating-buttons {
position: fixed;
bottom: 20px;
right: 20px;
bottom: 80px;
right: 15px;
display: flex;
flex-direction: column;
gap: 10px;
z-index: 1000;
/* Ensure buttons don't interfere with content */
pointer-events: none;
}
.floating-btn {
@@ -23,6 +25,8 @@
display: flex;
align-items: center;
justify-content: center;
/* Re-enable pointer events for buttons */
pointer-events: auto;
}
.floating-btn:hover {
@@ -39,22 +43,39 @@
color: white;
}
/* Responsive adjustments */
@media (max-width: 768px) {
.floating-buttons {
bottom: 60px;
right: 10px;
gap: 8px;
}
.floating-btn {
width: 48px;
height: 48px;
font-size: 1.1rem;
}
}
/* ========================================
KEYBOARD SHORTCUTS HELP
======================================== */
.shortcuts-help {
position: fixed;
bottom: 140px;
right: 20px;
bottom: 220px;
right: 15px;
background: var(--card-bg);
border: 1px solid var(--border-color);
border-radius: 8px;
padding: 1rem;
display: none;
box-shadow: 0 4px 15px rgba(0,0,0,0.2);
z-index: 1000;
z-index: 1001;
font-size: 0.9rem;
max-width: 280px;
max-height: 400px;
overflow-y: auto;
}
.shortcuts-help h4 {
@@ -78,3 +99,14 @@
font-size: 0.8rem;
font-weight: 500;
}
/* Responsive adjustments */
@media (max-width: 768px) {
.shortcuts-help {
bottom: 180px;
right: 10px;
left: 10px;
max-width: none;
max-height: 300px;
}
}
+39 -23
View File
@@ -187,53 +187,69 @@
.metadata-grid {
padding: 1rem;
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: 0.5rem 1rem;
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
gap: 1rem 1.5rem; /* Increased gaps to prevent overlapping */
}
/* Metadata Items */
.metadata-item {
display: flex;
align-items: flex-start;
gap: 0.5rem;
padding: 0.25rem 0;
flex-direction: column; /* Stack key and value vertically to prevent overlap */
gap: 0.25rem;
padding: 0.75rem;
background: var(--card-bg);
border-radius: 6px;
border: 1px solid var(--border-color);
word-wrap: break-word; /* Ensure long text wraps */
overflow-wrap: break-word; /* Additional word wrapping */
}
.metadata-key {
font-weight: 600;
color: var(--link-color);
white-space: nowrap;
min-width: fit-content;
font-size: 0.9rem;
margin-bottom: 0.25rem;
}
.metadata-value {
color: var(--text-color);
word-break: break-word;
flex: 1;
overflow-wrap: break-word;
line-height: 1.4;
font-size: 0.9rem;
}
/* Tags for list items */
/* LaTeX content styling */
.latex-content {
color: var(--text-color);
line-height: 1.6;
font-family: 'Times New Roman', serif;
}
/* Simple list items - no special formatting */
.metadata-list {
display: flex;
flex-wrap: wrap;
gap: 0.25rem;
color: var(--text-color);
line-height: 1.4;
}
/* Remove the blue box styling for tags */
.metadata-tag {
background: var(--link-color);
color: white;
padding: 0.2rem 0.5rem;
border-radius: 12px;
font-size: 0.8rem;
white-space: nowrap;
display: inline;
background: none;
color: var(--text-color);
padding: 0;
border-radius: 0;
font-size: inherit;
white-space: normal;
}
/* Nested metadata */
/* Simplified nested metadata */
.metadata-nested {
background: var(--card-bg);
padding: 0.5rem;
border-radius: 4px;
border-left: 3px solid var(--link-color);
background: none;
padding: 0;
border-radius: 0;
border-left: none;
color: var(--text-color);
}
.metadata-nested-item {
+21 -2
View File
@@ -3,8 +3,8 @@
======================================== */
.gallery-stats {
position: fixed;
bottom: 20px;
left: 20px;
bottom: 80px;
left: 15px;
background: var(--card-bg);
border: 1px solid var(--border-color);
border-radius: 8px;
@@ -16,10 +16,14 @@
opacity: 0.8;
transition: opacity 0.2s ease;
max-width: 200px;
/* Ensure stats don't interfere with content */
pointer-events: none;
}
.gallery-stats:hover {
opacity: 1;
/* Re-enable pointer events on hover */
pointer-events: auto;
}
.stats-item {
@@ -38,3 +42,18 @@
font-weight: 600;
color: var(--text-color);
}
/* Responsive adjustments */
@media (max-width: 768px) {
.gallery-stats {
bottom: 60px;
left: 10px;
padding: 0.6rem 0.8rem;
font-size: 0.8rem;
max-width: 180px;
}
.stats-item {
margin: 0.15rem 0;
}
}
+1
View File
@@ -118,6 +118,7 @@
/* Plot Container Base Styles */
.plot-container {
margin: 1rem 0;
margin-bottom: 450px; /* Add extra bottom margin to prevent overlap with stats box */
transition: all 0.3s ease;
clear: both;
}
+7
View File
@@ -28,6 +28,13 @@ function toggleMetadataSection() {
content.style.display = 'block';
if (arrow) arrow.textContent = '▲';
console.log('Metadata shown');
// Trigger MathJax rendering for LaTeX content
if (typeof MathJax !== 'undefined') {
MathJax.typesetPromise([content]).catch(function (err) {
console.log('MathJax typeset failed: ' + err.message);
});
}
}
// Save state to localStorage
+14 -5
View File
@@ -4,6 +4,17 @@
<meta charset="UTF-8">
<title>{{ title }}</title>
<link rel="stylesheet" href="{{ assets_path }}/css/main.css">
<!-- MathJax for LaTeX rendering -->
<script>
MathJax = {
tex: {
inlineMath: [['$', '$'], ['\\(', '\\)']],
displayMath: [['$$', '$$'], ['\\[', '\\]']]
}
};
</script>
<script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
</head>
<body>
<!-- Main Content -->
@@ -64,16 +75,14 @@
<span class="metadata-value">
{% if value is string and (value.startswith('http://') or value.startswith('https://')) %}
<a href="{{ value }}" target="_blank" rel="noopener noreferrer">{{ value }}</a>
{% elif value is string and '$$' in value %}
<span class="latex-content">{{ value }}</span>
{% elif value is string and value|length > 100 %}
<span class="metadata-long-text">{{ value[:100] }}...</span>
<button class="metadata-expand" onclick="expandText(this)">Show more</button>
<span class="metadata-full-text" style="display: none;">{{ value }}</span>
{% elif value is iterable and value is not string and value is not mapping %}
<div class="metadata-list">
{% for item in value %}
<span class="metadata-tag">{{ item }}</span>
{% endfor %}
</div>
<span class="metadata-list">{{ value|join(', ') }}</span>
{% elif value is mapping %}
<div class="metadata-nested">
{% for subkey, subvalue in value.items() %}